ziggy46802
Active Member
- Joined
- Aug 19, 2012
- Messages
- 418
- Reaction score
- 27
Put this in actions.xml
And for every second, and so forth one you add, make it "3002" and /spiderpod02, I will show you what you have to edit in the actual code for a new cocoon.
Make a script called spiderpod01, put it in other folder and this is it
Code:
<!-- Spider Pods -->
<action actionid="3001" script="other/spiderpod01.lua"/>
And for every second, and so forth one you add, make it "3002" and /spiderpod02, I will show you what you have to edit in the actual code for a new cocoon.
Make a script called spiderpod01, put it in other folder and this is it
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local closed = 7537
local open = 7536
local pos = {x=1141,y=916,z=7} --set position of cocoon here
local chance = math.random(0,100000)
function goto(cid, item)
addEvent(restore, (1000 * 60 * 4),(1000 * 60 * 9) , cid) --the 4 is 4 minutes minimum, the 9 is 9 minutes maximum, you can change it to whatever you want
--addEvent(restore, 5000,10000, cid) --test mode
return true
end
function restore(cid, item1, item2)
doRemoveItem(getTileItemById(pos, open).uid)
doItemSetAttribute(doCreateItem(closed,pos), "aid", 3001) --set AID (the second one would be 3002)
return true
end
if item.itemid == closed then
doPlayerAddSkillTry(cid, SKILL_FIST, 5) --you can delete this line if you dont want it to increase your fist fighting, the 5 is how many "hits" it counts it as
doRemoveItem(getTileItemById(pos, closed).uid)
doCreateItem(open,pos)
addEvent(goto, 1, 2, cid)
doSendMagicEffect(pos, 3)
doSendMagicEffect(getPlayerPosition(cid), 45)
else
doCreatureSay(cid, "The cocoon is already open.", TALKTYPE_ORANGE_1)
end
if chance >= 0 and chance <= 80000 then --change the front two number "80" to whatever percent you want for a spider to pop out
doCreateMonster('spider', pos)
doCreatureSay(cid, "A spider popped out of the cocoon!", TALKTYPE_ORANGE_1)
return false
end
if chance >= 80001 and chance <= 100000 then --set the 80001 to like, 20001 if you set the spider above to 20000, just 1 more than the spider
doCreateMonster('poison spider', pos)
doCreatureSay(cid, "A poison spider popped out of the cocoon!", TALKTYPE_ORANGE_1)
return false
end
return true
end