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

player can only attack monster if it has storage

kalew

New Member
Joined
Mar 19, 2016
Messages
6
Reaction score
1
I need a script or some source code to make the player when it has storage> 1 (configurable) can not attack monster x, and when it has storage = 2 (configurable) can attack the monster
 
the monster is configured to not attack the player if it does not have storage, but the player attacks it with or without storage, I want it if the player does not have the necessary storage, it can not attack the monster, it would be like attacking an npc, then when he gained the storage, he could do damage to the monster to kill him
 
events/events.xml
events/scripts/creature.lua
Code:
<event class="Creature" method="onTargetCombat" enabled="1" />
Code:
if self:isPlayer() and target:isMonster() and target:getName() == "Demon" and self:getStorageValue(1000) == 1 then
        return RETURNVALUE_NOTPOSSIBLE
    end
36867
this it should work
 
@Sarah Wesker
Where install ??
creaturescripts?
in the folder date does not have this folder event / ...
Do you need to tag in the monster file?
<script> <event name = "creature" /> </ script>
 
@zxmatzx
events/events.xml
events/scripts/creature.lua


but I do not have this event folder .... could not adapt to creaturscripts?

Edit : i using The Forgotten Server version 0.3.6 (Crying Damson)
 
Last edited:
Script!
Code:
function onCombat(cid, target)
    if isMonster(target) and isPlayer(cid) then
        if getCreatureName(target) == "Demon" and getCreatureStorage(cid, 1000) == 1 then
            return false
        end
    end
    return true
end

Login.lua
Code:
registerCreatureEvent(cid, "monsterProtected")

Creaturescripts.xml
Code:
<event type="combat" name="monsterProtected" event="script" value="monsterProtected.lua"/>
 
events/events.xml
events/scripts/creature.lua
Code:
<event class="Creature" method="onTargetCombat" enabled="1" />
Code:
if self:isPlayer() and target:isMonster() and target:getName() == "Demon" and self:getStorageValue(1000) == 1 then
        return RETURNVALUE_NOTPOSSIBLE
    end
View attachment 36867
this it should work
it doesn't work in version 1.4 but there is no bug either
 
Back
Top