Spawn Enemies with Script

Dyhego

Member
Hello Guys!

I need to help spawn enemies like this attached image, I know you have a script for that, but I have no idea how to do it.

Could anyone help?
 
Guessing there are many ways to pull it off but personally i would spawn the enemy with a alias to force them into a looping animation then have a script check if the player is in range using "findtarget" then force the enemy out of the looped animation with script to "setidle" or a getup animation.
 
Dyhego: you need to spawn the enemies + force them to start with certain animation.

For instance:
Code:
spawn	Bred
@script
void main()
{
    void self = getlocalvar("self");
    performattack(self, openborconstant("ANI_FOLLOW1"));
}
@end_script
coords	-160 190
at	0

In this example, Bred starts with FOLLOW1. which is his wait animation:
Code:
anim	follow1
	loop	1
	delay	10
	offset	120 154
	frame	data/chars/bred/wait.png
	@cmd	attack1 -500 150 400 "ANI_FOLLOW2"
	frame	data/chars/bred/wait.png

anim	follow2
	delay	10
	offset	120 154
	frame	data/chars/bred/rise3.png
	frame	data/chars/bred/walk1.png

FOLLOW1 is looped and there's special script to end the loop is player is nearby.

If you need example in form of a mod, you can download BlankMod++. You can find that Bred example in Slums level and other stuffs there ;)
 
Bloodbane said:
Dyhego: you need to spawn the enemies + force them to start with certain animation.

For instance:
Code:
spawn	Bred
@script
void main()
{
    void self = getlocalvar("self");
    performattack(self, openborconstant("ANI_FOLLOW1"));
}
@end_script
coords	-160 190
at	0

In this example, Bred starts with FOLLOW1. which is his wait animation:
Code:
anim	follow1
	loop	1
	delay	10
	offset	120 154
	frame	data/chars/bred/wait.png
	@cmd	attack1 -500 150 400 "ANI_FOLLOW2"
	frame	data/chars/bred/wait.png

anim	follow2
	delay	10
	offset	120 154
	frame	data/chars/bred/rise3.png
	frame	data/chars/bred/walk1.png

FOLLOW1 is looped and there's special script to end the loop is player is nearby.

If you need example in form of a mod, you can download BlankMod++. You can find that Bred example in Slums level and other stuffs there ;)

you are a genius my friend! it's a genius! It worked! That was what I needed, thank you very much!
 
Now I'm having a hard time making it through the stage after eliminating all enemies in a group. According to the example below, as soon as I finish eliminating all the enemies in the group, he does not move forward, it is as if he was waiting for the enemies enemy3, but they stay put until the player gets close to them.

Code:
#Group1==========================================================================
group 2 2
at 845
wait
at 845

spawn enemy1
coords -90 230
at 845

spawn enemy2
coords 390 175
at 845


#SpawnWaitEnemys=====================================================================

spawn enemy3
@script
void main()
{
    void self = getlocalvar("self");
    performattack(self, openborconstant("ANI_FOLLOW1"));
}
@end_script
coords 911 173
at 0

spawn enemy3
@script
void main()
{
    void self = getlocalvar("self");
    performattack(self, openborconstant("ANI_FOLLOW1"));
}
@end_script
coords 934 199
at 0

spawn enemy3
@script
void main()
{
    void self = getlocalvar("self");
    performattack(self, openborconstant("ANI_FOLLOW1"));
}
@end_script
coords 978 220
at 0
 
You have to be careful with spawning waiting enemies, if you spawn them while wait is active, you get the problem you've described. Waiting enemies are best spawned when wait isn't active or when player is scrolling forward.
To fix your problem, try setting scrollpos higher than last wait like .... wait a second, 900+ pixels for x is pretty far offscreen, even with 640x480 resolution.
I assume you actually want to spawn these waiting enemies before wait so they will greet player when player enters the wait.
Hmmm.... try this instead:
Code:
#SpawnWaitEnemys=====================================================================

spawn enemy3
@script
void main()
{
    void self = getlocalvar("self");
    performattack(self, openborconstant("ANI_FOLLOW1"));
}
@end_script
coords 411 173
at 500

spawn enemy3
@script
void main()
{
    void self = getlocalvar("self");
    performattack(self, openborconstant("ANI_FOLLOW1"));
}
@end_script
coords 404 199
at 530

spawn enemy3
@script
void main()
{
    void self = getlocalvar("self");
    performattack(self, openborconstant("ANI_FOLLOW1"));
}
@end_script
coords 403 220
at 575


#Group1==========================================================================
group 2 2
at 845
wait
at 845

spawn enemy1
coords -90 230
at 845

spawn enemy2
coords 390 175
at 845
 
Back
Top Bottom