Does the Wait action (for timer or just normal timed wait) supposed to be broken?
When I use it it will not execute anything I want after it. of course, it does run the destroy timer window action... for some weird reason. Is there a special secret about waiting for timers to finish to do stuff I should know about?
Just a note here, the problem usually is just an error when I try to run ANYTHING except destroy timer window after the timer runs out. In this specific case though, It actually trys to create the unit and errors saying parameters are out of bounds. The code works fine without the WAIT. I was thinking maybe after 20 seconds It doesn't know the location of the dead unit anymore? So I created a var to hold the location while the timer ran out, then realized that I don't think there is a var type of location. I may be wrong, could someone please correct me?
when you refer to a unit dying in a trigger, if your going to refer to it AFTER a wait has happened, save everything you need into a variable beforehand
i ran into this problem yesterday, when i try to get the owner of a dead unit after a 2 second wait, it always just returned player 16 (which of course will always error the "Unit Create" action), but before the wait it returned the correct player.
I don't think you read my post thoroughly. I said I don't know why the problem is happening. I also said, I THINK it may be that the location is not saving for the dead unit. I also said there is no variable to save location, unless I am missing it..
What I need to accomplish: If any photon cannon dies, it should respawn in 30 seconds, It should respawn in the exact same location and it should belong to it's original owner.
I was hoping I could do this without storing each and every photon cannon and it's original owner on record, but it looks like I may have to. There is still also the problem of not being able to save the location of the photon cannon to a variable
You dont have to store each cannon and its owner - you need two local variables, point and integer. before the wait action, set the variables to owner of unit (triggering unit) and (triggering player), and then refer to those variables after the wait instead of Triggering unit/player (EventUnit and w/e it's in galaxy).
The local variables exist only while the trigger is running and only for that single instance of the trigger, so additional cannons dying before the first is respawned won't cause any problems with the variable.
Thanks for the detailed explanation, although I do know how it works :). Your saying you can save a units location to a point var?
btw, I need to know the owner of the original turret, not the owner of the turret when it dies, it may change owner at any given time. the problem is i need it to go back to neutral if it was neutral at the start of the game.
EDIT: Alright, great it works. The problem I was having is I couldn't find a var type that held locations. I thought Points only held points. I guess technically points are just locations.. don't know why I didn't think of that.
Now I just have to figure out how to get the turrets to save their original owners.
I figured the easiest way to have the turrets save their original owners was to make another instance of the turret unit with a different name. Unfortunately it either makes a completely new unit with no info, or it makes a replica of the current unit but it changes the names on everything to "Copy" or "2" so it breaks every single thing it is linked to.
Oh and figure out how to get neutral turrets to appear unpowered
Does the Wait action (for timer or just normal timed wait) supposed to be broken?
When I use it it will not execute anything I want after it. of course, it does run the destroy timer window action... for some weird reason. Is there a special secret about waiting for timers to finish to do stuff I should know about?
Post generated code.
Just a note here, the problem usually is just an error when I try to run ANYTHING except destroy timer window after the timer runs out. In this specific case though, It actually trys to create the unit and errors saying parameters are out of bounds. The code works fine without the WAIT. I was thinking maybe after 20 seconds It doesn't know the location of the dead unit anymore? So I created a var to hold the location while the timer ran out, then realized that I don't think there is a var type of location. I may be wrong, could someone please correct me?
Just FYI respawning can be done with a behavior.
Anyways it looks like you're running into a race condition, save the value of EventUnit before putting the thread to sleep.
Could you explain how to respawn using behavior? These respawn timers are one of the 3 big things holding me back.
when you refer to a unit dying in a trigger, if your going to refer to it AFTER a wait has happened, save everything you need into a variable beforehand
i ran into this problem yesterday, when i try to get the owner of a dead unit after a 2 second wait, it always just returned player 16 (which of course will always error the "Unit Create" action), but before the wait it returned the correct player.
@LinkD: Go
I don't think you read my post thoroughly. I said I don't know why the problem is happening. I also said, I THINK it may be that the location is not saving for the dead unit. I also said there is no variable to save location, unless I am missing it..
What I need to accomplish: If any photon cannon dies, it should respawn in 30 seconds, It should respawn in the exact same location and it should belong to it's original owner.
I was hoping I could do this without storing each and every photon cannon and it's original owner on record, but it looks like I may have to. There is still also the problem of not being able to save the location of the photon cannon to a variable
You dont have to store each cannon and its owner - you need two local variables, point and integer. before the wait action, set the variables to owner of unit (triggering unit) and (triggering player), and then refer to those variables after the wait instead of Triggering unit/player (EventUnit and w/e it's in galaxy).
The local variables exist only while the trigger is running and only for that single instance of the trigger, so additional cannons dying before the first is respawned won't cause any problems with the variable.
@TheAlmaity: Go
Thanks for the detailed explanation, although I do know how it works :). Your saying you can save a units location to a point var?
btw, I need to know the owner of the original turret, not the owner of the turret when it dies, it may change owner at any given time. the problem is i need it to go back to neutral if it was neutral at the start of the game.
EDIT: Alright, great it works. The problem I was having is I couldn't find a var type that held locations. I thought Points only held points. I guess technically points are just locations.. don't know why I didn't think of that.
Now I just have to figure out how to get the turrets to save their original owners.
I figured the easiest way to have the turrets save their original owners was to make another instance of the turret unit with a different name. Unfortunately it either makes a completely new unit with no info, or it makes a replica of the current unit but it changes the names on everything to "Copy" or "2" so it breaks every single thing it is linked to.
Oh and figure out how to get neutral turrets to appear unpowered