• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Set Point Variable to Another Variable not working.

Status
Not open for further replies.
Level 3
Joined
Jul 28, 2014
Messages
29
So I set Variable A = center of region.
Then I set Variable B = Variable A
Then I Call Remove Variable A.

Now in a seperate trigger later on I create 1 unit at Variable B. But it doesn't seem to work unless I delete the Call Remove Variable A Script.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,180
Now in a seperate trigger later on I create 1 unit at Variable B. But it doesn't seem to work unless I delete the Call Remove Variable A Script.
Yes that is because you destroyed the location object. The variables are effectively pointers to objects. When you assign one to the other you are setting it to point at the same object. If one destroys that object, then both variables will still point at a destroyed object. The solution is to only destroy the object once the object is no longer useful, such as when the last pointer value to it is about to be overwritten.

Technically the value stored by the variables are handles. This is different from a direct pointer due to extra indirection but effectively the same concepts apply as far as object management goes.
 
Level 3
Joined
Jul 28, 2014
Messages
29
Ah that makes since thanks.
I'll try using a dummy unit instead of variable B.
Both variables are in a loop so I can't get away with not removing variable A in the loop. Variable B is an array however.
 
Level 3
Joined
Jul 28, 2014
Messages
29
Thank you, oh ok so the variables are a way of linking the trigger to the object. In the loop I have variable A as a point, say variable C, with offset, the offset is "loop Integer A" x arithmetic math stuffs.

Alright now I got another unrelated question.
Using the trigger "add unit to marketplace" I am unable to use the Hotkey to buy the unit, also the color codex for it's tooltip basic won't change color. ln doesn't work ether. But only if added through triggers.
 
Level 3
Joined
Jul 28, 2014
Messages
29
That's a known bug, IIRC, there's no actual fix for that.

Soo is there anykinda work around. How my map works, its a TD with new units sold each wave, So I could swap out buildings after each wave through triggers but there's 50 waves.

Like is there any kinda trigger,
Event: player 1 red presses "Q" button
Cond: Player 1 red Unit selected, shop
Action: Order shop to Sell unit "X"

Like keys only include arrow keys and I can't find the right action trigger.
 
Status
Not open for further replies.
Top