: I was working on a similar script back then. I can't say it's working perfectly, but it worked as far as I know.
: If you want the friend to attack the current enemy target of Milder, then you might at first use a global variable, like &temphold widely used in original Dink, to assign that monster's ID.
: something like
: &temphold = ¤t_sprite;
: in hit(void) in monster's script.
: And then you can put a looped procedure in main(void) of that friend to have something
: sp_follow(¤t_sprite, &temphold);
: sp_target(¤t_sprite, &temphold);
: and maybe a
: set_callback_random("target", 1000, 0);
: (of course you need to write a target( void ))
: sp_follow is not necessary, but if you set the friend to follow Milder originally, it might be crucial to reassign the following target.
OKay, thanks Ric and Mimifish. :)
I didn't even think of using some global variable for that.. i just tried to make it get anything with brain 9, and that didn't work for some reason.
I think i'll get it to work now. :)
: I didn't even think of using some global variable for that.. i just tried to make it get anything with brain 9, and that didn't work for some reason.
If both the friend and the enemy have brain 9, it usually doesn't work..
You could also use something like this, made in en-bong.c:
void main( void )
{
int &mtarget = get_sprite_with_this_brain(9, ¤t_sprite);
if (&mtarget > 0)
{
sp_target(¤t_sprite, &mtarget);
}
set_callback_random("target",2000,0);
}
void target( void )
{
&mtarget = sp_target(¤t_sprite, -1);
if (&mtarget == 0)
{
&mtarget = get_sprite_with_this_brain(9, ¤t_sprite);
if (&mtarget > 0)
{
sp_target(¤t_sprite, &mtarget);
}
}
}
: : I didn't even think of using some global variable for that.. i just tried to make it get anything with brain 9, and that didn't work for some reason.
: If both the friend and the enemy have brain 9, it usually doesn't work..
: You could also use something like this, made in en-bong.c:
: void main( void )
: {
: int &mtarget = get_sprite_with_this_brain(9, ¤t_sprite);
: if (&mtarget > 0)
: {
: sp_target(¤t_sprite, &mtarget);
: }
: set_callback_random("target",2000,0);
: }
: void target( void )
: {
: &mtarget = sp_target(¤t_sprite, -1);
: if (&mtarget == 0)
: {
: &mtarget = get_sprite_with_this_brain(9, ¤t_sprite);
: if (&mtarget > 0)
: {
: sp_target(¤t_sprite, &mtarget);
: }
: }
: }
There should have been a "get_sprite_with_this_team" code in DinkC ;)