Hello!
I want release an modification to C++.
Works in TFS0.3.5pl1 / TFS0.3.6pl1. (and thinkin it works too on 0.4 and others)
I want release an modification to C++.
Works in TFS0.3.5pl1 / TFS0.3.6pl1. (and thinkin it works too on 0.4 and others)
Information about this modification:
You can set level of skill what is required for use the spell by write in spells.xml in any spell one line (ex. club = "15") and player must have above= 15 club to use the spell.
It's perfect system for ot's like Dragon Ball, Naruto, Bleach and other anime.
Application (spells.xml):
<instant name="-----" words="-----" clubpoints="15" lvl="-" mana="-" aggressive="-" selftarget="-" exhaustion="----" event="script" value="----.lua"/>
1) Declare message:
- find (player.cpp):
case RET_TILEISFULL:
sendCancel("You cannot add more items on this tile.");
break;
- and add under this code (player.cpp):
PHP:
case RET_NOTENOUGHSKILL:
sendCancel("You do not have enough club fighting.");
break;
2) Declare the line (what is checking the skill) in spells.xml:
- find (spells.cpp):
if(readXMLInteger(p, "maglv", intValue) || readXMLInteger(p, "magiclevel", intValue))
magLevel = intValue;
- and add under this code (spells.cpp):
PHP:
if(readXMLInteger(p, "club", intValue) || readXMLInteger(p, "clubpoints", intValue))
clubpoints = intValue;
3) Add the main function:
- find (spells.cpp):
if((int32_t)player->getMagicLevel() < magLevel)
{
player->sendCancelMessage(RET_NOTENOUGHMAGICLEVEL);
g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
return false;
}
- add under this code (spells.cpp):
PHP:
if((int32_t)player->getSkill(SKILL_CLUB, SKILL_LEVEL) < clubpoints)
{
player->sendCancelMessage(RET_NOTENOUGHSKILL);
g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
return false;
}
- find (spells.h):
int32_t getMagicLevel() const {return magLevel;}
- add under this code (spells.h):
PHP:
uint32_t getSkill() const {return clubpoints;}
- find (spells.h):
int32_t magLevel;
- add under (spells.h):
PHP:
int32_t clubpoints;
- find (thing.h):
RET_TILEISFULL = 64,
- add under (thing.h):
PHP:
RET_NOTENOUGHSKILL = 65
4) Press Rebuild All (Ctrl+F11)
You must press -> "rebuild all", because you edited the *.h files and if you wont rebuild your project (not compile), you can get crashes and problems.
5) Done!
It's simple modification but may be usefull for any spells or spell formulas (ex. level*2 + clubpoints*2)
Regards,
Fresh.
Last edited: