Baneczek
うさちゃん
Hello guys.
I need some help with a creaturescript.
I have a script that allows player attack a monster ONLY when the player has required storage value.
The same is with the monster, When player has different storage value than required monster won't attack the player.
The problem i need to fix is, the monster won't attack the player, and player can't attack the monster, but even when player has different storage value than required, monster still follows him (not attacks). I tried to do it with doCreatureSetNoMove(cid, 1) but it doesn't work. Is there any way to change it?
EDIT: It's TFS 0.3.6pl1
EDIT2: Here is monster.xml file
And here is the creaturescript
I need some help with a creaturescript.
I have a script that allows player attack a monster ONLY when the player has required storage value.
The same is with the monster, When player has different storage value than required monster won't attack the player.
The problem i need to fix is, the monster won't attack the player, and player can't attack the monster, but even when player has different storage value than required, monster still follows him (not attacks). I tried to do it with doCreatureSetNoMove(cid, 1) but it doesn't work. Is there any way to change it?
EDIT: It's TFS 0.3.6pl1
EDIT2: Here is monster.xml file
Code:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Mutated Demon" nameDescription="a Mutated Demon" race="blood" experience="0" speed="250" manacost="290">
<health now="6000" max="6000"/>
<look type="160" corpse="2836"/>
<targetchange interval="2000" chance="0"/>
<strategy attack="100" defense="0"/>
<flags>
<flag summonable="1"/>
<flag attackable="1"/>
<flag hostile="1"/>
<flag illusionable="1"/>
<flag convinceable="1"/>
<flag pushable="1"/>
<flag canpushitems="0"/>
<flag canpushcreatures="0"/>
<flag targetdistance="1"/>
<flag staticattack="90"/>
<flag runonhealth="5"/>
</flags>
<script>
<event name="MutatedDemonCombat"/>
</script>
<attacks>
<attack name="melee" interval="2000" min="-4000" max="-9000"/>
</attacks>
<defenses armor="50" defense="0"/>
<voices interval="2000" chance="10">
</voices>
<loot>
</loot>
</monster>
And here is the creaturescript
Code:
local monster = 'Mutated Demon'
local stor = 8000
function onCombat(cid, target)
if (isPlayer(cid)) then
if (isMonster(target) and (getCreatureName(target) == monster and (getPlayerStorageValue(cid, stor) ~= 2))) then return false end
elseif (isMonster(cid)) then
if (isPlayer(target) and (getPlayerStorageValue(target, stor) ~= 2)) then doCreatureSetNoMove(cid, 1) return false end
end
return true
end
function onKill(cid, target)
if isMonster(target) and getCreatureName(target) == monster and getPlayerStorageValue(cid, stor) == 2 then
setPlayerStorageValue(cid, stor, 3)
end
return true
end
Last edited: