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

Help here

Michy

Member
Joined
May 20, 2010
Messages
105
Reaction score
6
I need your help:
I would like a "creatureevents" when the person is missing, 20 HP starts to come out an effect is possible?

Sorry my english is bad :/
 
doSendMagicEffect(getThingPosition(cid), 32) ???

Or...PM me if you can talk in spanish.
 
Try:
Lua:
function onThink(interval, lastExecution)
for _, pid in ipairs(getPlayersOnline()) do
     if getCreatureHealth(pid) < 30 then
        doSendMagicEffect(getThingPos(pid), 32)
     end
end
return true
end
 
Last edited:
Why would you define it as a global var?
Lua:
function onThink(interval, lastExecution)
	for _, pid in ipairs(getPlayersOnline()) do
		if getCreatureHealth(pid) < 30 then
			doSendMagicEffect(getThingPos(pid), 32)
		end
	end
	return true
end
 
Why would you define it as a global var?
Lua:
function onThink(interval, lastExecution)
	for _, pid in ipairs(getPlayersOnline()) do
		if getCreatureHealth(pid) < 30 then
			doSendMagicEffect(getThingPos(pid), 32)
		end
	end
	return true
end

Okay, okay.
 
lowhealth.lua:
Lua:
function onStatsChange(cid, attacker, type, combat, value)
	if(isPlayer(cid) and combat ~= COMBAT_HEALING or type == STATSCHANGE_HEALTHLOSS) then
		value = 30
		if(value >= getCreatureHealth(cid)) then
			doSendMagicEffect(getThingPosition(cid), CONST_ME_SLEEP)
		return false
		end
	end

	return true
end

In creaturescripts.xml:
XML:
	<event type="statschange" name="LowHealth" event="script" value="lowhealth.lua"/>

In login.lua:
Lua:
	registerCreatureEvent(cid, "LowHealth")
 
Last edited:
[18/12/2010 17:51:34] [Error - CreatureScript Interface]
[18/12/2010 17:51:35] data/creaturescripts/scripts/lowhealth.lua:eek:nStatsChange
[18/12/2010 17:51:35] Description:
[18/12/2010 17:51:35] attempt to index a number value
[18/12/2010 17:51:35] stack traceback:
[18/12/2010 17:51:35] [C]: in function 'doSendMagicEffect'
[18/12/2010 17:51:35] data/creaturescripts/scripts/lowhealth.lua:4: in function <data/creaturescripts/scripts/lowhealth.lua:1>
 
[18/12/2010 17:51:34] [Error - CreatureScript Interface]
[18/12/2010 17:51:35] data/creaturescripts/scripts/lowhealth.lua:eek:nStatsChange
[18/12/2010 17:51:35] Description:
[18/12/2010 17:51:35] attempt to index a number value
[18/12/2010 17:51:35] stack traceback:
[18/12/2010 17:51:35] [C]: in function 'doSendMagicEffect'
[18/12/2010 17:51:35] data/creaturescripts/scripts/lowhealth.lua:4: in function <data/creaturescripts/scripts/lowhealth.lua:1>

Psst, use mine or Cykos (They are the same tho)
 
*And you could make so the effect and the life is a summon like when the summom has 30 hp the efect comes out at 31
 
Try with this:

lowhealthsummon.lua:
Lua:
function onStatsChange(cid, attacker, type, combat, value)
	for _, pid in ipairs(getCreatureSummons(cid)) do
		if(pid and isPlayer(cid) and combat ~= COMBAT_HEALING or type == STATSCHANGE_HEALTHLOSS) then
			value = 30
			if(value >= getCreatureHealth(pid)) then
				doSendMagicEffect(getThingPosition(pid), CONST_ME_STUN)
				return false
			end
		end
	end
 
	return true
end

In creaturescripts.xml:
XML:
	<event type="statschange" name="LowHealthSummon" event="script" value="lowhealthsummon.lua"/>

In login.lua:
Lua:
	registerCreatureEvent(cid, "LowHealthSummon")
 
Last edited:
ok wait!!! :)

merry christmas


[18/12/2010 18:55:56] [Error - CreatureScript Interface]
[18/12/2010 18:55:56] data/creaturescripts/scripts/lowhealthsummon.lua:eek:nStatsChange
[18/12/2010 18:55:56] Description:
[18/12/2010 18:55:56] data/creaturescripts/scripts/lowhealthsummon.lua:4: attempt to compare boolean with number
[18/12/2010 18:55:56] stack traceback:
[18/12/2010 18:55:56] data/creaturescripts/scripts/lowhealthsummon.lua:4: in function <data/creaturescripts/scripts/lowhealthsummon.lua:1>
 
Last edited by a moderator:
Back
Top