• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Hit's damage

Dubler

PHP, LUA, C++
Joined
Aug 3, 2009
Messages
268
Reaction score
11
Location
Poland
Hi, i looking for solution for problem: How to set permanently same hits for selected monster?
for example i want always hiting 10damage (if i miss or hit other damage to)
i tried onStatChange but when i added -10 damage there was an error on console.
Can somebody tell what should i use, please?
 
First: http://otland.net/f35/creatureevent-regestire-all-monster-players-creatureevent-xml-134003/
  • /data/creaturevents/creaturevents.xml
    XML:
    <event type="statschange" name="uniquename" registerTo ="monster" event="script" value="filename.lua"/>
  • /data/creaturevents/scripts/filename.lua
    LUA:
    function onStatsChange(cid, attacker, type, combat, value)
    	
    	if (isPlayer(attacker) and type == STATSCHANGE_HEALTHLOSS) then
    		doCreatureAddHealth(cid, -10)
    	end
    	return false
    end
Not tested, and I'm not sure it works. Function without a dodge (miss).
 
Try debug.
Replace the previous script with this
LUA:
function onStatsChange(cid, attacker, type, combat, value)
	print(cid, attacker, type, combat, value)
	if (isPlayer(attacker) and type == STATSCHANGE_HEALTHLOSS) then
		print("doCreatureAddHealth(cid, -10)")
		doCreatureAddHealth(cid, -10)
	end
	return false
end
 
Code:
[01/11/2011 07:01:33] 1073743573
[01/11/2011 07:01:33] 268437204
[01/11/2011 07:01:33] 1
[01/11/2011 07:01:33] 1
[01/11/2011 07:01:33] 36
[01/11/2011 07:01:33] doCreatureAddHealth(cid, -10)
[01/11/2011 07:01:33] 1073743573
[01/11/2011 07:01:33] 0
[01/11/2011 07:01:33] 1
[01/11/2011 07:01:33] 16
[01/11/2011 07:01:33] 10
[01/11/2011 07:01:35] 1073743573
[01/11/2011 07:01:35] 268437204
[01/11/2011 07:01:35] 1
[01/11/2011 07:01:35] 1
[01/11/2011 07:01:35] 34
[01/11/2011 07:01:35] doCreatureAddHealth(cid, -10)
[01/11/2011 07:01:35] 1073743573
[01/11/2011 07:01:35] 0
[01/11/2011 07:01:35] 1
[01/11/2011 07:01:36] 16
[01/11/2011 07:01:36] 10
[01/11/2011 07:01:38] 1073743573
[01/11/2011 07:01:38] 268437204
[01/11/2011 07:01:38] 1
[01/11/2011 07:01:38] 1
[01/11/2011 07:01:38] 1
[01/11/2011 07:01:38] doCreatureAddHealth(cid, -10)
[01/11/2011 07:01:38] 1073743573
[01/11/2011 07:01:38] 0
[01/11/2011 07:01:38] 1
[01/11/2011 07:01:38] 16
[01/11/2011 07:01:38] 10
 
Back
Top