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

[Creature Event Support] When Monster Attack Player

Ancores

Active Member
Joined
Jan 17, 2010
Messages
538
Reaction score
28
Is it possible to use for example:
Code:
function onCombat(cid, target)
     if isMonster(cid) and isPlayer(target) then
          return false
     end
return true
end

To make it impossible for a monster to attack a player?

I know you can add a line in the monster's .xml files which has something to do with creature events but don't remember the reason why or if that's how I can use this script.

Hope you can help!
 
Maybe:
Code:
onStatsChange(cid, attacker, type, combat, value)
	if(type == STATSCHANGE_HEALTHLOSS) then
		if(isMonster(attacker) and combat ~= COMBAT_HEALING) then
			return false
		end
	end
	return true
end
 
Maybe:
Code:
onStatsChange(cid, attacker, type, combat, value)
	if(type == STATSCHANGE_HEALTHLOSS) then
		if(isMonster(attacker) and combat ~= COMBAT_HEALING) then
			return false
		end
	end
	return true
end

why don't you just use onTarget?

Lua:
function onTarget(cid, target)
	if(isMonster(cid) and isPlayer(target))then
		return false
	end
	return true
end
 
why don't you just use onTarget?

Lua:
function onTarget(cid, target)
	if(isMonster(cid) and isPlayer(target))then
		return false
	end
	return true
end

I don't think it works with cid on monsters, I think it has to be a player with Target/Follow/Kill/Combat etc.
 
I don't think it works with cid on monsters, I think it has to be a player with Target/Follow/Kill/Combat etc.


Never.

You just need to register the event in the .xml of the monster.
Like this:
<script>
<event name="Creature_Event_Name"/>
</script>

But it is easier to use onstatschange, because you can register onLogin and just check if attacker a creature, otherwise you would need to register it to every monster.
 
Never.

You just need to register the event in the .xml of the monster.
Like this:
<script>
<event name="Creature_Event_Name"/>
</script>

But it is easier to use onstatschange, because you can register onLogin and just check if attacker a creature, otherwise you would need to register it to every monster.

Ahh, thanks.
<script>
<event name="Creature_Event_Name"/>
</script>
That's what I needed to know
 
Back
Top