• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

CreatureEvent [TFS 1.3 / 1.4] Upgrade System

About this part:

Lua:
  [52] = {
    name = "Revive on death",
    VALUES_PER_LEVEL = 0.05,
    format = function(value)
      return value .. "%% to be revived"
    end,
    itemType = US_ITEM_TYPES.BOOTS,
    minLevel = 50,
    chance = 30
  },

Does this mean that when you die you have a 30% chance to revive?
Lua:
chance = 30

Does this mean that each level adds 0.5% more chance?
Lua:
 VALUES_PER_LEVEL = 0.05,
 
Does this mean that when you die you have a 30% chance to revive?
No, this is a chance to roll this attribute on an item.

Does this mean that each level adds 0.5% more chance?
By 0.05% (starting at 0%) and it's based on Item Level, not Player Level.
 
Would love to get this working...I'm having an issue with monster ondeath, causing everything drops level 0 equipment. Here's the error: 1587395992650.png
Any help would be greatly appreciated!
 
Would love to get this working...I'm having an issue with monster ondeath, causing everything drops level 0 equipment. Here's the error: View attachment 44517
Any help would be greatly appreciated!
You are using TFS 1.3, latest script files from GitHub and for sure installed and configured everything correctly?
 
Any idea how i can make this work on the reward chest loot.

Everytime someone kills a boss the items appear common and at lvl 0 so when they upgrade anything from that it will bug the item out.




Also my equip/dequip is kind of buggy. I'm running Ot-ServerBR Global

Lua:
return us_onMoveItem(self, item, fromPosition, toPosition)

Been playing with it for a while, sometimes when i pick up the item from the ground the stats dont activate, sometimes they dont deactivate etc.


this is what my player.lua on events looks like by default from the repository.

Only pasted part of it since i cant post the whole deal.

Lua:
function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)

    -- No move items with actionID = 100
    if item:getActionId() == NOT_MOVEABLE_ACTION then
        self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        return false
    end

    -- Store Items
    if isInArray(storeItemID,item.itemid) then
        self:sendCancelMessage('You cannot move this item outside this container.')
        return false
    end

    -- No move if item count > 20 items
    local tile = Tile(toPosition)
    if tile and tile:getItemCount() > 20 then
        self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        return false
    end

    -- No move parcel very heavy
    if DISABLE_CONTAINER_WEIGHT == 0 and ItemType(item:getId()):isContainer()
    and item:getWeight() > CONTAINER_WEIGHT then
        self:sendCancelMessage("Your cannot move this item too heavy.")
        return false
    end

    -- Loot Analyser apenas 11.x+
    if self:getClient().os == CLIENTOS_NEW_WINDOWS then
        local t = Tile(fromCylinder:getPosition())
        local corpse = t:getTopDownItem()
        if corpse then
            local itemType = corpse:getType()
            if itemType:isCorpse() and toPosition.x == CONTAINER_POSITION then
                self:sendLootStats(item)
            end
        end
    end

    -- Cults of Tibia begin
    local frompos = Position(33023, 31904, 14) -- Checagem
    local topos = Position(33052, 31932, 15) -- Checagem
    if self:getPosition():isInRange(frompos, topos) and item:getId() == 26397 then
        local tileBoss = Tile(toPosition)
        if tileBoss and tileBoss:getTopCreature() and tileBoss:getTopCreature():isMonster() then
            if tileBoss:getTopCreature():getName():lower() == 'the remorseless corruptor' then
                tileBoss:getTopCreature():addHealth(-17000)
                item:remove(1)
                if tileBoss:getTopCreature():getHealth() <= 300 then
                    tileBoss:getTopCreature():remove()
                    local monster = Game.createMonster('the corruptor of souls', toPosition)
                    monster:registerEvent('CheckTile')
                    if Game.getStorageValue('healthSoul') > 0 then
                        monster:addHealth(-(monster:getHealth() - Game.getStorageValue('healthSoul')))
                    end
                    Game.setStorageValue('CheckTile', os.time()+30)
                end
            elseif tileBoss:getTopCreature():getName():lower() == 'the corruptor of souls' then
                Game.setStorageValue('CheckTile', os.time()+30)
                item:remove(1)
            end
        end
    end
    -- Cults of Tibia end

    -- SSA exhaust
    local exhaust = { }
    if toPosition.x == CONTAINER_POSITION and toPosition.y == CONST_SLOT_NECKLACE
    and item:getId() == STONE_SKIN_AMULET then
        local pid = self:getId()
        if exhaust[pid] then
            self:sendCancelMessage(RETURNVALUE_YOUAREEXHAUSTED)
            return false
        else
            exhaust[pid] = true
            addEvent(function() exhaust[pid] = false end, 2000, pid)
            return true
        end
    end

    -- Store Inbox
    local containerIdFrom = fromPosition.y - 64
    local containerFrom = self:getContainerById(containerIdFrom)
    if (containerFrom) then
        if (containerFrom:getId() == ITEM_STORE_INBOX
        and toPosition.y >= 1 and toPosition.y <= 11 and toPosition.y ~= 3) then
            self:sendCancelMessage(RETURNVALUE_CONTAINERNOTENOUGHROOM)
            return false
        end
    end

    local containerTo = self:getContainerById(toPosition.y-64)
    if (containerTo) then
        if (containerTo:getId() == ITEM_STORE_INBOX) then
            self:sendCancelMessage(RETURNVALUE_CONTAINERNOTENOUGHROOM)
            return false
        end
        -- Gold Pouch
        if (containerTo:getId() == GOLD_POUCH) then
            if (not (item:getId() == ITEM_CRYSTAL_COIN or item:getId() == ITEM_PLATINUM_COIN
            or item:getId() == ITEM_GOLD_COIN)) then
                self:sendCancelMessage("You can move only money to this container.")
                return false
            end
        end
    end

    -- No move gold pouch
    if item:getId() == GOLD_POUCH then
        self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        return false
    end

    -- Handle move items to the ground
    if toPosition.x ~= CONTAINER_POSITION then
        if item:isContainer() then
            local container = Container(item.uid)
            for categoryId = LOOT_START, LOOT_END do
                if container:hasQuickLootCategory(categoryId) then
                    container:removeQuickLootCategory(categoryId)
                    self:setQuickLootBackpack(categoryId, nil)
                end
            end
        end

        return true
    end

    -- Check two-handed weapons
    if item:getTopParent() == self and bit.band(toPosition.y, 0x40) == 0 then
        local itemType, moveItem = ItemType(item:getId())
        if bit.band(itemType:getSlotPosition(), SLOTP_TWO_HAND) ~= 0 and toPosition.y == CONST_SLOT_LEFT then
            moveItem = self:getSlotItem(CONST_SLOT_RIGHT)
        elseif itemType:getWeaponType() == WEAPON_SHIELD and toPosition.y == CONST_SLOT_RIGHT then
            moveItem = self:getSlotItem(CONST_SLOT_LEFT)
            if moveItem and bit.band(ItemType(moveItem:getId()):getSlotPosition(), SLOTP_TWO_HAND) == 0 then
                return true
            end
        end

        if moveItem then
            local parent = item:getParent()
            if parent:getSize() == parent:getCapacity() then
                self:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_CONTAINERNOTENOUGHROOM))
                return false
            else
                return moveItem:moveTo(parent)
            end
        end
    end

    -- Reward System
    if toPosition.x == CONTAINER_POSITION then
        local containerId = toPosition.y - 64
        local container = self:getContainerById(containerId)
        if not container then
            return true
        end

        -- Do not let the player insert items into either the Reward Container or the Reward Chest
        local itemId = container:getId()
        if itemId == ITEM_REWARD_CONTAINER or itemId == ITEM_REWARD_CHEST then
            self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
            return false
        end

        -- The player also shouldn't be able to insert items into the boss corpse
        local tileCorpse = Tile(container:getPosition())
        for index, value in ipairs(tileCorpse:getItems() or { }) do
            if value:getAttribute(ITEM_ATTRIBUTE_CORPSEOWNER) == 2^31 - 1 and value:getName() == container:getName() then
                self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
                return false
            end
        end
    end

    -- Do not let the player move the boss corpse.
    if item:getAttribute(ITEM_ATTRIBUTE_CORPSEOWNER) == 2^31 - 1 then
        self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        return false
    end

    -- Players cannot throw items on reward chest
    local tileChest = Tile(toPosition)
    if tileChest and tileChest:getItemById(ITEM_REWARD_CHEST) then
        self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        self:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end

    -- Players cannot throw items on teleports
    if blockTeleportTrashing and toPosition.x ~= CONTAINER_POSITION then
        local thing = Tile(toPosition):getItemByType(ITEM_TYPE_TELEPORT)
        if thing then
            self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
            self:getPosition():sendMagicEffect(CONST_ME_POFF)
            return false
        end
    end

    if tile and tile:getItemById(370) then -- Trapdoor
        self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        self:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end

    if not antiPush(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder) then
        return false
    end

    return true
end

function Player:onItemMoved(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
end
 
Last edited:
Any idea how i can make this work on the reward chest loot.

Everytime someone kills a boss the items appear common and at lvl 0 so when they upgrade anything from that it will bug the item out.




Also my equip/dequip is kind of buggy. I'm running Ot-ServerBR Global

Lua:
return us_onMoveItem(self, item, fromPosition, toPosition)

Been playing with it for a while, sometimes when i pick up the item from the ground the stats dont activate, sometimes they dont deactivate etc.


this is what my player.lua on events looks like by default from the repository.

Only pasted part of it since i cant post the whole deal.

Lua:
function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)

    -- No move items with actionID = 100
    if item:getActionId() == NOT_MOVEABLE_ACTION then
        self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        return false
    end

    -- Store Items
    if isInArray(storeItemID,item.itemid) then
        self:sendCancelMessage('You cannot move this item outside this container.')
        return false
    end

    -- No move if item count > 20 items
    local tile = Tile(toPosition)
    if tile and tile:getItemCount() > 20 then
        self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        return false
    end

    -- No move parcel very heavy
    if DISABLE_CONTAINER_WEIGHT == 0 and ItemType(item:getId()):isContainer()
    and item:getWeight() > CONTAINER_WEIGHT then
        self:sendCancelMessage("Your cannot move this item too heavy.")
        return false
    end

    -- Loot Analyser apenas 11.x+
    if self:getClient().os == CLIENTOS_NEW_WINDOWS then
        local t = Tile(fromCylinder:getPosition())
        local corpse = t:getTopDownItem()
        if corpse then
            local itemType = corpse:getType()
            if itemType:isCorpse() and toPosition.x == CONTAINER_POSITION then
                self:sendLootStats(item)
            end
        end
    end

    -- Cults of Tibia begin
    local frompos = Position(33023, 31904, 14) -- Checagem
    local topos = Position(33052, 31932, 15) -- Checagem
    if self:getPosition():isInRange(frompos, topos) and item:getId() == 26397 then
        local tileBoss = Tile(toPosition)
        if tileBoss and tileBoss:getTopCreature() and tileBoss:getTopCreature():isMonster() then
            if tileBoss:getTopCreature():getName():lower() == 'the remorseless corruptor' then
                tileBoss:getTopCreature():addHealth(-17000)
                item:remove(1)
                if tileBoss:getTopCreature():getHealth() <= 300 then
                    tileBoss:getTopCreature():remove()
                    local monster = Game.createMonster('the corruptor of souls', toPosition)
                    monster:registerEvent('CheckTile')
                    if Game.getStorageValue('healthSoul') > 0 then
                        monster:addHealth(-(monster:getHealth() - Game.getStorageValue('healthSoul')))
                    end
                    Game.setStorageValue('CheckTile', os.time()+30)
                end
            elseif tileBoss:getTopCreature():getName():lower() == 'the corruptor of souls' then
                Game.setStorageValue('CheckTile', os.time()+30)
                item:remove(1)
            end
        end
    end
    -- Cults of Tibia end

    -- SSA exhaust
    local exhaust = { }
    if toPosition.x == CONTAINER_POSITION and toPosition.y == CONST_SLOT_NECKLACE
    and item:getId() == STONE_SKIN_AMULET then
        local pid = self:getId()
        if exhaust[pid] then
            self:sendCancelMessage(RETURNVALUE_YOUAREEXHAUSTED)
            return false
        else
            exhaust[pid] = true
            addEvent(function() exhaust[pid] = false end, 2000, pid)
            return true
        end
    end

    -- Store Inbox
    local containerIdFrom = fromPosition.y - 64
    local containerFrom = self:getContainerById(containerIdFrom)
    if (containerFrom) then
        if (containerFrom:getId() == ITEM_STORE_INBOX
        and toPosition.y >= 1 and toPosition.y <= 11 and toPosition.y ~= 3) then
            self:sendCancelMessage(RETURNVALUE_CONTAINERNOTENOUGHROOM)
            return false
        end
    end

    local containerTo = self:getContainerById(toPosition.y-64)
    if (containerTo) then
        if (containerTo:getId() == ITEM_STORE_INBOX) then
            self:sendCancelMessage(RETURNVALUE_CONTAINERNOTENOUGHROOM)
            return false
        end
        -- Gold Pouch
        if (containerTo:getId() == GOLD_POUCH) then
            if (not (item:getId() == ITEM_CRYSTAL_COIN or item:getId() == ITEM_PLATINUM_COIN
            or item:getId() == ITEM_GOLD_COIN)) then
                self:sendCancelMessage("You can move only money to this container.")
                return false
            end
        end
    end

    -- No move gold pouch
    if item:getId() == GOLD_POUCH then
        self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        return false
    end

    -- Handle move items to the ground
    if toPosition.x ~= CONTAINER_POSITION then
        if item:isContainer() then
            local container = Container(item.uid)
            for categoryId = LOOT_START, LOOT_END do
                if container:hasQuickLootCategory(categoryId) then
                    container:removeQuickLootCategory(categoryId)
                    self:setQuickLootBackpack(categoryId, nil)
                end
            end
        end

        return true
    end

    -- Check two-handed weapons
    if item:getTopParent() == self and bit.band(toPosition.y, 0x40) == 0 then
        local itemType, moveItem = ItemType(item:getId())
        if bit.band(itemType:getSlotPosition(), SLOTP_TWO_HAND) ~= 0 and toPosition.y == CONST_SLOT_LEFT then
            moveItem = self:getSlotItem(CONST_SLOT_RIGHT)
        elseif itemType:getWeaponType() == WEAPON_SHIELD and toPosition.y == CONST_SLOT_RIGHT then
            moveItem = self:getSlotItem(CONST_SLOT_LEFT)
            if moveItem and bit.band(ItemType(moveItem:getId()):getSlotPosition(), SLOTP_TWO_HAND) == 0 then
                return true
            end
        end

        if moveItem then
            local parent = item:getParent()
            if parent:getSize() == parent:getCapacity() then
                self:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_CONTAINERNOTENOUGHROOM))
                return false
            else
                return moveItem:moveTo(parent)
            end
        end
    end

    -- Reward System
    if toPosition.x == CONTAINER_POSITION then
        local containerId = toPosition.y - 64
        local container = self:getContainerById(containerId)
        if not container then
            return true
        end

        -- Do not let the player insert items into either the Reward Container or the Reward Chest
        local itemId = container:getId()
        if itemId == ITEM_REWARD_CONTAINER or itemId == ITEM_REWARD_CHEST then
            self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
            return false
        end

        -- The player also shouldn't be able to insert items into the boss corpse
        local tileCorpse = Tile(container:getPosition())
        for index, value in ipairs(tileCorpse:getItems() or { }) do
            if value:getAttribute(ITEM_ATTRIBUTE_CORPSEOWNER) == 2^31 - 1 and value:getName() == container:getName() then
                self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
                return false
            end
        end
    end

    -- Do not let the player move the boss corpse.
    if item:getAttribute(ITEM_ATTRIBUTE_CORPSEOWNER) == 2^31 - 1 then
        self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        return false
    end

    -- Players cannot throw items on reward chest
    local tileChest = Tile(toPosition)
    if tileChest and tileChest:getItemById(ITEM_REWARD_CHEST) then
        self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        self:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end

    -- Players cannot throw items on teleports
    if blockTeleportTrashing and toPosition.x ~= CONTAINER_POSITION then
        local thing = Tile(toPosition):getItemByType(ITEM_TYPE_TELEPORT)
        if thing then
            self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
            self:getPosition():sendMagicEffect(CONST_ME_POFF)
            return false
        end
    end

    if tile and tile:getItemById(370) then -- Trapdoor
        self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        self:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end

    if not antiPush(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder) then
        return false
    end

    return true
end

function Player:onItemMoved(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
end
Make sure you are using latest version from here Oen44/TFS-Upgrade-System (https://github.com/Oen44/TFS-Upgrade-System/)
Latest: Oen44/TFS-Upgrade-System (https://github.com/Oen44/TFS-Upgrade-System/releases/latest)
Wiki: Oen44/TFS-Upgrade-System (https://github.com/Oen44/TFS-Upgrade-System/wiki)
Follow wiki about installation and configuration, also check Developer Notes, that will answer your question about reward chests.
 
Followed the steps again, cant get the equip/dequip part working.

I added my
Lua:
return us_onMoveItem(self, item, fromPosition, toPosition)
in the correct location where it said to add it at the end of the function where it says return true

and the
Lua:
onUpgradeMoved(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder)

In the correct spot.



This is part of the player.lua didnt want to post everything and make a huge spam >.< been trying to figure it out for couple of hours now
Lua:
   end

    if tile and tile:getItemById(370) then -- Trapdoor
        self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        self:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end

    if not antiPush(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder) then
        return false
    end

    return us_onMoveItem(self, item, fromPosition, toPosition)
end

function Player:onItemMoved(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
onUpgradeMoved(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
end
 
Followed the steps again, cant get the equip/dequip part working.

I added my
Lua:
return us_onMoveItem(self, item, fromPosition, toPosition)
in the correct location where it said to add it at the end of the function where it says return true

and the
Lua:
onUpgradeMoved(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder)

In the correct spot.



This is part of the player.lua didnt want to post everything and make a huge spam >.< been trying to figure it out for couple of hours now
Lua:
   end

    if tile and tile:getItemById(370) then -- Trapdoor
        self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        self:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end

    if not antiPush(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder) then
        return false
    end

    return us_onMoveItem(self, item, fromPosition, toPosition)
end

function Player:onItemMoved(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
onUpgradeMoved(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
end
These methods are enabled="1"?
XML:
<event class="Player" method="onMoveItem" enabled="1" />
<event class="Player" method="onItemMoved" enabled="1" />
 
These methods are enabled="1"?
XML:
<event class="Player" method="onMoveItem" enabled="1" />
<event class="Player" method="onItemMoved" enabled="1" />
Yes, triple checked them since last night

XML:
<?xml version="1.0" encoding="UTF-8"?>
<events>
    <!-- CUSTOM -->

    <!-- Creature Methods -->
    <event class="Creature" method="onChangeOutfit" enabled="1" />
    <event class="Creature" method="onAreaCombat" enabled="0" />
    <event class="Creature" method="onTargetCombat" enabled="1" /><!-- removeCombatProtection on secure modes protection -->
    <event class="Creature" method="onHear" enabled="0" />

    <!-- Party Methods -->
    <event class="Party" method="onJoin" enabled="0" />
    <event class="Party" method="onLeave" enabled="0" />
    <event class="Party" method="onDisband" enabled="0" />
    <event class="Party" method="onShareExperience" enabled="1" />

    <!-- Player Methods -->
    <event class="Player" method="onBrowseField" enabled="0" />
    <event class="Player" method="onLook" enabled="1" />
    <event class="Player" method="onLookInBattleList" enabled="1" />
    <event class="Player" method="onLookInTrade" enabled="1" />
    <event class="Player" method="onLookInShop" enabled="0" />
    <event class="Player" method="onMoveItem" enabled="1" /><!-- Protections on rewardsystem and global depots -->
    <event class="Player" method="onItemMoved" enabled="1" />


This is what my player.lua looks like completed. Its bone stock from the GitHub Repo, only things i've added is the code from this mod
 

Attachments

Yes, triple checked them since last night
Looks like onMoveItem is not reaching last return. Just tried and there are few lines to edit.

Lua:
    -- Handle move items to the ground
    if toPosition.x ~= CONTAINER_POSITION then
        if item:isContainer() then
            local container = Container(item.uid)
            for categoryId = LOOT_START, LOOT_END do
                if container:hasQuickLootCategory(categoryId) then
                    container:removeQuickLootCategory(categoryId)
                    self:setQuickLootBackpack(categoryId, nil)
                end
            end
        end

        return true -- HERE
    end


    -- Reward System
    if toPosition.x == CONTAINER_POSITION then
        local containerId = toPosition.y - 64
        local container = self:getContainerById(containerId)
        if not container then
            return true -- HERE
        end
And return true at the end of this function. Change these lines to
Lua:
return us_onMoveItem(self, item, fromPosition, toPosition)
 
how do you add the crystals in the item-xml? I tried to get 1 crystal and change the id but it didn't work.
 
[QUOTE = "oen432, publicação: 2608050, membro: 206904"]
Poste este script.
[/ CITAR]

Code:
function Creature:onChangeOutfit(outfit)
    return true
end

function Creature:onAreaCombat(tile, isAggressive)
    return RETURNVALUE_NOERROR
end

function Creature:onTargetCombat(target)
target:registerEvent("ItemSetsHealth")
target:registerEvent("UpgradeSystemHealth")
target:registerEvent("UpgradeSystemDeath")
          if
creature:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then
        if target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then
            return RETURNVALUE_NOERROR
        elseif target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 0 then
            creature:sendCancelMessage("You cannot attack someone that is on your team.")
            return false
        end
    elseif creature:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then
        if target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then
            return RETURNVALUE_NOERROR
        elseif target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 0 then
            creature:sendCancelMessage("You cannot attack someone that is on your team.")
            return false
        end
    end
end
 
[QUOTE = "oen432, publicação: 2608050, membro: 206904"]
Poste este script.
[/ CITAR]

function Creature:onChangeOutfit(outfit) return true end function Creature:onAreaCombat(tile, isAggressive) return RETURNVALUE_NOERROR end function Creature:onTargetCombat(target) target:registerEvent("ItemSetsHealth") target:registerEvent("UpgradeSystemHealth") target:registerEvent("UpgradeSystemDeath") if creature:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then if target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then return RETURNVALUE_NOERROR elseif target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 0 then creature:sendCancelMessage("You cannot attack someone that is on your team.") return false end elseif creature:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then if target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then return RETURNVALUE_NOERROR elseif target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 0 then creature:sendCancelMessage("You cannot attack someone that is on your team.") return false end end end [/ ICODE]
For the love of god, stop posting problems not related to this script!
 
Back
Top