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

Lua Artificial Intelligence Script boss

pasibun

New Member
Joined
Nov 7, 2011
Messages
147
Reaction score
1
I made this script, but as a beginning lua scripter I still find it hard to get some stuff working.
I tent to look at other scripts how they work and then try and create my script.

This is an example but I am clearly doing stuff wrong.

In this script I try and create a bit more interaction with a creature.
One of the problems you would perhaps know is that if you have a very long spell (wich has 10 seconds of animation or something) and then when he dies, your server will report a shitload of errors.

I tried to fix that also by approaching it like this.

I would like to someone to explaine me what is wrong and why.

Thanks in advance.

Regards,
Pasibun

Lua:
function onStatsChange(cid, attacker, type, combat, value)
	
	local t = {
		["Raijin"] = {pos1 = { x = 884, y = 423, z = 9 , stackpos = 1 }}, 
		["Raijin"] = {pos2 = { x = 881, y = 423, z = 9 , stackpos = 1 }},
		["Minor Entity"] = {pos3 = { x = 884, y = 422, z = 9 , stackpos = 1 }},
		["Minor Entity"] = {pos4 = { x = 884, y = 423, z = 9 , stackpos = 1 }},
		["Minor Entity"] = {pos5 = { x = 884, y = 424, z = 9 , stackpos = 1 }},
		["Minor Entity"] = {pos6 = { x = 884, y = 425, z = 9 , stackpos = 1 }}
	}
	
	local percentage = 1
	local monsterHP = getCreatureHealth(cid)
	local cidName = getCreatureName(cid)
	local monsterHP  = percentage / 100
	
	if(monsterHP <= 80*percentage) and getCreatureStorage ~= 19200 then
		doTeleportThing(cid, t[cidName].pos1)
		doCreatureSetStorage(cid, 19200)
		doCreateMonster(t[cidName].pos3)
		doCreateMonster(t[cidName].pos4)
		doCreateMonster(t[cidName].pos5)
		doCreateMonster(t[cidName].pos6)
		doSendMagicEffect(CONST_ME_MAGIC_BLUE)
	end
		
	if(monsterHP <= 70*percentage) and getCreatureStorage ~= 19201 then
		doTeleportThing(cid, t[cidName].pos2)
		doCreatureSetStorage(cid, 19201)
		doSendMagicEffect(CONST_ME_MAGIC_BLUE)
	end
	
	if(monsterHP <= 60*percentage) and getCreatureStorage ~= 19202 then
		doCreatureSetStorage(cid, 19202)
		doSendMagicEffect(CONST_ME_MAGIC_BLUE)
	end

	if(monsterHP <= 50*percentage) and getCreatureStorage ~= 19203 then
		doSendMagicEffect(CONST_ME_MAGIC_BLUE)
		doCreatureSetStorage(cid, 19203)		
	end

	if(monsterHP <= 40*percentage) and getCreatureStorage ~= 19204 then
		doTeleportThing(cid, t[cidName].pos1)
		doCreatureSetStorage(cid, 19204)
		doCreateMonster(t[cidName].pos3)
		doCreateMonster(t[cidName].pos4)
		doCreateMonster(t[cidName].pos5)
		doCreateMonster(t[cidName].pos6)
		doSendMagicEffect(CONST_ME_MAGIC_BLUE)
		doCreatureAddHealth(cidName, 20000)	
	end	
		
	if(monsterHP <= 30*percentage) and getCreatureStorage ~= 19205 then
		doTeleportThing(cid, t[cidName].pos2)
		doCreatureSetStorage(cid, 19205)
		doSendMagicEffect(CONST_ME_MAGIC_BLUE)	
	end
		
	if(monsterHP <= 20*percentage) and getCreatureStorage ~= 19206 then
		doCreatureSetStorage(cid, 19206)
		doSendMagicEffect(CONST_ME_MAGIC_BLUE)	
	end
		
	if(monsterHP <= 10*percentage) and getCreatureStorage ~= 19207 then
		doCreatureSetStorage(cid, 19207)
		doSendMagicEffect(CONST_ME_MAGIC_BLUE)
	end
		
	if(monsterHP == 0) then
		doSendMagicEffect(CONST_ME_MAGIC_BLUE)		
	end
end
 
Solution
Lua:
local t = {
    {name = "Raijin", pos = { x = 884, y = 423, z = 9, stackpos = 1 }},
    {name = "Raijin", pos = { x = 881, y = 423, z = 9 , stackpos = 1 }},
    {name = "Minor Entity", pos = { x = 884, y = 422, z = 9 , stackpos = 1 }},                
    {name = "Minor Entity", pos = { x = 884, y = 423, z = 9 , stackpos = 1 }},                
    {name = "Minor Entity", pos = { x = 884, y = 424, z = 9 , stackpos = 1 }},                
    {name = "Minor Entity", pos = { x = 884, y = 425, z = 9 , stackpos = 1 }}
}
 
function onStatsChange(cid, attacker, type, combat, value) 
    local monsterHP = getCreatureHealth(cid) / getCreatureMaxHealth(cid)
 
    if(monsterHP <= 80) and getCreatureStorage(cid, 19200) == -1 then...
ur code makes no sense and most of the functions have wrong parameters
imo, you shouldnt be doing scripts like this yet, start with other easier ones first

try this one
Lua:
local t = {
    {name = "Raijin", pos = { x = 884, y = 423, z = 9, stackpos = 1 }},
    {name = "Raijin", pos = { x = 881, y = 423, z = 9 , stackpos = 1 }},
    {name = "Minor Entity", pos = { x = 884, y = 422, z = 9 , stackpos = 1 }},                
    {name = "Minor Entity", pos = { x = 884, y = 423, z = 9 , stackpos = 1 }},                
    {name = "Minor Entity", pos = { x = 884, y = 424, z = 9 , stackpos = 1 }},                
    {name = "Minor Entity", pos = { x = 884, y = 425, z = 9 , stackpos = 1 }}
}
    
function onStatsChange(cid, attacker, type, combat, value) 
    local monsterHP = getCreatureHealth(cid) / getCreatureMaxHealth(cid)
     
    if(monsterHP <= 80) and getCreatureStorage(cid, 19200) == -1 then
        doTeleportThing(cid, t[cidName].pos1)
        doCreatureSetStorage(cid, 19200, 1)
        doCreateMonster(t[3].name, t[3].pos)
        doCreateMonster(t[4].name, t[4].pos)
        doCreateMonster(t[5].name, t[5].pos)
        doCreateMonster(t[6].name, t[6].pos)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
    elseif(monsterHP <= 70) and getCreatureStorage(cid, 19201) == -1 then
        doCreateMonster(t[2].name, t[2].pos)
        doCreatureSetStorage(cid, 19201, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
    elseif(monsterHP <= 60) and getCreatureStorage(cid, 19202) == -1 then
        doCreatureSetStorage(cid, 19202, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
    elseif(monsterHP <= 50) and getCreatureStorage(cid, 19203) == -1 then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
        doCreatureSetStorage(cid, 19203, 1)        
    elseif(monsterHP <= 40) and getCreatureStorage(cid, 19204) == -1 then
        doCreateMonster(t[1].name, t[1].pos)
        doCreatureSetStorage(cid, 19204, 1)
        doCreateMonster(t[cidName].pos3)
        doCreateMonster(t[cidName].pos4)
        doCreateMonster(t[cidName].pos5)
        doCreateMonster(t[cidName].pos6)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
        doCreatureAddHealth(cidName, 20000)    
    elseif(monsterHP <= 30) and getCreatureStorage(cid, 19205) == -1 then
        doCreateMonster(t[2].name, t[2].pos)
        doCreatureSetStorage(cid, 19205, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)    
    elseif(monsterHP <= 20) and getCreatureStorage(cid, 19206) == -1 then
        doCreatureSetStorage(cid, 19206, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)    
    elseif(monsterHP <= 10) and getCreatureStorage(cid, 19207) == -1 then
        doCreatureSetStorage(cid, 19207, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
    elseif(monsterHP == 0) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)        
    end
end
 
Well, i tryed..
but when i tryed to attack the monster. it gave me an error:
Code:
[16/11/2012 09:13:23] [Error - CreatureScript Interface] 
[16/11/2012 09:13:23] data/creaturescripts/scripts/dungeon/crystalcave/behavior_raijin.lua:onStatsChange
[16/11/2012 09:13:23] Description: 
[16/11/2012 09:13:23] ...ipts/scripts/dungeon/crystalcave/behavior_raijin.lua:14: attempt to index field '?' (a nil value)
[16/11/2012 09:13:23] stack traceback:
[16/11/2012 09:13:23] 	...ipts/scripts/dungeon/crystalcave/behavior_raijin.lua:14: in function <...ipts/scripts/dungeon/crystalcave/behavior_raijin.lua:10>
 
Last edited:
One of the problems you would perhaps know is that if you have a very long spell (wich has 10 seconds of animation or something) and then when he dies, your server will report a shitload of errors.

Who is "he"? The player? The monster?

The spell script, you need to make it verify that the target(or caster) is still alive.
 
I mean the monster.. If the monsters use a spell (wich has 10 seconds of animation or something) and the monsters dies in that 10 seconds.. The server will report a shitload of errors.

The spell will continue its animation and deal damage and whatnot, but the creature id of the monster does not exist (its dead).

You need to edit the spell so when it triggers an animation, that it verify that creature is a monster (if isMonster(cid) doCombat~ )
 
The spell will continue its animation and deal damage and whatnot, but the creature id of the monster does not exist (its dead).

You need to edit the spell so when it triggers an animation, that it verify that creature is a monster (if isMonster(cid) doCombat~ )


Thanks i will try it out, but first the script needs to work..

Well, i tryed..
but when i tryed to attack the monster. it gave me an error:
Code:
[16/11/2012 09:13:23] [Error - CreatureScript Interface] 
[16/11/2012 09:13:23] data/creaturescripts/scripts/dungeon/crystalcave/behavior_raijin.lua:onStatsChange
[16/11/2012 09:13:23] Description: 
[16/11/2012 09:13:23] ...ipts/scripts/dungeon/crystalcave/behavior_raijin.lua:14: attempt to index field '?' (a nil value)
[16/11/2012 09:13:23] stack traceback:
[16/11/2012 09:13:23] 	...ipts/scripts/dungeon/crystalcave/behavior_raijin.lua:14: in function <...ipts/scripts/dungeon/crystalcave/behavior_raijin.lua:10>

Can some one help me with this?

Pasibun
 
Lua:
local t = {
    {name = "Raijin", pos = { x = 884, y = 423, z = 9, stackpos = 1 }},
    {name = "Raijin", pos = { x = 881, y = 423, z = 9 , stackpos = 1 }},
    {name = "Minor Entity", pos = { x = 884, y = 422, z = 9 , stackpos = 1 }},                
    {name = "Minor Entity", pos = { x = 884, y = 423, z = 9 , stackpos = 1 }},                
    {name = "Minor Entity", pos = { x = 884, y = 424, z = 9 , stackpos = 1 }},                
    {name = "Minor Entity", pos = { x = 884, y = 425, z = 9 , stackpos = 1 }}
}
 
function onStatsChange(cid, attacker, type, combat, value) 
    local monsterHP = getCreatureHealth(cid) / getCreatureMaxHealth(cid)
 
    if(monsterHP <= 80) and getCreatureStorage(cid, 19200) == -1 then
        doTeleportThing(cid, t[1].pos)
        doCreatureSetStorage(cid, 19200, 1)
        doCreateMonster(t[3].name, t[3].pos)
        doCreateMonster(t[4].name, t[4].pos)
        doCreateMonster(t[5].name, t[5].pos)
        doCreateMonster(t[6].name, t[6].pos)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
    elseif(monsterHP <= 70) and getCreatureStorage(cid, 19201) == -1 then
        doCreateMonster(t[2].name, t[2].pos)
        doCreatureSetStorage(cid, 19201, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
    elseif(monsterHP <= 60) and getCreatureStorage(cid, 19202) == -1 then
        doCreatureSetStorage(cid, 19202, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
    elseif(monsterHP <= 50) and getCreatureStorage(cid, 19203) == -1 then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
        doCreatureSetStorage(cid, 19203, 1)        
    elseif(monsterHP <= 40) and getCreatureStorage(cid, 19204) == -1 then
        doCreateMonster(t[1].name, t[1].pos)
        doCreatureSetStorage(cid, 19204, 1)
        doCreateMonster(t[cidName].pos3)
        doCreateMonster(t[cidName].pos4)
        doCreateMonster(t[cidName].pos5)
        doCreateMonster(t[cidName].pos6)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
        doCreatureAddHealth(cidName, 20000)    
    elseif(monsterHP <= 30) and getCreatureStorage(cid, 19205) == -1 then
        doCreateMonster(t[2].name, t[2].pos)
        doCreatureSetStorage(cid, 19205, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)    
    elseif(monsterHP <= 20) and getCreatureStorage(cid, 19206) == -1 then
        doCreatureSetStorage(cid, 19206, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)    
    elseif(monsterHP <= 10) and getCreatureStorage(cid, 19207) == -1 then
        doCreatureSetStorage(cid, 19207, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
    elseif(monsterHP == 0) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)        
    end
end
 
Solution
Thanks summ,
I got another question, it is about this part..
Lua:
local monsterHP = getCreatureHealth(cid) / getCreatureMaxHealth(cid)

I want to get the % of the monster.. so if the monster is add 80% health.. he will activate the this part..
Lua:
if(monsterHP <= 80) and getCreatureStorage(cid, 19200) == -1 then
        doTeleportThing(cid, t[1].pos)
        doCreatureSetStorage(cid, 19200, 1)
        doCreateMonster(t[3].name, t[3].pos)
        doCreateMonster(t[4].name, t[4].pos)
        doCreateMonster(t[5].name, t[5].pos)
        doCreateMonster(t[6].name, t[6].pos)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
 
You can turn the order of the if statements around.
By doing check if he is under 10%, 20% first you will get the event you want.
Because if the boss is at 20% he will also fullfil the <= 80% statement.

So either do reverse order (from low hp to high) or do more advanced statements:
if(monsterHP <= 80 and monsterHP > 70) and getCreatureStorage(cid, 19200) == -1 then
 
Yeah but now if you have this part:
Lua:
function onStatsChange(cid, attacker, type, combat, value) 
    local monsterHP = getCreatureHealth(cid) / getCreatureMaxHealth(cid)
Lets say there is a demon, its max health is 8200. currently the demon is at 6650 health.
Using the above code, it will do {getCreatureHealth 6650/ getCreatureMaxHealth 8200 = 0.8109}

So it wont trigger
Lua:
if(monsterHP <= 80) and getCreatureStorage(cid, 19200) == -1 then
        doTeleportThing(cid, t[1].pos)
        doCreatureSetStorage(cid, 19200, 1)
        doCreateMonster(t[3].name, t[3].pos)
        doCreateMonster(t[4].name, t[4].pos)
        doCreateMonster(t[5].name, t[5].pos)
        doCreateMonster(t[6].name, t[6].pos)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
Because here it checks if monsterHP is the lower then or the same as 80.
But as we can see above it shows it results in that 0.8109

I think its a very easy to fix problem, but cant work this out.

Thanks.
 
Then use it in percent:
Lua:
if(monsterHP <= 0.8) and getCreatureStorage(cid, 19200) == -1 then
 
Alright!

I will try it out,

Thanks scarled:)

Pasibun

- - - Updated - - -

Well i tryed like this:
Lua:
local t = {
    {name = "Raijin", pos = { x = 884, y = 423, z = 8, stackpos = 1 }},
    {name = "Raijin", pos = { x = 881, y = 423, z = 8 , stackpos = 1 }},
    {name = "Minor Entity", pos = { x = 884, y = 422, z = 8 , stackpos = 1 }},                
    {name = "Minor Entity", pos = { x = 884, y = 423, z = 8 , stackpos = 1 }},                
    {name = "Minor Entity", pos = { x = 884, y = 424, z = 8 , stackpos = 1 }},                
    {name = "Minor Entity", pos = { x = 884, y = 425, z = 8 , stackpos = 1 }}
}
 
function onStatsChange(cid, attacker, type, combat, value) 
    local monsterHP = getCreatureHealth(cid) / getCreatureMaxHealth(cid)
 
    if(monsterHP <= 0.8) and getCreatureStorage(cid, 19200) == -1 then
        doTeleportThing(cid, t[1].pos)
        doCreatureSetStorage(cid, 19200, 1)
        doCreateMonster(t[3].name, t[3].pos)
        doCreateMonster(t[4].name, t[4].pos)
        doCreateMonster(t[5].name, t[5].pos)
        doCreateMonster(t[6].name, t[6].pos)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
    elseif(monsterHP <= 0.7) and getCreatureStorage(cid, 19201) == -1 then
        doCreateMonster(t[2].name, t[2].pos)
        doCreatureSetStorage(cid, 19201, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
    elseif(monsterHP <= 0.6) and getCreatureStorage(cid, 19202) == -1 then
        doCreatureSetStorage(cid, 19202, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
    elseif(monsterHP <= 0.5) and getCreatureStorage(cid, 19203) == -1 then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
        doCreatureSetStorage(cid, 19203, 1)        
    elseif(monsterHP <= 0.4) and getCreatureStorage(cid, 19204) == -1 then
        doCreateMonster(t[1].name, t[1].pos)
        doCreatureSetStorage(cid, 19204, 1)
        doCreateMonster(t[cidName].pos3)
        doCreateMonster(t[cidName].pos4)
        doCreateMonster(t[cidName].pos5)
        doCreateMonster(t[cidName].pos6)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
        doCreatureAddHealth(cidName, 20000)    
    elseif(monsterHP <= 0.3) and getCreatureStorage(cid, 19205) == -1 then
        doCreateMonster(t[2].name, t[2].pos)
        doCreatureSetStorage(cid, 19205, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)    
    elseif(monsterHP <= 0.2) and getCreatureStorage(cid, 19206) == -1 then
        doCreatureSetStorage(cid, 19206, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)    
    elseif(monsterHP <= 0.1) and getCreatureStorage(cid, 19207) == -1 then
        doCreatureSetStorage(cid, 19207, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
    elseif(monsterHP == 0) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)        
    end 
end return true

Did i placed the return true on the right place?


Pasibun
 
no lol
Lua:
local t = {    {name = "Raijin", pos = { x = 884, y = 423, z = 8, stackpos = 1 }},
    {name = "Raijin", pos = { x = 881, y = 423, z = 8 , stackpos = 1 }},
    {name = "Minor Entity", pos = { x = 884, y = 422, z = 8 , stackpos = 1 }},                
    {name = "Minor Entity", pos = { x = 884, y = 423, z = 8 , stackpos = 1 }},                
    {name = "Minor Entity", pos = { x = 884, y = 424, z = 8 , stackpos = 1 }},                
    {name = "Minor Entity", pos = { x = 884, y = 425, z = 8 , stackpos = 1 }}
}
 
function onStatsChange(cid, attacker, type, combat, value) 
    local monsterHP = getCreatureHealth(cid) / getCreatureMaxHealth(cid)
 
    if(monsterHP <= 0.8) and getCreatureStorage(cid, 19200) == -1 then
        doTeleportThing(cid, t[1].pos)
        doCreatureSetStorage(cid, 19200, 1)
        doCreateMonster(t[3].name, t[3].pos)
        doCreateMonster(t[4].name, t[4].pos)
        doCreateMonster(t[5].name, t[5].pos)
        doCreateMonster(t[6].name, t[6].pos)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
    elseif(monsterHP <= 0.7) and getCreatureStorage(cid, 19201) == -1 then
        doCreateMonster(t[2].name, t[2].pos)
        doCreatureSetStorage(cid, 19201, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
    elseif(monsterHP <= 0.6) and getCreatureStorage(cid, 19202) == -1 then
        doCreatureSetStorage(cid, 19202, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
    elseif(monsterHP <= 0.5) and getCreatureStorage(cid, 19203) == -1 then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
        doCreatureSetStorage(cid, 19203, 1)        
    elseif(monsterHP <= 0.4) and getCreatureStorage(cid, 19204) == -1 then
        doCreateMonster(t[1].name, t[1].pos)
        doCreatureSetStorage(cid, 19204, 1)
        doCreateMonster(t[cidName].pos3)
        doCreateMonster(t[cidName].pos4)
        doCreateMonster(t[cidName].pos5)
        doCreateMonster(t[cidName].pos6)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
        doCreatureAddHealth(cidName, 20000)    
    elseif(monsterHP <= 0.3) and getCreatureStorage(cid, 19205) == -1 then
        doCreateMonster(t[2].name, t[2].pos)
        doCreatureSetStorage(cid, 19205, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)    
    elseif(monsterHP <= 0.2) and getCreatureStorage(cid, 19206) == -1 then
        doCreatureSetStorage(cid, 19206, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)    
    elseif(monsterHP <= 0.1) and getCreatureStorage(cid, 19207) == -1 then
        doCreatureSetStorage(cid, 19207, 1)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)
    elseif(monsterHP == 0) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_BLUE)        
    end
    return true
end
 
Thanks, its working.. well the part that the monster loses Health..

Now when the monster is on 80% so..
Lua:
if(monsterHP <= 0.8)
then the console crashed..

Some one a idea?

Pasibun
 
I dont know. Got tips for me so I can figure this henceforth not having to ask about it.

In this case it can be replaced with global storage value right?
 
Back
Top