X
Xikini
Guest
TFS 0.3.7
Anytime I use this command inside of this script it crashes the server..
However.. 1/20 times.. roughly.. it won't crash the server.
I'll think I fixed the problem, then I will restart the server, and it crashes again, without changing anything in the code. haha
Can anyone see where it might be going wrong? I've tried countless variations on the same function, I've green-texted a few I've tried with success, but then crashed server after next restart. -shrugs-
Something to note, it works perfectly if I take out the doSummonCreature.
Thanks,
Xikini
Anytime I use this command inside of this script it crashes the server..
However.. 1/20 times.. roughly.. it won't crash the server.
I'll think I fixed the problem, then I will restart the server, and it crashes again, without changing anything in the code. haha
Can anyone see where it might be going wrong? I've tried countless variations on the same function, I've green-texted a few I've tried with success, but then crashed server after next restart. -shrugs-
Something to note, it works perfectly if I take out the doSummonCreature.
Code:
function onStatsChange(cid, attacker, type, combat, value)
if (getCreatureName(cid) == "Cave Rat") then
print (1)
if (type == STATSCHANGE_HEALTHLOSS) then
print (2)
if getGlobalStorageValue(45559) < 1 then
print (3)
if getCreatureHealth(cid) < getCreatureMaxHealth(cid)/2 then
print (4)
--doCreateMonster("Rat", getCreaturePosition(cid))
--doSummonMonster("Rat", getCreaturePosition(cid))
--doSummonCreature("Rat", getCreaturePosition(cid))
--doSummonCreature("Rat", getClosestFreeTile(cid, getCreaturePosition(cid)))
setGlobalStorageValue(45559, 1)
end
else
if getGlobalStorageValue(45559) == 1 then
print (5)
if getCreatureHealth(cid) > getCreatureMaxHealth(cid)/2 then
print (6)
setGlobalStorageValue(45559, -1)
end
end
end
end
end
return true
end
Xikini