📧 Message Board Archive

Thanks and scripting
Thanks again guys for your scripting help, now here's the twist,I have these guards who stand there watching a Dink player beat & kill townsfolk. So i'm trying to get them to attack. this is added to townsfolk script:

void hit (void)

{

&evil += 1;//&evil int.ed in start

int &bad = 1;//the guards will read &bad and atak

say_stop("'4Help! somebody help!",&current_sprite);

}//the rest work ok.



now this is added to the guards script;

void hit (void)

{

int &bad = 1;

say_stop("'4Thug! suffer our justice!",&current_sprite);

}

if (&evil > 10) &bad = 1;

if (&bad == 1)

sp_target(&current_sprite,1);

}//then the rest works ok,

when hit the guard calls me a thug ok, but doesn't attack. He still ignores me when i attack

townsfolk.I'm guessing that part of the guards script doesn't get reviewed, has anyone out there

done this?,thanks......................Ric

Re: Thanks and scripting
: Thanks again guys for your scripting help, now here's the twist,I have these guards who stand there watching a Dink player beat & kill townsfolk. So i'm trying to get them to attack. this is added to townsfolk script:



When you set sp_target, make sure you also set the guard's brain to 9 (if it isn't already). If he has no brain or the "smart people brain" sp_target isn't going to do anything.
Re: Thanks and scripting




void main( void )

{

int &bad;

int &i;



if (&evil > 10)

{

&bad = 1;

}



loophere:

if (&i < 5000)

{

if (&bad == 1) sp_target(&current_sprite,1);

wait(250);

&i += 1;

goto loophere;

}

}



void hit (void)



{

&bad = 1;



say_stop("'4Thug! suffer our justice!",&current_sprite);

}



Or something like it.



There is a problem with changing variables after an if statement.  Also, try to declare all vars in main() and arm()(Just a good idea).



The basic problem is that you need status things to update continuosly.
Re: Thanks and scripting
: void main( void )



: {



: int &bad;



: int &i;



: if (&evil > 10)



: {



: &bad = 1;



: }



: loophere:



: if (&i < 5000)



: {



: if (&bad == 1) sp_target(&current_sprite,1);



: wait(250);



: &i += 1;



: goto loophere;



: }



: }



: void hit (void)



: {



: &bad = 1;



: say_stop("'4Thug! suffer our justice!",&current_sprite);



: }



: Or something like it.



: There is a problem with changing variables after an if statement. Also, try to declare all vars in main() and arm()(Just a good idea).



: The basic problem is that you need status things to update continuosly.



thanks again, I'm sure I'll need to tinker a bit,

but it's coming together now............Ric
Re: Thanks and scripting
I think that there are several mistakes in my script anyways...
Better explanation of my script
//knight script



void main( void )



{

int &bad;

int &i;



if (&evil > 10)

{

&bad = 1;

}



//semi-infinite loop, checks every second to see

//if bad has changed

loophere:

if (&i < 5000)

{

if (&bad == 1) sp_target(&current_sprite,1);

wait(250);

&i += 1;

goto loophere;

}

}



void hit (void)

{

&bad = 1;

say_stop("'4Thug! suffer our justice!",&current_sprite);

}



The status change before in it would have been undetected, or maybe only undetected before you hit the guard.