Testado em 0.3.7 8.60
Creditos?
50% = Emerson Henrique ( EU )
50% = MeNi (OtLand)
Porq 50% para mim?
R:Quando ele Posto o Sistema não posto todas as funções para Adc e como eu fiz isso 50%.
Vamos A Magica ou Jutsu
em LuaScript.cpp
Procure Por :
//getPlayerBlessing(cid, blessing)
Adicione Abaixo :
//doCreateCustomMonster(name, pos, outfit, health, spells, corpse, distance, experience )
lua_register(m_luaState, "doCreateCustomMonster", LuaInterface::luaDoCreateCustomMonster);
Procure Por :
int32_t LuaInterface::luaGetPlayerBlessing(lua_State* L)
Adicione Abaixo do Final dessa Função:
int32_t LuaInterface::luaDoCreateCustomMonster(lua_State* L)
{
//doCreateCustomMonster(name, pos, outfit, health, spells, corpse, distance, experience )
// created By MeNi for otland.net //
uint64_t health,corpse,distance,experience;
Outfit_t outfit;
PositionEx pos;
MonsterType* pobranyTyp = NULL;
pobranyTyp = new MonsterType();
experience = popNumber(L);
distance = popNumber(L);
corpse = popNumber(L);
std::string spells = popString(L);
health = popNumber(L);
outfit = popOutfit(L);
popPosition(L, pos);
std::string name = popString(L);
Monster* monster;
pobranyTyp->spellAttackList.clear();
pobranyTyp->health = health;
pobranyTyp->healthMax = health;
pobranyTyp->outfit = outfit;
pobranyTyp->name = name;
pobranyTyp->nameDescription = name;
pobranyTyp->lookCorpse = corpse;
pobranyTyp->targetDistance = distance;
pobranyTyp->experience = experience;
pobranyTyp->isSummonable =
pobranyTyp->isIllusionable =
pobranyTyp->isConvinceable =
pobranyTyp->isWalkable =
pobranyTyp->pushable = false;
pobranyTyp->isAttackable =
pobranyTyp->isHostile =
pobranyTyp->canPushItems =
pobranyTyp->canPushCreatures = true;
pobranyTyp->defense = 50;
pobranyTyp->armor = 80;
pobranyTyp->baseSpeed = 200;
pobranyTyp->changeTargetSpeed =
pobranyTyp->changeTargetChance = 0;
xmlDocPtr doc = xmlParseMemory(spells.c_str(), spells.length());
xmlNodePtr root = xmlDocGetRootElement(doc);
xmlNodePtr tmpNode = root->children;
while(tmpNode)
{
if(!xmlStrcmp(tmpNode->name, (const xmlChar*)"attack"))
{
spellBlock_t sb;
if(g_monsters.deserializeSpell(tmpNode, sb, "doCreateCustomMonster"))
pobranyTyp->spellAttackList.push_back(sb);
}
tmpNode = tmpNode->next;
}
monster = Monster::createMonster(pobranyTyp);
if(!g_game.placeCreature(monster, pos, false, false))
{
delete monster;
lua_pushboolean(L, true);
return 1;
}
ScriptEnviroment* env = getEnv();
lua_pushnumber(L, env->addThing((Thing*)monster));
return 1;
}
Em LuaScript.h
Procure Por :
static int32_t luaDoRemoveItem(lua_State* L);
Adicione Abaixo :
static int32_t luaDoCreateCustomMonster(lua_State* L);
Em monsters.h
Mude de Private para Public;
bool deserializeSpell(xmlNodePtr node, spellBlock_t& sb, const std::string& description = "");
Uma coisa que meu amigo e quase professor (Arthur Luna) me disse é
Arthur says : Source é source, a diferença é as modificações.
Então quase todos os sistemas são instalaveis o problema é saber oque adaptar!
Segue um Script Basico em TalkActions:
local text = '<attack name="melee" interval="2000" chance="100" range="5" radius="1" target="0"><attribute key="areaEffect" value="fire"/></attack>'
function onSay(cid, words)
local MaximoSummon = 10 --- Maximo de Monstros Sumonados!! No Caso So Posso Sumonar 5 Clones
local summons = getCreatureSummons(cid)
if(table.maxn(summons) < MaximoSummon) then -- no summons
local clone = doCreateCustomMonster(getCreatureName(cid), getCreaturePosition(cid), getCreatureOutfit(cid), getCreatureMaxHealth(cid), text, 6324, 1, 100)
doConvinceCreature(cid, clone)
return true
end
return true
end
Criação do Script : Emerson Henrique