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

Creature event problem! Unsolveeeed =/

d4rkbl0od

Member
Joined
Mar 21, 2008
Messages
160
Reaction score
7
Hello people, i dont know what happening :S
when monster dies nothing happens, and sometime it crash the server!
here are the scripts

creaturerevents.xml:
Code:
    <event type="kill" name="ElementalSphere" event="script" value="sphere.lua"/>

sphere.lua:
Code:
local spheres = {
	['energy overlord'] = 8568,
	['fire overlord'] = 8569,
	['ice overlord'] = 8570,
	['earth overlord'] = 8578
}
 
function onKill(cid, target)
	if isPlayer(target) == false then
		local name = getCreatureName(target):lower()
		if spheres[name] then
			setGlobalStorageValue(spheres[name], -1)
	
		end
	end
	return true
end


and in the monster , for example ice overlord:
Code:
       <script>
<event name="ElementalSphere"/>
</script>


So, as you can see, it should set the globalsotargevalue to -1... but it doesnt, somehow this creatureevent isnt working :S
why?? ;O
 
Last edited:
if i remove this lower, the script will recognize
Code:
local spheres = {
	['energy overlord'] = 8568,
	['fire overlord'] = 8569,
	['ice overlord'] = 8570,
	['earth overlord'] = 8578
}
?
becuz, monster names are Ice Overlord, etc ..


EDIT...
same thing, doesnt work :S
 
Last edited:
just remove :lower()
that will destroy the script

@topic
LUA:
local spheres = {
    ['energy overlord'] = 8568,
    ['fire overlord'] = 8569,
    ['ice overlord'] = 8570,
    ['earth overlord'] = 8578
}
 
function onKill(cid, target, lasthit)
    if isPlayer(cid) and isMonster(target) then
        local name = getCreatureName(target):lower()
        if spheres[name] then
            setGlobalStorageValue(spheres[name], -1)
        end
    end
    return true
end
is event registered?
 
Remove this from all monster scripts:
XML:
<script>
	<event name="ElementalSphere"/>
</script>
And add this in login.lua, instead:
LUA:
	registerCreatureEvent(cid, 'ElementalSphere')
 
Back
Top