• 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

  • 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

fxfreitas answer will do no more source edit needed...

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now