monsters.h
find
then add this under public:
find
replace with
monsters.cpp
find
add below
luascript.h
add near the similar lines
luascript.cpp
add near similar lines
add near similar lines
This script is for TFS 0.4 i need to transform to TFS 0.3.6
please help.
find
Code:
class Monster : public Creature
Code:
std::string name, nameDescription;
Code:
virtual const std::string& getName() const {return mType->name;}
virtual const std::string& getNameDescription() const {return mType->nameDescription;}
virtual std::string getDescription(int32_t) const {return mType->nameDescription + ".";}
Code:
virtual const std::string& getName() const {return name;}
virtual const std::string& getNameDescription() const {return nameDescription;}
virtual std::string getDescription(int32_t) const {return nameDescription + ".";}
monsters.cpp
find
Code:
Monster::Monster(MonsterType* _mType): Creature()
Code:
name = _mType->name;
nameDescription = _mType->nameDescription;
luascript.h
add near the similar lines
Code:
static int32_t luaSetCreatureName(lua_State* L);
luascript.cpp
add near similar lines
Code:
//setCreatureName(cid, name, description)
lua_register(m_luaState, "setCreatureName", LuaInterface::luaSetCreatureName);
Code:
int32_t LuaInterface::luaSetCreatureName(lua_State* L)
{
//setCreatureName(cid, newName, newDescription)
std::string newDesc = popString(L);
std::string newName = popString(L);
ScriptEnviroment* env = getEnv();
Creature* creature;
if(creature = env->getCreatureByUID(popNumber(L))){
Monster* monster = (Monster*)creature;
monster->name = newName;
monster->nameDescription = newDesc;
lua_pushboolean(L, true);
}
else{
errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND));
lua_pushboolean(L, false);
}
return 1;
}
This script is for TFS 0.4 i need to transform to TFS 0.3.6
please help.