- Joined
- Aug 7, 2013
- Messages
- 1,338
Hi,
So apparently if a unit is created at location which is outside the map bounds, it crashes?
Or is the proper term that the thread where it came from crashes? I've got a trigger that picks a random point around a unit and creates a unit at the point (random point on a circle). Never once did my game crash...I would have expected at some point a unit would be attempted to be created out of bounds.
So if it's being done its own thread, is it even necessary to check world bounds on the point? If it crashes the thread, then it crashes. Or would it leak a unit reference?
I've got WorldBounds library though, so I suppose I should add that in as an additional check when generating a random location?
Second part of the question: What about creating a unit on terrain that isn't walkable, e.g. a land unit being spawned on a location in the water, or in a boundary area (that's still inside the world bounds).
What happens in that case? Does the unit instance still exist? Does it crash the thread, or will code continue to execute?
So apparently if a unit is created at location which is outside the map bounds, it crashes?
Or is the proper term that the thread where it came from crashes? I've got a trigger that picks a random point around a unit and creates a unit at the point (random point on a circle). Never once did my game crash...I would have expected at some point a unit would be attempted to be created out of bounds.
So if it's being done its own thread, is it even necessary to check world bounds on the point? If it crashes the thread, then it crashes. Or would it leak a unit reference?
I've got WorldBounds library though, so I suppose I should add that in as an additional check when generating a random location?
Second part of the question: What about creating a unit on terrain that isn't walkable, e.g. a land unit being spawned on a location in the water, or in a boundary area (that's still inside the world bounds).
What happens in that case? Does the unit instance still exist? Does it crash the thread, or will code continue to execute?
JASS:
local unit u = CreateUnitAtLoc('Hpal', ..., waterLoc, ...)
//what happens now? what does u point to?
//will the following code run properly?
call SetHeroLevel(u, 100, true)
//will I see the unit level up at the waterLoc?
call SetUnitLoc(u, myLoc)
//will the unit appear suddenly at this loc?