HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Select Your Enemy System woes

11-19-2003, 09:00 PM#1
Toxicseaweed
I'm working on this hopefully 2 or 3 triggers that will allow you to select a target for your attack. This isn't a turn based battle system. what you do here is when you get close enough. It will tell you that you have detected enemies. Then if you hit the up/down key it will toggle through the enemies highlighting them for you. I'm making this to make play in the 3rd person cam's just a little simplier. So far i have a basic version to test out the whole system but i'm having a problem. i wonder if it keeps adding the same unit. Because whenever i hit up enough no unit is selected *that okay i'll change that when polishing the trigger* but it only selects ONE of the two units i placed next to eachother. I can make it so when the unit dies it clears the variable thats fine. But i want to know why it won't select the other unit. I'm wondering if its the loop, i know that i need to loop in order to set which array slot the unit is in. Plz Plz help me solve this. If you don't under stand ask questions, i'll send the triggers if ya need. Heres the triggers.AddUnitsToSelection
Events
Time - Every 0.40 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in (Units within 512.00 of (Position of Paladin 0000 <gen>) matching (((Triggering unit) belongs to an enemy of (Owner of Paladin 0000 <gen>)) Equal to True)) and do (Actions)
Loop - Actions
For each (Integer A) from 0 to (Number of units in (Units within 512.00 of (Position of Paladin 0000 <gen>) matching (((Triggering unit) belongs to an enemy of Player 1 (Red)) Equal to True))), do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
SelectedUnit[(Integer A)] Equal to No unit
(Owner of (Picked unit)) Not equal to Player 1 (Red)
Then - Actions
Game - Display to Player 1 (Red), at offset (0.00, 0.00) the text: Adding Unit Remove ...
Set SelectedUnit[(Integer A)] = (Picked unit)
Unit Group - Add SelectedUnit[(Integer A)] to UnitsInArea[1]
Set MaxUnitValue = (MaxUnitValue + 1)
Else - Actions
Do nothing
--------------------------------------------------------------------------------------------
SelectUnitsInRange
Events
Player - Player 1 (Red) Presses the Up Arrow key
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
SelectedUnitNumber Greater than MaxUnitValue
Then - Actions
Set SelectedUnitNumber = 0
Else - Actions
Special Effect - Destroy Pointer
Set SelectedUnitNumber = (SelectedUnitNumber + 1)
Selection - Select SelectedUnit[SelectedUnitNumber] for Player 1 (Red)
Special Effect - Create a special effect attached to the origin of SelectedUnit[SelectedUnitNumber] using buildings\other\CircleOfPower\CircleOfPower.mdl
Set Pointer = (Last created special effect)
11-19-2003, 10:39 PM#2
Toxicseaweed
no ideas. I've tried this before and it didn't work but this time i think the system is more efficniant.