HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Gold Mines and Unit Arrays

01-12-2005, 11:48 PM#1
j1mmmy
New problem, see newest post. Please help.
Hi

I've got a problem with Gold Mines and Entangled Gold Mines and some Triggers. Basically what I want to do is have a unit variable be transfered from the original Gold Mine to a new entangled gold mine.

I have an array of units. When the game starts these are assigned to the gold mines. When they are selected, a trigger is run which checks if the unit is one of the units in the array. If it is it uses the Index of the unit array as the index of another array (of strings) to find the name of the unit. Then the game shows the name to that player. For example "North Gold Mine".

But what happens when the unit is entangled the gold mine clearly isnt part of the array (At least as far as I can tell). I've found that the entangle ability doesn't create any results on the Cast/Channel/Effect Ability events and the only way to get a result is through the method below.

Event:
Unit begins Construction
Condition:
Unit type is Entangled Gold Mine

So far I haven't figured out a method by which I can make the entangled gold mine replace the normal gold mine in the unit array (I feel I'm missing something simple, but I can't put my finger on what exactly...), does anyone have any thoughts or ideas on how to make this work?
01-12-2005, 11:59 PM#2
Guest
Quote:
Originally Posted by j1mmmy
Hi

I've got a problem with Gold Mines and Entangled Gold Mines and some Triggers. Basically what I want to do is have a unit variable be transfered from the original Gold Mine to a new entangled gold mine.

I have an array of units. When the game starts these are assigned to the gold mines. When they are selected, a trigger is run which checks if the unit is one of the units in the array. If it is it uses the Index of the unit array as the index of another array (of strings) to find the name of the unit. Then the game shows the name to that player. For example "North Gold Mine".

But what happens when the unit is entangled the gold mine clearly isnt part of the array (At least as far as I can tell). I've found that the entangle ability doesn't create any results on the Cast/Channel/Effect Ability events and the only way to get a result is through the method below.

Event:
Unit begins Construction
Condition:
Unit type is Entangled Gold Mine

So far I haven't figured out a method by which I can make the entangled gold mine replace the normal gold mine in the unit array (I feel I'm missing something simple, but I can't put my finger on what exactly...), does anyone have any thoughts or ideas on how to make this work?

OK, getting tired here, so I'm not exactly at my sharpest - but isn't an entangled gold mine a unit in its own right? So wouldn't you have to store the entangled gold mines as the entangled gold mine unit in the array?

I'm guess I'm still not exactly sure as to what you're trying to do, since there may be alternative workarounds. For example, I'm guessing that only certain gold mines are entangled, but is the entangling on random gold mines each game; and are the gold mine locations fixed, or also randomly placed. If they are fixed, there can be a workaround...
01-13-2005, 12:41 AM#3
j1mmmy
Quote:
Originally Posted by RogueKnight
OK, getting tired here, so I'm not exactly at my sharpest - but isn't an entangled gold mine a unit in its own right? So wouldn't you have to store the entangled gold mines as the entangled gold mine unit in the array?
Yes, that's right the Entangled gold mine is a seperate unit.
I want to replace the normal gold mine in the unit array with the Entangled gold mine.

Quote:
Originally Posted by RogueKnight
I'm guess I'm still not exactly sure as to what you're trying to do, since there may be alternative workarounds. For example, I'm guessing that only certain gold mines are entangled, but is the entangling on random gold mines each game; and are the gold mine locations fixed, or also randomly placed. If they are fixed, there can be a workaround...
At the start of the game, a trigger is run which replaces every gold mine with a gold mine (Of the same type), after replacing it adds that unit into the array and then increases the index by one so the next replaced gold mine goes into the next array slot and so on.

The player can entangle any gold mine he or she wants to. I'm sure there must be some way by which when the Entangled Gold Mine starts building I can find what it's being built on and then add the Entangled Gold Mine into the array in the place of the original mine.
01-13-2005, 01:07 AM#4
Guest
Quote:
Originally Posted by j1mmmy
Yes, that's right the Entangled gold mine is a seperate unit.
I want to replace the normal gold mine in the unit array with the Entangled gold mine.


At the start of the game, a trigger is run which replaces every gold mine with a gold mine (Of the same type), after replacing it adds that unit into the array and then increases the index by one so the next replaced gold mine goes into the next array slot and so on.

The player can entangle any gold mine he or she wants to. I'm sure there must be some way by which when the Entangled Gold Mine starts building I can find what it's being built on and then add the Entangled Gold Mine into the array in the place of the original mine.


All I can say at this point, since I'm not sitting with WE in front of me, is that the entangling process as done by the Tree of Life is an "order targeting a unit" - perhaps you can detect for that. The only problem that I so far forsee in such a process is what would happen if the entangled gold mine (or entangling gold mine) is destroyed...I'll be back later, and maybe I will have had a look at this problem with WE in front of me...
01-13-2005, 01:49 AM#5
j1mmmy
It works!

Quote:
Originally Posted by RogueKnight
All I can say at this point, since I'm not sitting with WE in front of me, is that the entangling process as done by the Tree of Life is an "order targeting a unit" - perhaps you can detect for that.
It is,You can, I did, it worked. Thank you, I'd give you reputation for thinking more laterally than I did but I believe I need more posts, when I get them I'll do give you some.

Quote:
Originally Posted by RogueKnight
The only problem that I so far forsee in such a process is what would happen if the entangled gold mine (or entangling gold mine) is destroyed...I'll be back later, and maybe I will have had a look at this problem with WE in front of me...
I think if I just set up similar events for unit death to reset it to normal then I'm in business. Thanks, again.
01-13-2005, 12:13 PM#6
j1mmmy
Aghhhhh....New problem.

That still works fine (Thanks again) but I'm working on a trigger which replicates the effects of the Night Elf mines being entangled at the start of the game (I'm using modified mines and other buildings with the entangle ability). It works, but only for one player. I'm using '//' to explain things here (ala comments in coding).

For (Int A) from 1 to 16, do (actions) //To represent players
game text say int A //For debug
Pick 1 random unit from units within 700 of Player Number (Int A)'s start pos
Set temp_unit = picked unit //Temp unit storage
Game text say "found goldmine"//We found a gold mine
Pick every unit in units owned by player number (Int A) of type Tree of Life// Different in mine, I'm using that as example
order picked unit to instant entangle temp_unit
game text say "entangled"

What happens is the mine for player 1 is entangled, it prints 1 (Int A's value), found goldmine and entangled. It doesn't print 2 or entangle anything else. Somehow it doesn't seem to get out of that loop or go onto number 2 in the for loop. Any thoughts on why this is happening?
01-14-2005, 12:34 AM#7
j1mmmy
Aghhhhh....New problem.

That still works fine (Thanks again) but I'm working on a trigger which replicates the effects of the Night Elf mines being entangled at the start of the game (I'm using modified mines and other buildings with the entangle ability). It works, but only for one player. I'm using '//' to explain things here (ala comments in coding).

For (Int A) from 1 to 16, do (actions) //To represent players
game text say int A //For debug
Pick 1 random unit from units within 700 of Player Number (Int A)'s start pos
Set temp_unit = picked unit //Temp unit storage
Game text say "found goldmine"//We found a gold mine
Pick every unit in units owned by player number (Int A) of type Tree of Life// Different in mine, I'm using that as example
order picked unit to instant entangle temp_unit
game text say "entangled"

What happens is the mine for player 1 is entangled, it prints 1 (Int A's value), found goldmine and entangled. It doesn't print 2 or entangle anything else. Somehow it doesn't seem to get out of that loop or go onto number 2 in the for loop. Any thoughts on why this is happening? I really need to fix this problem.