Jump to content
  • 0
Tio Akima

mob self-destruction

Question

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?
 

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

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

Share this post


Link to post
Share on other sites
  • 0
1 hour ago, meko said:

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

Share this post


Link to post
Share on other sites
  • 0

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.

Share this post


Link to post
Share on other sites
  • 0
On 28/08/2017 at 10:11 AM, fxfreitas said:

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.

On 28/08/2017 at 7:09 PM, malufett said:

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


 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.