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

Exp Egg Help Please!

oska2

New Member
Joined
Aug 18, 2013
Messages
36
Reaction score
0
I'm making TFS 0.3.6 server ( 8.6 ) and i need exp AND outfit changer egg tutorial? :( please can anyone help me?

outfit egg : id 6545

exp egg : id 6544

PLEASE HELP!!!
 
i haven't really worked in LUA in a LOOOOONG time but I think I have a pretty good idea of what you need to do for the exp. :D

first you set a variable for the exp (local is fine), let's just call it epicEXP (please don't use this, lol)

then you need to add the code for onUse (you can figure this out. almost all action scripts look the same)

then do a doPlayerAddExp for the epicEXP variable you declared earlier (doPlayerAddExp(cid,epicEXP))

then do a doCreatureSay if you want to make an unobnoxious way of saying how much they got (doCreatureSay(cid, "YOU... YOU ATE AN EGG... AND IT GAVE YOU " epicEXP " EXPERIENCE!", talktype_orange_1)

then do a doRemoveItem on the item (doRemoveItem(item.uid,1))

this should do generally what you are trying to do. i'm sure you could get fancy with it and do neat things but this is generally what you have to do. sorry if i'm a little lazy on my explanation, i don't really remember much and i don't have anything to test/check if i'm right.

if you have a cap level, set an if-then-else structure with a calculated maxEXP variable that could be global or something (like if getPlayerExp(cid) + epicExp >= maxEXP then endGameForever). there is a lot of cleaner ways to do that but i'm not making anything


as for the outfit changer egg, could you be a little more clear about what you are trying to do? i haven't played enough OTs to know what an "outfit egg" would do :(
 
expegg

data/actions/actions.xml add this line

Code:
 <action itemid="6544" event="script" value="expegg.lua"/>

data/actions/scripts/expegg.lua
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.itemid == 6544 then
        doCreatureSay(cid, "You ate an egg and received some exp!", talktype_orange_1)
        doPlayerAddExperience(cid, 10000)
        doPlayerRemoveItem(cid, 6544, 1)
        end
        return true
end

to change experience change doplayeraddexperience amount.
 
Last edited:
Outfit egg:

data/actions/actions.xml add these line
Code:
<action itemid="6545" event="script" value="outfitegg.lua"/>
<action itemid="6544" event="script" value="expegg.lua"/>
data/actions/scripts/outfitegg.lua
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.itemid == 6545 then
        doPlayerRemoveItem(cid, 6545, 1)
        doCreatureChangeOutfit(cid, math.random(outfitid, outfitid, outfitid, outfitid, outfitid))
        doCreatureSay(cid, "You have changed ur outfit", talktype_orange_1)
        end
        return true
end

data/actions/scripts/expegg.lua
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.itemid == 6544 then
        doPlayerRemoveItem(cid, 6544, 1)
        doCreatureSay(cid, "You ate an egg and received some exp!", talktype_orange_1)
        doPlayerAddExperience(cid, 10000)
        end
        return true
end
 
Last edited:
The Exp Egg thing doesnt work with me, I dont know why, and I meant With the Outfit Egg that it gives you random monster outfit :) Can someone help AGAIN please? :D
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
   doRemoveItem(item.uid, 1)
   doCreatureSay(cid, "You ate an egg and received some exp!", TALKTYPE_ORANGE_1)
   doPlayerAddExperience(cid, 10000)
   return true
end

Code:
local outfits = {12, 70, 101} -- add here the outfits

function onUse(cid, item, fromPosition, itemEx, toPosition)
   local outfit = getCreatureOutfit(cid)
   outfit.lookType = outfits[math.random(1, #outfits)]
 
   doRemoveItem(item.uid, 1)
   doCreatureChangeOutfit(cid, outfit)
   doCreatureSay(cid, "You have changed ur outfit", TALKTYPE_ORANGE_1)
   return true
end
 
I tested it on TFS 0.3.6 (the server oska2 is using), is you have errors or anything else that makes it not work on the server version you are using, post them and which server you use.
 
@Limos Tfs 0.3.6, i got no errors but when i ate the egg i got nothing it was like a normal egg.
Do you get a message, the white cancel message "You cannot use this object." or the orange text above you "You ate an egg and received some exp!" ?
How did you added it in actions.xml?
 
Back
Top