What's new

-Tibia 8.54 TFS 0.3.6PL1 - Special Skill System

Status
Not open for further replies.

Lopus

Advanced User
Joined
Jun 17, 2011
Messages
206
Reaction score
9
SYSTEM TESTOWANY NA TFS 0.3.6PL1 DZIALA W 100% WIEC JEZELI ZDAZYLO BY SIE ZE KOMUS NIE DZIALA, JEST TO WINA TYLKO I WYLACZNIE JEGO BLEDNEJ INSTALACJI!
Special Skill System!​
C++:
W Game.cpp pod
PHP:
	{
		player->manageAccount(text);
		return true;
	}
Dodajemy:
PHP:
 if(text == "!special")
  {
           std::string Storage1;
           player->getStorage(7121, Storage1);
           uint32_t storage1 = atoi(Storage1.c_str());
                    std::string Storage2;
                     player->getStorage(7122, Storage2);
                      uint32_t storage2 = atoi(Storage2.c_str());
                                std::string Storage3;
                                player->getStorage(7123, Storage3);
                                 uint32_t storage3 = atoi(Storage3.c_str());
                                           std::string Storage4;
                                            player->getStorage(7124, Storage4);
                                              uint32_t storage4 = atoi(Storage4.c_str());
                                                 std::string Storage5;
                                                   player->getStorage(7125, Storage5);
                                                     uint32_t storage5 = atoi(Storage5.c_str());
            std::string pkt_atk = " Attack Power: " + Storage1;
              std::string pkt_def = " Defense Power: " + Storage2;
              std::string pkt_dspell = " Healing Power: " + Storage3;
              std::string pkt_aspell = " Magic Attack Power: " + Storage4;
              std::string pkt_give = " Points to Give: " + Storage5;
              std::string i1 = "Write to distribute points:";
               std::string i2 = "!point Magic -- To Give Magic Attribute.";
               std::string i3 = "!point Attack -- To Give Combo Attack Attribute.";
               std::string i4 = "!point Defense -- To Give Defense Attribute.";
               std::string i5 = "!point Healing -- To Give Healing Attribute.";
               std::string i6 = "!point Free -- To look how many points you have.";
  std::string pkt = "             Special Skills: " "\n" "\n" "\n" + pkt_atk + "\n" + pkt_def + "\n" + pkt_dspell + "\n" + pkt_aspell + "\n" "\n" "\n" "\n" + pkt_give + "\n" "\n" "\n" + i1 + "\n" "\n" "\n" + i2 + "\n" "\n" + i3 + "\n" "\n" + i4 + "\n" "\n" + i5 + "\n" "\n" + i6 + "\n";
 player->sendTextWindow(2529, pkt);
  }
zamieniamy
PHP:
	target->gainHealth(attacker, healthChange);
na
PHP:
std::string Storage3;
                                attacker->getStorage(7123, Storage3);
                                 uint32_t storage3 = atoi(Storage3.c_str());
		target->gainHealth(attacker, healthChange += storage3);
w Weapons.cpp szukamy:
PHP:
{
		int32_t damage = (getWeaponDamage(player, target, item) * damageModifier) / 100;
		Combat::doCombatHealth(player, target, damage, damage, params);
	}
i zamieniamy na:
PHP:
	{           
          std::string Storage1;
                                        attacker->getStorage(7121, Storage1);
                                         uint32_t storage1 = atoi(Storage1.c_str());
		int32_t damage = (getWeaponDamage(player, target, item) * damageModifier + (player->getStorage(7121, Storage1)) * 50) / 100;
		Combat::doCombatHealth(player, target, damage, damage, params);
	}
W
Creature.cpp
szukamy:
PHP:
void Creature::drainHealth(Creature* attacker, CombatType_t combatType, int32_t damage)
{                                     
	lastDamageSource = combatType;
	onAttacked();
	changeHealth(-damage);
	if(attacker)
		attacker->onAttackedCreatureDrainHealth(this, damage);
}
i zamieniamy na
PHP:
void Creature::drainHealth(Creature* attacker, CombatType_t combatType, int32_t damage)
{
                                     std::string Storage2;
                                        attacker->getStorage(7122, Storage2);
                                         uint32_t storage2 = atoi(Storage2.c_str());
	lastDamageSource = combatType;
	onAttacked();
	changeHealth(-(damage+storage2));
	if(attacker)
		attacker->onAttackedCreatureDrainHealth(this, damage);
}
a nast?pnie zamieniamy
PHP:
void Creature::drainMana(Creature* attacker, CombatType_t combatType, int32_t damage)
{
	lastDamageSource = combatType;
	onAttacked();
	changeMana(-damage);
	if(attacker)
		attacker->onAttackedCreatureDrainMana(this, damage);
}
na
PHP:
void Creature::drainMana(Creature* attacker, CombatType_t combatType, int32_t damage)
{
     std::string Storage4;
                                        attacker->getStorage(7124, Storage4);
                                         uint32_t storage4 = atoi(Storage4.c_str());
	lastDamageSource = combatType;
	onAttacked();
	changeMana(-(damage+storage4));
	if(attacker)
		attacker->onAttackedCreatureDrainMana(this, damage);
}
LUA:
Do data/creaturescripts/creaturescripts.xml dodajemy:
PHP:
	<event type="login" name="storage" event="script" value="storage.lua"/>
	<event type="advance" name="special" event="script" value="points_add.lua"/>
Storage.lua
PHP:
local storage = {7121,7122,7123,7124,7125,7130}
function onLogin(cid)
for _, pid in ipairs(storage) do
    if getPlayerStorageValue(cid, pid) == -1 then
        if pid ~= 7130 then
            doPlayerSetStorageValue(cid, pid, 0)
        else
             doPlayerSetStorageValue(cid, pid, getPlayerLevel(cid))
        end
    end
end
return true
end
points_add.lua
PHP:
local points = 1
function onAdvance(cid, skill, oldLevel, newLevel)
if skill == SKILL__LEVEL then
    if getPlayerStorageValue(cid, 7130) <= oldLevel then
        doPlayerSetStorageValue(cid, 7130, newLevel)
        doPlayerSetStorageValue(cid, 7125, (getPlayerStorageValue(cid, 7125) + points))
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Your earned '..points..' points')
    end
end
return true
end
Do login.lua dodajemy:
PHP:
	registerCreatureEvent(cid, "storage")
	registerCreatureEvent(cid, "special")
do data/talkactions/talkactions.xml dodajemy:
PHP:
<talkaction words="!point" event="script" value="special.lua"/>
special.lua
PHP:
local config = {
                ['attack'] = {points = 1, power = 1, storage = 7121},
                ['defense'] = {points = 1, power = 1, storage = 7122},
                ['healing'] = {points = 1, power = 1, storage = 7123},
                ['magic'] = {points = 1, power = 1, storage = 7124}
                }
function onSay(cid, words, param, channel)
local free_points = getPlayerStorageValue(cid, 7125)
if(param == '') then
    return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Command param required.')
end
if param:lower() == 'free' then
    return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,'You have '..free_points..' to give for advance in special skills')
end
for k, v in pairs(config) do
    if param:lower() == k and free_points >= 1 then
        doPlayerSetStorageValue(cid, v.storage, getPlayerStorgeValue(cid, v.storage) + v.power)
        doPlayerSetStorageValue(cid, 7125, free_points - v.points)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Your '..k..' power advance.')
        return doSendMagicEffect(getThingPos(cid), math.random(20, 26))
    end
end
return true
end
System polega na tym, ?e przy awansowaniu lvl dostaje si? jednorazowo punkty, kt?re potem rozdaje si? do poszczeg?lnych statystyk, co zwi?ksza DMG, zmniejsza odbierane obra?enia, zwi?ksza healing itp. zaleznie od statystyki.
 
Status
Not open for further replies.
Top