• 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!

RevScripts Help with pet ; summon movement

owneddye

New Member
Joined
Feb 9, 2024
Messages
5
Reaction score
0
So i recently added on my TFS 1.2 server a (PET) system, where you equipp a item and a pet appears
So it worked perfect on my gamemaster, when equip summons and when dequip the monster disappears...

BUT
when a normal player equips the item, it summons 3 monsters and when dequip the monsters dont disappear
How can i fix that?
also, i couldnt find anything to make the summon teleport when floorchange pleaser guide

the script is as it follows:

movements:
<movevent event="Equip" itemid="3232" slot="ammo" script="pet/gamakichi.lua" />
<movevent event="DeEquip" itemid="3232" slot="ammo" script="pet/gamakichi.lua" />

script:
local summonName = "[Pet] Gamakichi"

function onEquip(player, item, slot, isCheck)
if isCheck then
return true
end

local playerSummons = player:getSummons(summonName)
local playerPosition = player:getPosition()
local summonsCountGamakichi = 0


if Tile(playerPosition):hasFlag(TILESTATE_PROTECTIONZONE) then
return player:sendCancelMessage("You mustn't be in PZ!")-- error msg
end

for _,player in pairs(playerSummons) do
if player:getName() == summonName then
summonsCountGamakichi = 1
end
end

if summonsCountGamakichi == 0 then
local summon = Game.createMonster(summonName, playerPosition)
summon:setMaster(player)
summon:setDropLoot(false)
summon:registerEvent('SummonThink')
-- what will player say upon summoning: player:say("Go " .. summonName .. "!", TALKTYPE_MONSTER_SAY)
else
player:sendCancelMessage("Gamakichi is already summoned.")-- error msg
end

return true
end

function onDeEquip(creature, item, slot)

local creatureSummons = creature:getSummons(summonName)
local creaturePosition = creature:getPosition()

for _,creature in pairs(creatureSummons) do
if creature:getName() == summonName then
creature:getPosition():sendMagicEffect(6) -- 3 = poff, 6 = explosion
doRemoveCreature(creature:getId())
else
-- nothing happens
end
end

return true
end




Monster xml:

<?xml version="1.0" encoding="UTF-8"?>
<monster name="[Pet] Gamakichi" nameDescription="a gamakichi" race="blood" experience="80" speed="750" manacost="255">
<health now="10000" max="10000" />
<look type="24" corpse="0" />
<targetchange interval="4000" chance="0" />
<targetstrategy nearest="100" weakest="0" mostdamage="0" random="0" />
<flags>
<flag summonable="1" />
<flag attackable="0" />
<flag hostile="0" />
<flag illusionable="1" />
<flag convinceable="1" />
<flag pushable="1" />
<flag canpushitems="0" />
<flag canpushcreatures="0" />
<flag targetdistance="1" />
<flag runonhealth="0" />
</flags>
</monster>
 
Back
Top