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

[Not Solved] doSummonCreature -- Crash Server 0.3.7

  • Thread starter Thread starter Xikini
  • Start date Start date
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 :rolleyes:

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
Thanks,

Xikini
 
Unsure of the reason why, but the command for summon/create creature inside of the function onStatsChange in 0.3.7 simply crashes the server.
I ended up creating a decent work-around for what I needed it for, but meh.
Here's my janky workaround.

If anyone has any idea, I'll be glad to test it, otherwise I'm marking the thread as [Not Solved] and moving on.
 
Back
Top