📧 Message Board Archive

scripting help
so... how do I make a sprite that is attacking dink stop? I tried,   sp_target(&current_sprite,0); then,  sp_target(&current_sprite,-1);  but no luck. Ideas?
Re: scripting help
: so... how do I make a sprite that is attacking dink stop? I tried, sp_target(&current_sprite,0); then, sp_target(&current_sprite,-1); but no luck. Ideas?



try using sp_target(&current_sprite, 1);

hehe, dink is ALWAYS 1
Re: scripting help
: : so... how do I make a sprite that is attacking dink stop? I tried, sp_target(&current_sprite,0); then, sp_target(&current_sprite,-1); but no luck. Ideas?

: try using sp_target(&current_sprite, 1);

: hehe, dink is ALWAYS 1



Thanks, but this guard is already attacking Dink, Dink has an invisability spell and when used, I need the guard to stop.
mabey br.16
: : : so... how do I make a sprite that is attacking dink stop? I tried, sp_target(&current_sprite,0); then, sp_target(&current_sprite,-1); but no luck. Ideas?

: : try using sp_target(&current_sprite, 1);

: : hehe, dink is ALWAYS 1

: Thanks, but this guard is already attacking Dink, Dink has an invisability spell and when used, I need the guard to stop.



If there is no other way, I'll just set the attacking sprites brain to 16. I'm hopeing for a better way though....
Re: mabey br.16
: : : : so... how do I make a sprite that is attacking dink stop? I tried, sp_target(&current_sprite,0); then, sp_target(&current_sprite,-1); but no luck. Ideas?

: : : try using sp_target(&current_sprite, 1);

: : : hehe, dink is ALWAYS 1

: : Thanks, but this guard is already attacking Dink, Dink has an invisability spell and when used, I need the guard to stop.

: If there is no other way, I'll just set the attacking sprites brain to 16. I'm hopeing for a better way though....



Oh, you want him to stop, guess I should read better. Well, I dont know, I think they forgot to add the command do_nothing(&current_sprite) :) joke

ya......
: : If there is no other way, I'll just set the attacking sprites brain to 16. I'm hopeing for a better way though....

: Oh, you want him to stop, guess I should read better. Well, I dont know, I think they forgot to add the command do_nothing(&current_sprite) :) joke



I think your right though. I need sp_donothin().

switching the brain is a bad idea, and my ideas are coming slow today. :p

What doesn't work....
I tried:

sp_brain(&cur.,16), sp_script_attach(same script),sp_disabled( 0, then again at 1),sp_target(&cur.,-1),sp_target(&cur.,0). He just keeps attacking!

The last resort is to create_sprite(a duplicate), followed by kill this sp. just to get this guy to stop his attack. There must be an easier way, Ideas?
This might work....
set

&enemy_sprite = 0;

sp_target(&current_sprite,0);

Ahh............................................ <sup>[NT]</sup>
[No message content]
almost.
I included &enemy_sprite = 0;  and sp_target(&cur.,0); , but the guard didn't reset till after Dink died. That looks right though, I'm gonna reaserch that command more. Thanks
Re: almost.
If you still can't make it work, post the whole script or email it to me. Sometimes, the problem came from other places that were not so obvious.

Re: almost.
: If you still can't make it work, post the whole script or email it to me. Sometimes, the problem came from other places that were not so obvious.



Mabey. The script is kinda huge (one script applied to about 9 sprites around the game, so I put a lot into it.) right now the "stop attack" proc. is in the attack proc. for convenience, but I think I'll move it into a loop already in main. I'll get it to work, but I'd like to know how Dink uses "&enemy_sprite" internaly.
Re: almost.
: : If you still can't make it work, post the whole script or email it to me. Sometimes, the problem came from other places that were not so obvious.

: Mabey. The script is kinda huge (one script applied to about 9 sprites around the game, so I put a lot into it.) right now the "stop attack" proc. is in the attack proc. for convenience, but I think I'll move it into a loop already in main. I'll get it to work, but I'd like to know how Dink uses "&enemy_sprite" internaly.



sp_target(&current_sprite, 0); seemed to work just fine when I tried it. Since you say this is a complicated script, I expect there's a glitch somewhere else in there effecting things in subtle ways. Are you be any chance calling procedures from inside the script?



(like this)

void main ( void )

{

 attack();

}



Because it really doesn't work well, I think it creates a copy of the script which might not even be attached to a sprite.
Re: almost.
: : : If you still can't make it work, post the whole script or email it to me. Sometimes, the problem came from other places that were not so obvious.

: : Mabey. The script is kinda huge (one script applied to about 9 sprites around the game, so I put a lot into it.) right now the "stop attack" proc. is in the attack proc. for convenience, but I think I'll move it into a loop already in main. I'll get it to work, but I'd like to know how Dink uses "&enemy_sprite" internaly.

: sp_target(&current_sprite, 0); seemed to work just fine when I tried it. Since you say this is a complicated script, I expect there's a glitch somewhere else in there effecting things in subtle ways. Are you be any chance calling procedures from inside the script?

: (like this)

: void main ( void )

: {

:  attack();

: }

: Because it really doesn't work well, I think it creates a copy of the script which might not even be attached to a sprite.



I got it to work. For a while I tried it in a main loop but it didn't seem to use it (main not running while attacking?) So I added it to the attack proc.

void attack()

{

if (&invis == 1)

     {

     goto dis;

     }

int &mcounter = random(4000,0);

sp_attack_wait(&current_sprite,&mcounter);

}

and further down....

void dis ()

{

dis:

freeze(&current_sprite);

sp_speed(&current_sprite,1);

&enemy_sprite = 0;

sp_target(&current_sprite,&enemy_sprite);

say("'$ hey?",&current_sprite);

sp_dir(&current_sprite,3);

wait(800);

sp_dir(&current_sprite,1);

wait(800);

unfreeze(&current_sprite);

}

Turns out to look pretty good, even though the guard ( a knight actually ) has to get close before loosing Dink. :o