mob self-destruction

Tio Akima

New member
Messages
349
Points
0
Age
36
Discord
TioAkima#0636
Github
Tio Akima
Emulator
Hello guys

How can I make a MOB that self destructs when someone gets close?

I looked at the Creator's skill (MARINE SPHERE) but I did not understand how self-destruction works.

The idea is to make a mob that walks around the map and when it finds another MOB or player, it self destroys.

Can someone help me?
 

 
You could spawn your monster with the monster() command to get its GID, and then periodically (like every 100ms) check for nearby units using the getunits() command. If a unit is found that matches your criteria (ie type being MOB or PC) you kill it using unitkill() and you can make it spawn a new one after a timeout to begin the cycle again.

If you want something simpler look for NPC_SELFDESTRUCTION in the mob skill db

 
Last edited by a moderator:
You could spawn your monster with the monster() command to get its GID, and then periodically (like every 100ms) check for nearby units using the getunits() command. If a unit is found that matches your criteria (ie type being MOB or PC) you kill it using unitkill() and you can make it spawn a new one after a timeout to begin the cycle again.

If you want something simpler look for NPC_SELFDESTRUCTION in the mob skill db


Thanks Meko for the tip ..

I'm doing everything in SRC myself .. so I guess the NPC_SELFDESTRUCTION might help.

I'm summoning a mob and making it walk in one direction (by skill) ...

And the idea is if this mob finds something on the way, it destroys itself ..
(Auto destroy equal to marine sphere)

But I still do not understand how the self-destruct of the Marine Sphere works.

Getunits () and unitkill () are script commands?

Is there any function in src similar to getunits ()?
And also similar to unitkill ()?

Does unitkill do the same thing as mob-> dead ()?

Sorry for the many questions, but I have many doubts.
I'm almost finished, I just need to make the mob self-destruct when I find something :D

 
you can make the mob agressive, with 3 cell range of attack and 3 cells range of sight, and in mob_skill add NPC_SELFDESTRUCT when Attack or Chase with 100% chance, The mob will self destruct every time someone gets on his attack range, in theory looks very simple.

 
you can make the mob agressive, with 3 cell range of attack and 3 cells range of sight, and in mob_skill add NPC_SELFDESTRUCT when Attack or Chase with 100% chance, The mob will self destruct every time someone gets on his attack range, in theory looks very simple.
Thanks for the message fxfreitas
I'll test this.

fxfreitas answer will do no more source edit needed...
So I do not know if it's going to work out because I'm using the unit-> walktoxy to make the Mob walk ...
So while the mob is walking with this function, it does not attack etc ...
Just walk in the direction .. The idea to make it self destruct is to check if the next cell is a cell "Not walkable" or if there is any wall.

This is looking like a collision test 
the mob colliding with something. hahahaha


 

 
Back
Top