Hello there.
I did changes in c++ and I got problem, how to add and register that lua script in 0.3.6 server
i wasnt working with 0.3.6 - and i dont know how to add it... any one could chceck it and try to help me
how to parse it well and add a script to be used server?
code does a corpse change, but with ItemID"1" - it wont get a " corpse="xxxx" " from vocation.xml
without carpse="xxxx" in voc - it wont do anything.
script to add to server
c++ code changes
I did changes in c++ and I got problem, how to add and register that lua script in 0.3.6 server
i wasnt working with 0.3.6 - and i dont know how to add it... any one could chceck it and try to help me
how to parse it well and add a script to be used server?
code does a corpse change, but with ItemID"1" - it wont get a " corpse="xxxx" " from vocation.xml
without carpse="xxxx" in voc - it wont do anything.
script to add to server
local voc_list =
{ [1] = {2160},
[2] = {2160},
[3] = {2160},
[4] = {2160} }
function onDeath(cid, corpse)
doTransformItem(corpse.uid, voc_list[getPlayerVocation(cid)][1])
doDecayItem(corpse.uid)
return true
end
c++ code changes
How about a C++ code?
vocations.h
Change:
To:Code:int32_t lessLoss, capGain;
Code:int32_t lessLoss, capGain, corpse;
Under:
Add:Code:void setAttackable(bool v) {attackable = v;}
Code:bool getCorpse() const {return corpse;} void setCorpse(int32_t v) {corpse = v;}
vocations.cpp
Under:
Add:Code:if(readXMLInteger(p, "attackspeed", intValue)) voc->setAttackSpeed(intValue);
Code:if(readXMLInteger(p, "corpse", intValue)) voc->setCorpse(intValue);
Under:
Add:Code:attackSpeed = 1500;
Code:corpse = -1;
player.cpp
Change:
To:Code:Item* corpse = Creature::createCorpse(deathList);
Code:Item* corpse; if(getVocation()->getCorpse() >= 0) corpse = Item::CreateItem(getVocation()->getCorpse()); else corpse = Creature::createCorpse(deathList);
With this code you will be able to change corpses of each vocation.
Sample:
<vocation id="1" name="Sorcerer" description="a sorcerer" corpse="0" needpremium="0"...
When you type zero there, no corpse will be created. Delete whole corpse="" to use default ones.
Let me know if it's working, not tested.