HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

First Trigger

02-01-2006, 08:36 PM#1
Orc Dork
This is my first trigger to bare with me. I am going to make a map similar to the Mytheoda games in Age of Mythology and decided to make a trigger to buy units. This is what I came up with. I made a region that is the center of 4 custom towers called Purchase Water Element Lv3 (400 gold). When a unit enters it subtracts 400 gold from the player and kills the unit. This region is Region <001> in the trigger I think. Well here is the script. Feedback please.

Trigger:
Water Elemental Towers
Collapse Events
Unit - A unit enters Region 001 <gen>
Collapse Conditions
((Triggering unit) is A Hero) Not equal to True
(Unit-type of (Triggering unit)) Not equal to Water Elemental (Level 3)
Collapse Actions
Unit - Create 1 Water Elemental (Level 3) for (Owner of (Triggering unit)) at (Center of Region 001 <gen>) facing Default building facing degrees
Wait 2.00 seconds
Unit - Kill (Triggering unit)
Player - Set (Owner of (Triggering unit)) Current gold to (((Owner of (Triggering unit)) Current gold) - 400)

Yes I know, I am still using the newb GUI based scripting....
02-01-2006, 09:09 PM#2
Murder1833
Meh, looks like it would work.

Btw, naming your regions really helps, makes it all organized and shiat
02-01-2006, 09:16 PM#3
junithorn !
Maybe make the unit die first, would make more sense I think.
Also you might want a condition that requires them to have 400 gold in the first place.
02-01-2006, 11:13 PM#4
Orc Dork
good idea, thanks a lot you two
02-02-2006, 01:12 AM#5
Murder1833
Np. Btw, making it spawn in a different region would get rid of the condition for not being a water element. Also, you can have it a closed off area, using blockades around the whole area against everything. And, to remove all conditions, first off, have the unit respawn in the middle of your buy area after entering the area. Then you can remove all conditions. I'll concoct a sample map now.

Edit: I just noticed a few of bugs in your trigger, I'll let you see it in my trigger then tell ya later.

Edit2: Uploaded map. Ok, your bugs, it would be a WHOLE lot more efficent to use entering unit instead of triggering unit. Works better. Test the map then you can use the trigger, to see if you like it. Btw, either add more pathing blockers on top or on bottom so that that the units can't be attacked, OR make the buying unit invincible.
Attached Files
File type: w3xBuyTrigger.w3x (15.1 KB)
02-02-2006, 04:05 AM#6
Das Jank
Your problem with the trigger is the when you use a "Wait -" command, the trigger forgets all of the information after it like "triggering unit" "units entering region" and so forth. If you really need the wait in the trigger then you need to start out the action by setting a variable equal to the triggering unit. From what it looks like though, that wait in your trigger isnt needed and could potentially cause problems (say if you send a unit onto the location and then sent all your gold to another play at the same instant after he walked on).

Another problem with your trigger is that you have no condition checking if the player has the 400 gold in the first place. How it is set up now will give the player the water elemental even if they had 0 gold and then try to subtract 400 which would just cancel out.


Edit: My bad, thats just what I was told back in the day and never learned different, thanks for the update Anitarf, will prob save me some time.
02-02-2006, 07:42 AM#7
Anitarf
Quote:
Originally Posted by Das Jank
Your problem with the trigger is the when you use a "Wait -" command, the trigger forgets all of the information after it like "triggering unit" "units entering region" and so forth. If you really need the wait in the trigger then you need to start out the action by setting a variable equal to the triggering unit. From what it looks like though, that wait in your trigger isnt needed and could potentially cause problems (say if you send a unit onto the location and then sent all your gold to another play at the same instant after he walked on).
Wrong, WRONG! That is only the case with cast event responses, because they are bugged. Other event responses are, as far as I know, all trigger specific, so each trigger has it's own values and even if another trigger runs while this one waits, they will still be the same for this one. The same is not true for global variables, which you suggest he uses. Those would get forgotten during a wait.

Murder1883: Actually, "triggering unit" is more efficient than any specific event response, like "entering unit", "dying unit"... It is especialy useful for replacing the bugged "casting unit".
02-02-2006, 09:47 PM#8
Murder1833
Meh, thats not what I learned. W/e. But if you have multiple conditions such as, unit enter region + unit dies, continuing with your trigger, you may need entering, dying, attacking unit to seperate stuff. But ok I see your point.
02-03-2006, 05:27 AM#9
PCPharaoh
I could be wrong, but my understanding was that only Triggering Unit is trigger specific. All other event responses get lost when they are reassigned.

Anyway, maybe I'll run some tests later, but I'm too tired at the moment. :P
02-03-2006, 01:09 PM#10
Vexorian
Triggering unit and most event responses are not only trigger specific but thread specific.