• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[General] How would i do this in GUI

Status
Not open for further replies.
Level 6
Joined
Feb 10, 2011
Messages
188
Well i want a trigger to run (so my event) when a unit is within range of a UNIT TYPE, not a specific unit. So is this possible in GUI?

If not what would be the best work around.



edit:

Or, the event could fire if the unit is within range of a Destructible TYPE.
 
Level 6
Joined
Feb 10, 2011
Messages
188
ya just store the units in range in a group. then use an ITE to check if its the unit type u are looking for.

u can use a unit in range event and then check if the triggering unit is the unit type that u want in an ITE. this would be the better method.

well that makes sense in all but im a bit confused on the unit in range event, when i try to use this on the world editor, i can only pick specific units. like barracks 0001. know what i mean? and since this will have to be done for about 190 different barracks it would be rather annoying to put in the event a unit comes within range of barracks 0001 through 0198 or w/e. so thats why im kind of stuck.

basically it would replace this event the actions would stay the same, i just want it so a player doesn't have to debug, and the game will do it itself. so to speak
  • Debug
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Debug
      • ((Target unit of ability being cast) is A structure) Equal to True
      • (Unit-type of (Target unit of ability being cast)) Not equal to Campfirebuilding
    • Actions
      • Set tempinteger4 = (Custom value of (Target unit of ability being cast))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Target unit of ability being cast) Equal to base[tempinteger4]
        • Then - Actions
          • Set currentunitgroup4 = (Units within 200.00 of circlepos[tempinteger4] matching ((((Matching unit) is alive) Equal to True) and ((Matching unit) Equal to defender[tempinteger4])))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in currentunitgroup4) Equal to 0
            • Then - Actions
              • Unit - Create 1 Dummytype for (Owner of base[tempinteger4]) at circlepos[tempinteger4] facing Default building facing degrees
              • Set defender[tempinteger4] = (Last created unit)
              • Unit - Add defendermarker to defender[tempinteger4]
              • Unit - Add Defendabilitytype to (Last created unit)
              • Unit - Order (Last created unit) to Orc Raider - Ensnare (Last created unit)
              • Unit - Set the custom value of defender[tempinteger4] to (tempinteger4 + 100)
            • Else - Actions
          • Custom script: call DestroyGroup( udg_currentunitgroup4 )
        • Else - Actions
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
u can add units in playable map area with unit type equal to unit type of unit u want

then pick all units and use the custom script
  • Custom script: call TriggerRegisterUnitInRange( trigger whichTrigger, unit whichUnit, real range, null)
replace trigger whichTrigger with the trigger. replace unit whichUnit with the picked unit. replace real range with the range u want. and dont replace the null keyword leave that as is.
 
Level 6
Joined
Feb 10, 2011
Messages
188
u can add units in playable map area with unit type equal to unit type of unit u want

then pick all units and use the custom script
  • Custom script: call TriggerRegisterUnitInRange( trigger whichTrigger, unit whichUnit, real range, null)
replace trigger whichTrigger with the trigger. replace unit whichUnit with the picked unit. replace real range with the range u want. and dont replace the null keyword leave that as is.

oh woah read that wrong so ignore what i said, thankyou i will try this.
 
Level 6
Joined
Feb 10, 2011
Messages
188
np lol glad to help

well i thought i did what you said to do, but since im getting a syntax error im guessing im not. what did i do wrong?

  • Set CitiesPorts = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to City) or ((Unit-type of (Matching unit)) Equal to Port)))
    • Unit Group - Pick every unit in CitiesPorts and do (Actions)
      • Loop - Actions
        • Custom script: call TriggerRegisterUnitInRange (trigger Debug, unit GetEnumUnit(), 500, null)
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
In the custom script in the parenthesis remove the word trigger and the word unit. The other thing I forgot to mention was that u need the gg_trg_ prefix b4 the trigger name. So change Debug to gg_trg_Debug. It may give u a problem with the real. U might need to change it from 500 to 500. Or 500.00 andythjng with the period will work.
 
Level 6
Joined
Feb 10, 2011
Messages
188
In the custom script in the parenthesis remove the word trigger and the word unit. The other thing I forgot to mention was that u need the gg_trg_ prefix b4 the trigger name. So change Debug to gg_trg_Debug. It may give u a problem with the real. U might need to change it from 500 to 500. Or 500.00 andythjng with the period will work.


ahhh ok. such simple little mistakes could make stuff go so so wrong :p

btw im looking at ur converting GUI to efficient Jass tut atm, it is awesome! I been editing priwins risk system and so far i fixed a ton and its like everytime i look at your tutorials it helps me fix it even more. (some of his triggers are GUI and some a JASS wich is why ur tuts are awesome)
 
Status
Not open for further replies.
Top