The Dink Network

Enemy target

February 10th 2013, 05:18 AM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
With the original Dink Smallwood, the grey Boncas are always targeted to attack the other monsters on the screen. I was wondering how can I (or is it even possible to) make it so after the player is dead, the monster will automatically change the target to another monster (in case such is still in the screen). I've tried every possible method, and I just can't get it to work. Instead, whenever the player or any of the monsters on the screen dies, they just keep walking around without any target. Only rarely (and very randomly) do they target a new enemy again. I just don't understand! I've tried everything I can think of, even controlling the monsters from dinfo.c, but nothing seems to work. There's probably a very simple solution that's been under my nose this whole time, but I just can't spot it.

You see, I'm trying to make it so the monsters attack each other and/or Dink randomly, and when there are no brain 9 monsters left and the player is dead, they automatically target brain 10 monsters, and vice versa. And when there's only one monster left with player alive, it targets the player.
February 10th 2013, 07:21 AM
spike.gif
The problem is that the script gets interrupted whenever the bonca gets hit. Therefore, the grey bonca doesn't actually look for a new target like its supposed to. There are two simple ways to fix this:

1. Restart the targeting stuff in void hit. (ie. add set_callback_random("target",2000,0) in the hit procedure)
2. Use external() for the targeting stuff, in which case it won't get interrupted.

EDIT: Targeting other monsters after Dink dies is a bit more complicated, because Dink will still be brain 1 after his death, so they just keep mopping on his corpse. You could check if Dink has less than 1 point of life in the monster's script, and target something else if he does.
February 10th 2013, 08:01 AM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
Hmmm... it seems to work like charm after adding "set_callback_random("target",2000,0)". Thanks!
February 10th 2013, 08:27 AM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
Well, except that it stopped working. Even though I didn't change anything. This is getting really strange. It worked PERFECTLY for a few times. When I tested it again, it went back to the same old crap with the montsers walking around without any target.

EDIT: And now it works perfectly again! O....k, DinkC? You're acting weird on me today.
February 12th 2013, 07:47 PM
anon.gif
shevek
Ghost They/Them
 
Perhaps you interrupted the script some other way? Any procedure that is called in the script (in particular talk, hit and touch, but also the callback itself) will interrupt it and it will not resume what it was doing before.