• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Possible to make creaturescripts work for all creatures??

Mazen

Developer
Joined
Aug 20, 2007
Messages
612
Reaction score
38
Location
Sweden
Hey everyone.

I just want to ask a question, as the title say, is it possible to make a creature script work for all creatures, for both monsters and players?

What I know is that you need to register a creature event for a creature to make it work. (With the function registerCreatureEvent(cid, creatureEvent) that you put in login.lua, but monsters doesn't login )

Is it possible to make a creatureevent registered to all creatures automatically? Or do I have to use the registerCreatureEvent function every time I want to make a creature event work?
 
You know that you have to register a creature event on a creature to make it work. I want to make a creature event that works without being registered.

That is not possible as far as I am concerned.
Maybe you are thinking of "Globalevents?"
 
well...a player has to be involved somehow right?

onDeath if killer name == Troll...
onKill if target name == Troll...

No I don't think so. A creatureevent can work with monsters too. The problem is that if a creatureevent is not registered with registerCreatureEvent(cid, event), it wont execute. I want it to be executed without being registered.

@up, no I mean creature events.

I'm very sure this is possible. :(
 
Open every monster script, and..

Before:
PHP:
</monster>

Add:
PHP:
  <script>
	<event name="CreatureEvent"/>
  </script>


Example:
PHP:
 ..  immunity drunk="0"/>
    <immunity invisible="0"/>
  </immunities>
  <script>
	<event name="onDeath"/>
	<event name="onThink"/>
  </script>
</monster>

Good luck! =)
 
I think you have to register every creatureevent there in order for it to run in the first place, but from what I understood I think you're looking for something like this:

Cats should have 7 lifes : D

That one is a creatureevent involving only a creature, it is registered on login.lua as always, but then you could make your script handle various creatures using only that 1 registered event, like you did on your optimization for it:

Cats should have 7 lifes : D - Page 3

There you just have 1 registered event at login.lua, but the script itself handles various creatures!

Isnt that what you ment?

PS: I just realized the guy on that post is you lol :D.
 
Open every monster script, and..

Before:
PHP:
</monster>

Add:
PHP:
  <script>
	<event name="CreatureEvent"/>
  </script>


Example:
PHP:
 ..  immunity drunk="0"/>
    <immunity invisible="0"/>
  </immunities>
  <script>
	<event name="onDeath"/>
	<event name="onThink"/>
  </script>
</monster>

Good luck! =)

Oh, I didn't know that feature. Nice!

Thank you. :)

But the only problem is that I might want a creature script to work on all creatures. It will be too hard to write that on every creature xml file. :/
 

Similar threads

Back
Top