• 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!

[CreatureScripts] Creates a ladder when a determined monster is killed

Delvire

°£°
Joined
Feb 24, 2008
Messages
236
Reaction score
9
Hello users! I think that's a not so hard script to make, but, I'm begginer in the creaturescripts area.
So, here is my request:

We have the monster 'X', when he got killed, create a ladder in X,Y,Z

Just that.
 
In "data\creaturescripts\scripts\NAME.lua" add this:
Code:
function onDeath(cid, corpse, killer)
  local position = getCreaturePosition(cid)
  local creaturename = getCreatureName(cid)
  ladder = {x=[COLOR="Red"]XXX[/COLOR], y=[COLOR="Red"]XXX[/COLOR], z=[COLOR="Red"]XX[/COLOR], stackpos=1}
  getladder = getThingfromPos(ladder)

  local time = 5
  local message = "You have " ..time.. " minutes to get up the ladder.

    if creaturename ~= [COLOR="Red"]MONSTER-NAME-HERE[/COLOR] then
      setGlobalStorageValue(45001, 1)
      doCreatureSay(cid, message, TALKTYPE_ORANGE_1)
      doCreateItem(1386, ladder)
      addEvent(doRemoveItem,time*1000,getladder.uid,1)
    end
end

And in "data\creaturescripts\creaturescripts.xml" add this line:
Code:
[/SIZE]	<event type="death" name="[COLOR="Red"]NAME[/COLOR]" script="[COLOR="Red"]NAME[/COLOR].lua"/>

And last, in the monster add these lines under </flags>:

Code:
  <script>
  <event name="[COLOR="Red"]NAME[/COLOR]"/>
  </script>


PS. Forgot this one. In "data\creaturescripts\scripts\login.lua" add this:
Code:
registerCreatureEvent(cid, "[COLOR="Red"]NAME[/COLOR]")


Not 100% sure this will work, but it should not be hard to fix the errors for a better lua-scripter.
 
Last edited:
Thank you Ezzam, Let's wait the new TFS release to than test it(I'm too lazy to download a 8.41 client and test It :))Well, in the console we have no errors.

PS: Thanks to adding this line
addEvent(doRemoveItem,time*1000,getladder.uid,1)
It's a nice idea :)

Thanks
 
Back
Top