enemy attack script
again, I'm not at my home computer, so I can't go into the detail I like, but I wrote a script to make shooting enemys... similar to en-shoot, but with a different targeting method. the targeting method works... I've made dink use it, but the enemy won't use it. I used set_callback_random in the same manner as the en-shoot.
Are you doing the targeting and shoot in a loop in the void main?
void main(void) { //load graphics, set health and stuff loop: //dinks cordinates, get monster cordinates //fire wait(1000); goto loop; } void hit(void) { goto loop; }
Not enough information..
I'm not sure what you mean by different targeting method, but if you want something like en-shoot (fire projectile directly at target), then check out the pillbug script in MouseDink. It's a lot better than en-shoot (if I do say so myself
)...
I'm not sure what you mean by different targeting method, but if you want something like en-shoot (fire projectile directly at target), then check out the pillbug script in MouseDink. It's a lot better than en-shoot (if I do say so myself

heres the script: (edef)
void main(void)
{
int &htarg = get_rand_sprite_with_this_brain(9, ¤t_sprite);
if (&htarg = 0)
{
&htarg = get_rand_sprite_with_this_brain(10, ¤t_sprite);
}
int &targ = 0;
sp_custom("lvl", ¤t_sprite, 9)
int &lvl = sp_custom("lvl", ¤t_sprite, -1)
int &var1 = 0;
//basic stats
sp_brain(¤t_sprite, 9);
sp_speed(¤t_sprite, 1);
sp_target(¤t_sprite, &htarg);
sp_nohit(¤t_sprite, 0);
sp_distance(¤t_sprite, 60);
sp_timing(¤t_sprite, 0);
//power stats
int &stat = &lvl;
&stat /= 2;
int &mhp = 10
&mhp *= &lvl;
int &hp = &mhp
sp_custom("mhp", ¤t_sprite, &mhp)
sp_defense(¤t_sprite, &stat);
sp_strength(¤t_sprite, &stat);
sp_hitpoints(¤t_sprite, &mhp);
//spells
spells:
set_callback_random("close", 500, 1000);
set_callback_random("range", 500, 2000);
}
void close(void)
{
int &add = &stat;
&add += &lvl;
//action
heal();
if (&lvl > 2)
{
heal();
}
if (&lvl > 5)
{
heal();
}
if (&lvl > 8)
{
heal();
}
}
void heal(void)
{
&targ = ¤t_sprite;
if (&htarg > 1)
{
&var1 = random(2, 1);
if (&var1 == 1)
{
&targ = ¤t_sprite;
}
if (&var1 == 2)
{
&targ = &htarg
}
}
&var1 = sp_custom("mhp", &targ, -1);
&var1 *= 10
int &hp = sp_hitpoints(&targ, -1)
&hp += &add;
//avoid going over maxlife
if (&hp > &var1)
{
&hp = &var1;
}
sp_hitpoints(&targ, &hp)
}
void range(void)
{
&mholdx = sp_x(¤t_sprite, -1);
&mholdy = sp_y(¤t_sprite, -1);
&mholdx += 30;
&junk = create_sprite(&mholdx, &mholdy, 11, 163, 1);
int &str = &lvl
&str += &stat
int &mshadow = create_sprite(&mholdx, &mholdy, 15, 432, 3);
sp_brain_parm(&mshadow, &junk);
sp_que(&mshadow, -500);
sp_strength(&junk, &str)
sp_brain_parm(&junk, 1);
sp_brain_parm2(&junk, &mshadow);
sp_script(&junk, "scope")
}
void hit(void)
{
&hp = sp_hitpoints(¤t_sprite, -1)
say("&hp hp", ¤t_sprite)
goto spells;
}
it should at least be healing itself, but it doesn't
'scope' is the script used to target and guide the missile. I applied it to an axe and it works. I adapted it from mousdink's homing fireballs.
scope also handles detting dink's xy, getting targets xy, etc.
it's as if my set_callback_random is being completely ignored
void main(void)
{
int &htarg = get_rand_sprite_with_this_brain(9, ¤t_sprite);
if (&htarg = 0)
{
&htarg = get_rand_sprite_with_this_brain(10, ¤t_sprite);
}
int &targ = 0;
sp_custom("lvl", ¤t_sprite, 9)
int &lvl = sp_custom("lvl", ¤t_sprite, -1)
int &var1 = 0;
//basic stats
sp_brain(¤t_sprite, 9);
sp_speed(¤t_sprite, 1);
sp_target(¤t_sprite, &htarg);
sp_nohit(¤t_sprite, 0);
sp_distance(¤t_sprite, 60);
sp_timing(¤t_sprite, 0);
//power stats
int &stat = &lvl;
&stat /= 2;
int &mhp = 10
&mhp *= &lvl;
int &hp = &mhp
sp_custom("mhp", ¤t_sprite, &mhp)
sp_defense(¤t_sprite, &stat);
sp_strength(¤t_sprite, &stat);
sp_hitpoints(¤t_sprite, &mhp);
//spells
spells:
set_callback_random("close", 500, 1000);
set_callback_random("range", 500, 2000);
}
void close(void)
{
int &add = &stat;
&add += &lvl;
//action
heal();
if (&lvl > 2)
{
heal();
}
if (&lvl > 5)
{
heal();
}
if (&lvl > 8)
{
heal();
}
}
void heal(void)
{
&targ = ¤t_sprite;
if (&htarg > 1)
{
&var1 = random(2, 1);
if (&var1 == 1)
{
&targ = ¤t_sprite;
}
if (&var1 == 2)
{
&targ = &htarg
}
}
&var1 = sp_custom("mhp", &targ, -1);
&var1 *= 10
int &hp = sp_hitpoints(&targ, -1)
&hp += &add;
//avoid going over maxlife
if (&hp > &var1)
{
&hp = &var1;
}
sp_hitpoints(&targ, &hp)
}
void range(void)
{
&mholdx = sp_x(¤t_sprite, -1);
&mholdy = sp_y(¤t_sprite, -1);
&mholdx += 30;
&junk = create_sprite(&mholdx, &mholdy, 11, 163, 1);
int &str = &lvl
&str += &stat
int &mshadow = create_sprite(&mholdx, &mholdy, 15, 432, 3);
sp_brain_parm(&mshadow, &junk);
sp_que(&mshadow, -500);
sp_strength(&junk, &str)
sp_brain_parm(&junk, 1);
sp_brain_parm2(&junk, &mshadow);
sp_script(&junk, "scope")
}
void hit(void)
{
&hp = sp_hitpoints(¤t_sprite, -1)
say("&hp hp", ¤t_sprite)
goto spells;
}
it should at least be healing itself, but it doesn't
'scope' is the script used to target and guide the missile. I applied it to an axe and it works. I adapted it from mousdink's homing fireballs.
scope also handles detting dink's xy, getting targets xy, etc.
it's as if my set_callback_random is being completely ignored
i think the paste function screwed up...
it's ¤t_sprite in the original (i checked)

thanks, but that wouldn't cause this problem. that proc. would be skipped instead right? which would make htarg = 0 which it would have anyway because the tester is the only sprite on the screen (other than dink, of course.)
it should still run everything else which is independant of htarg.
it should still run everything else which is independant of htarg.
the } for the if statement may be being interpreted as the end of the main void
Try just running the procedures without callback_randoms, to see if that's where the problem is.
Also, the ¤ -> ¤ bug occurs when you modify a post.
Also, the ¤ -> ¤ bug occurs when you modify a post.

@ someone:
no, because otherwise its brain and speed would default to 0, so it wouldn't move; and its doing that.
@scratcher
I already set the ranged one to an item t be used by dink, and it worked perfectly.
no, because otherwise its brain and speed would default to 0, so it wouldn't move; and its doing that.
@scratcher
I already set the ranged one to an item t be used by dink, and it worked perfectly.
I just posted my 'testing ground' modd. please take a look at it and see whats going on for yourself (you wont believe your eyes!) its under 'help!'