HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Need Help with Simple Triggers

06-05-2004, 12:50 PM#1
desty
hey all,
I'm working on a trigger which allows a unit to control other units by first taking control over them with a spell, and then making these persons fire in a region.

Take Control
---------------------------
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Command
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Custom value of (Triggering unit)) Equal to 0
Then - Actions
Set TempRandomNumber = (Random integer number between 1 and 100000000)
Else - Actions
Set TempRandomNumber = (Custom value of (Triggering unit))
Unit - Set the custom value of (Triggering unit) to TempRandomNumber
Unit Group - Pick every unit in (Units in (Region centered at (Target point of ability being cast) with size (200.00, 200.00)) owned by (Owner of (Triggering unit))) and do (Actions)
Loop - Actions
Unit - Set the custom value of (Picked unit) to TempRandomNumber

Fire
---------------------
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Fire
Actions
Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) matching ((Custom value of (Picked unit)) Equal to (Custom value of (Triggering unit)))) and do (Actions)
Loop - Actions
Unit - Order (Picked unit) to Attack (Random unit from (Units in (Region centered at (Target point of ability being cast) with size (200.00, 200.00))))
---------------------------------------------

Basicly, it sets the commanding unit with the same custom value as the units it commands. When the commanding unit orders a Fire, the commanded units should fire on units in that region.

This doesn't work at all, I don't understand why. Nothing happens.
Any Ideas?

DeSty
06-05-2004, 01:08 PM#2
Shimrra
Well, first, when you post code, put it between a (code)(/code) with the parenthesis replaced with brackets []. THis will make the code easier to read.

For your question, in your matching condition part, use (Matching Unit) rather then (Picked Unit). Also, try: "Order (Picked Unit) to Attack Move to (Target point of Ability being cast)" This way they will attack everything along the way the point. In the first trigger, why use a unit group? I'm assuming you are using Charm as your base spell, but that only effects the unit you taget... Are you trying to make it AOE?
06-05-2004, 01:54 PM#3
desty
Yes, it is an AOE, I'm using for Command: Dispel Magic, and for Fire: Blizzard.
The commanding unit should be able to take several units at a time. I'll try both your suggestions, thanks.

desty
06-05-2004, 02:26 PM#4
Shimrra
Then the "Unit Group - Pick every unit in (Units in (Region centered at (Target point of ability being cast) with size (200.00, 200.00)) owned by (Owner of (Triggering unit)))" will not work, because you have to do something to give the units to the owner of the caster. Otherwise, they will remain owned by whoever did before. Also, for the custom value, just set the variable equal to itself plus one. It will enusre that the same number is not chosen twice by some strange twist of fate.