• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Question About condtions.

Status
Not open for further replies.
Level 12
Joined
Feb 23, 2008
Messages
587
Trigger
Event- if a unit gets with in 30 units of PlayersTrains[0]
Event- if a unit gets with in 30 units of PlayersTrains[1]

Events.

If PlayerTrains[0] was or iis with in range of a unit then...
If playerTrains[1] was or is with in range of a unit then...

How do you say that? (the if part)

More info about the problem.
Currently i have 4 trains and four Triggers. I want to combine them into one trigger. It my goal to streamline my code as much as possible because in this project i find when something is off changing it 4 times is not fun. And i plan on making it 8 player soon.
 
Level 12
Joined
Feb 23, 2008
Messages
587
Sorry.

I Have a event that says.
Event- a unit gets with in 30 units of (Player1s hero)
a unit gets with in 30 units of (Player2s hero)

Action-

If the trigger was set off by players 1 hero then do this...

if the trigger was set off by players 2 hero then do this...


My question.
How do i know if the trigger was set off by players 1 hero or players 2 hero
 
Level 24
Joined
May 9, 2007
Messages
3,563
What do you mean by:

Event- a unit gets with in 30 units of (Player1s hero)

What is a "unit" (the second reference)

Ohh,

  • Blah
    • Events
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to YourUnitType
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 1 (Red)
        • Then - Actions
          • Your Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
        • Then - Actions
          • Your Actions
        • Else - Actions
 
Level 12
Joined
Feb 23, 2008
Messages
587
Hmm i you told me it back wards. but you thought i meant something else. but ya it that that should work.


I wanted to know

If a unit is 30 range of player 1 hero
If a unit is 30 range of player 2 hero

if its player1 hero or player2 hero, not what unit that got close is owned by.

anyway i should be able to make it work with your help. THNX!
 
Level 12
Joined
Feb 23, 2008
Messages
587
thats how it was. but i am going to take the advice of the guy who posted before you. because i have 8 players. and alot of things that happen. and if i don't make them in array of some sorta. then when i change something (This is known to happen some times) i wont have to change it 8 times (and i have 10 things that happen)

besides streamlining code is always good. easier to error check ect
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
(first add all heroes into a unit array with the playernumber as index)
Why not make them all in the same trigger?

Adding all heroes to the event that a unit comes within the x range of the hero...
Then do a loop checking if triggering unit is equal to variable_array[loopindex]

Since the hero cant be in range of itself, that shouldnt be a problem

Edit: Saw now that was just like hawk said... I improved it slightly though
 
Level 12
Joined
Feb 23, 2008
Messages
587
YEs all of that would work...

Ya i already got the array part thnx for suggestion though

And ill just have to find a way...But Currently i have all my guys as player 12. and they represent players of player 1. he has a red unit a blue unit. ect

Its just not working! :cry:

Your way would work... But...The reason i put then to player 12 in the first place is because other wise people would click on the train or unit, and move it. And i want it to be only moved my spells.

All problems would be solved. if i could find out how to make it so you could not select one of your own units. or if you could remove the move function, but still allow it to move with triggers.

But. I may just trash this game i found many ways to solve this problem... But they all seem so painful.(like horrible work arounds i made up.)

Why cant IT just work.... Ill try some more..

+ Rep For Everyone.
 
Status
Not open for further replies.
Top