Unit comes in range; variable problem

parmsib

New Member
Reaction score
0
Hi.
This has probably been answered before, but i couldent find it using the search function.

I'm making a "rocket launcher" spell, where i launch a dummy in the direction of the target point of the spell, but im having problems detecting if the rocket hits a unit, or with other words, a unit comes in range of my dummyunit. It just doesent seem to "find" my variables stored.
I have no idea of how to do this, please help!
 

Frozenwind

System maker
Reaction score
99
Few questions:
Does your variable vary (changes)?
__If so, you'll need periodic event
Does your unit vary but your variable keep the same?
__Use this:
Code:
Trigger - add event

frozenwind.
 

parmsib

New Member
Reaction score
0
I dont get what you just said... im fairly new to triggers.
My problem is that, when i use an event called something like "Unit comes in range" I cant choose the variable when im choosing the "... in range of ->unit<-".
(the -> <- unit)
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
well as he said go to:
Code:
Trigger - Add Event
and there you could create an event of unit comes within range using variables
 

Frozenwind

System maker
Reaction score
99
I know your problem, but I wanna have some more facts.

It isn't possible to "change" an event using a trigger.
A variable changes over time, if you would put an unitvariable there it becomes "solid", he places the unit stored inside the variable into your event.
In your variable menu you can't set it to a unit, so by default an unitvariable is equal to "no unit".

For a realvariable you can set a default value in your variable menu, but when you put it into an event it becomes "solid" (unchangeble), so you should just insert the number there.

If you are in a game you can change those variables, but the event wont EVER change though. With this function beneath you can ADD a new event:
Code:
Trigger - Add Event
You can insert variables there, but beware, they become SOLID, so if your variable changes your event won't change with it.

The ONLY way to do "unit comes withing --range-- of unit", with a range that keeps changing is like this:
Code:
Event: Time - Periodic Event (every 0.1 sec or something)
Action:
Pick every unit in (units within [COLOR="Orange"]range[/COLOR] of "yourunit")
     //list here all ur actions what gotta be done with the units that are within his range\\
The orange value is ur real variable.

However this trigger keeps redoing the actions if the unit is within the asked range. You should make some unitgroup variable and then add the units that are within its range, as in:
Code:
Event: Time - Periodic Event (every 0.1 sec or something)
Action:
set unitgroup_variable2 = every unit in (units within [COLOR="Orange"]range[/COLOR] of "yourunit")
Pick every unit in unitgroup_variable2
    if then else: (boolean comparison: (Matching unit) is in unitgroup_variable equal to false)
        then - actions
            unitgroup - add picked unit to unitgroup_variable
            //list here all ur actions what gotta be done with the units that are within his range\\
Pick every unit in unitgroup_variable
    if then else: if (boolean comparison) unitgroup_variable2 contains picked unit equal to false.
        then - actions
            unitgroup - remove picked unit from unitgroup_variable
Unitgroup - clear unitgroup_variable2

Do you get it?
I go sleep now, I'll be back @ 14:00~15:00 GMT

frozenwind.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top