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

Unselectable unit but selectable with triggers - Part 2

Status
Not open for further replies.
Level 20
Joined
Nov 20, 2005
Messages
1,178
I know there was a thread about 12 years ago but it didn't quite explain it, and mine is a slightly different case:
I'm using the Arcane Build and Forgotten Build effects to create a dummy effect for a custom subrace with undead-type warping buildings.
With the Arcane Build animation everything is ok; The "effect unit" can't be selected and it goes off when the building is finished, but the same doesn't happen with the Forgotten Build model, and that's where the problem is. It can be selected and thus gets the priority over the constructing structure.
I need to turn it unselectable for the user but still selectable by triggers in order to remove it at the completion of its corresponding building construction. Anyone can help me, please?
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
link them together.

I usually use bribe's unit indexer for this so I can keep track of all units. It assigns a unique integer as the custom value of each unit. There are other ways to keep track of units, but this is what I have been using:


create a unit array, lets say DummyBuilder[]


when you build the building, set the dummy as DummyBuilder[custom value of the building]


- now when you use the trigger to catch the event of the building being cancelled -

set CV = custom value of triggering unit (or whatever the building is called in this trigger).

remove DummyBuilder[CV]


that should do it.



Edit: - I didn't mean you need to create the array each time. you just need to create that array once. I fixed this in the post now.
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
It's really simple - An array is just a bunch of that kind of variable.

in an integer variable (x) I can save one integer value. so I can set x = whatever integer I want. lets say I saved 5.

an integer array is just a bunch of integers. lets say I use them to save the numbers 5,17, and 8.

in GUI this would look like:

x[0] = 5
x[1]=17
x[2]= 8

the square brackets represent the index. and arrays start from index zero.

good luck!
 
Level 20
Joined
Nov 20, 2005
Messages
1,178
In this testmap, you'll see a goblin merchant that is unselectable but works normally as what it should besides buying items from it. Triggers can interact with it like any other unit.
So what i'm seeing here you're constantly giving it looped effects. Wait, did i say "effects"? I just had an idea....
EDIT: nuff said.
So how do i make it unselectable without making it look like a disco the way you did?
I mean in your case i can see an array of [1] after GetUnit, but how if there are multiple structures constructing at the same way and i need to take off the dummy unit effect if they finish OR get canceled/destroyed?
EDIT2: Ok i solved this by forcing the player to select what's right underneath the dummy unit. Works ok. Thank you both for the help.
 
Last edited:
Status
Not open for further replies.
Top