Author Topic: [fixed] setUnitPosition crash  (Read 1096 times)

treba

  • Guest
[fixed] setUnitPosition crash
« on: 11 October 2012, 11:39:36 »
hey

i found some more bugs concerning setUnitPosition.
i'm trying to use it as a escape skill for a hero.
the hero summons a dummy size-zero unit to trigger an unitCreatedOfType event.
the content of that reads as follows:
Code: [Select]
if unitFaction(lastCreatedUnit()) == 0 then
   setUnitPosition(variable_hero_1,{(startLocation(unitFaction(lastCreatedUnit()))[1] + 3), (startLocation(unitFaction(lastCreatedUnit()))[2] + 3)})
end
destroyUnit(lastCreatedUnit())
so nothing special so far.

now the wierd stuff starts:
  • the units which surrounded my hero before he escaped using the summon skill stay visible, although being in the fog of war
  • they all turned around in the new direction of my hero, attacking the air in front of them
  • after some time like 10-30 second, i'm not sure yet what has to happen, the game crashes
Code: [Select]
[2012-10-11 13:36:51] *ERROR* In [game.cpp::update Line: 1762] Error [trying to move into occupied cell and field]

EDIT: actually, the error given above happens because the teleported unit gets killed by the units hitting the air.
they don't do any damage after the teleport as long as the teleported unit doesn't get any new commands. as soon as it gets one (also when it spots an enemy for example), it's recieving damage again.
« Last Edit: 14 October 2012, 18:10:51 by softcoder »

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: setUnitPosition crash
« Reply #1 on: 11 October 2012, 14:23:56 »
Try svn again, i added more details for that error.

treba

  • Guest
Re: setUnitPosition crash
« Reply #2 on: 12 October 2012, 12:04:20 »
Code: [Select]
*ERROR* In [game.cpp::update Line: 1764] Error [Trying to move unit [300005 - swordman] into occupied cell [x [97] y [23]] and field = 0, unit already in cell [9 - archmage_level_1] ]

well that's wierd, the archmage is dead by that time. and was far away before.

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: setUnitPosition crash
« Reply #3 on: 12 October 2012, 14:02:03 »
Try calling:

isUnitAlive for the archmage and check. He must not be dead if you are getting this error.

treba

  • Guest
Re: setUnitPosition crash
« Reply #4 on: 12 October 2012, 15:41:10 »
well, as explained above, he's losing hp and dies, with death animation. i watched that a couple of times now.

should i upload the scenario so you can test it yourself?

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: setUnitPosition crash
« Reply #5 on: 12 October 2012, 15:52:02 »
Sure

treba

  • Guest
Re: setUnitPosition crash
« Reply #6 on: 12 October 2012, 16:52:00 »
http://dl.dropbox.com/u/56789020/Swordman_Frenzy.7z

steps to reproduce:
  • build an archmage in the tower
  • move it into one of the enemy bases to get attacked
  • click on the teleport button (has a tower on it)
  • when the archmage is back, give it one more commands
« Last Edit: 12 October 2012, 17:01:45 by treba »

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: setUnitPosition crash
« Reply #7 on: 12 October 2012, 21:50:16 »
This was a bug in setUnitPosition(). Svn has it fixed now, thanks

titi_son

  • Draco Rider
  • *****
  • Posts: 283
  • titi_son
    • View Profile
Re: setUnitPosition crash
« Reply #8 on: 14 October 2012, 08:39:46 »
Mark as fixed?  :D
My first Tilseset: SPRING :) (included in Megaglest )

Secret Hint: To play online join the IRC #megaglest-lobby on freenode which is the lobby chat ingame. So you can chat with or wait for people in the lobby without running megaglest all the time.

 

anything