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

Saga problem (onCombat)

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,855
Solutions
18
Reaction score
671
Hello.
I have problem with my monster to Saga (mission).
TFS 0.3.5pl1

It should be like (GOOD):
- Before start saga i get storage 99,1 (i cannot target monster, the monster cannot attack me, i cannot attack with melee and area spells the monster [i dont have required storage to attack], monster should stay in sqm and dont react to player (without req. storage) on battle list)
- After talking with npc i get storage 100,1 (Now i CAN target monster, kill them, monster automatically attack me, i can attack with melee & spells) [i have required storage to attack, the monster should be now aggressive if he see me).

In my script is like this: (WRONG)
- If i dont have required storage (100,1) i can attack monster, monster cannot attack me but monster still follow me ...
- If i have required storage (100,1) the monster attack me, monster follow me , i can attack monster..

LUA:
function onCombat(cid, target)
    if isMonster(cid) and getCreatureName(cid, Test) and getPlayerStorageValue(cid, 99) == 1 then
        doPlayerSendCancelMessage(cid,"You cannot attack this monster now.")
        return false
        elseif isMonster(cid) and getCreatureName(cid, Test) and getPlayerStorageValue(cid, 100) == 1 then
                return true
    end  
    return true
end
i added to login.lua, monster .xml file...


Please, somebody can fix it ;///

@ Edit
I tried: http://otland.net/f132/attack-monster-111505/
But still dont work perfectly ("what it should be like...")
 
Last edited:
Try:
LUA:
function onCombat(cid, target)
    if isMonster(target) or isMonster(cid) then
       if isPlayer(cid) or isPlayer(target) then
          if getPlayerStorageValue(cid, 99) == 1 then
             doPlayerSendCancel(cid, "You cannot attack this monster now.")
             return false
          else
              return true
          end
       end
    end  
return true
end

By the way, get sure that the NPC is taking out the 99 storage too.
 
PHP:
local creatures = {'name_1', 'name_2'}

function onCombat(cid, target)
    if isMonster(target) and isInArray(creatures, getCreatureName(target)) then
		if getPlayerStorageValue(cid, 99) == 1 then
			doPlayerSendCancelMessage(cid,"You cannot attack this monster now.")
			return false
        elseif getPlayerStorageValue(cid, 100) == 1 then
			return true
		end
    end  
    return true
end
Into creaturescripts.xml:
PHP:
<event type="combat" name="Event_Name" event="script" value="name.lua"/>
Into your monster:
PHP:
<script>
	<event name="Event_Name"/>
</script>

#up
You're faster.
 
Last edited:
Ok but how to :
I must change 99 to 100 i know but how.

Into the npc script shud be something like this
Code:
setPlayerStorageValue(cid,100,1)
So after that, you set storage 99 to 0(or any number that isnt 1)
Code:
setPlayerStorageValue(cid,100,1)
[COLOR="red"]setPlayerStorageValue(cid,99,0)[/COLOR]

Bump.
And there must be "}" or ")" ??

}
 
Ok all its good. But monster walking... i need to staying and dont react to player who dont have required storage... :/ damn'it.


Like this:
- Before start saga i get storage 99,1 (i cannot target monster, the monster cannot attack me, i cannot attack with melee and area spells the monster [i dont have required storage to attack], monster should stay in sqm and dont react to player (without req. storage) on battle list)
- After talking with npc i get storage 100,1 (Now i CAN target monster, kill them, monster automatically attack me, i can attack with melee & spells) [i have required storage to attack, the monster should be now aggressive if he see me).
 
Location
Poland, Lublin

Yeah, i cant read in polish language. ; x
Thanks.


@Edit
Can you remake it for 0.3.5pl1 please.
Here is my GG: 8305054.
We need an scripter for dragon ball ots (got mapper :) )
 
Back
Top