• 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.

[Trigger] Help with 2 triggers

Status
Not open for further replies.
Level 9
Joined
Dec 4, 2007
Messages
562
Hey.

Can somebody help me with creating a trigger that do so when a unit comes within like 100 range from a unit type then check if that unit is in a unit group. And if the unit is in the specified unit group then teleport the unit instantly to a unit (variable)

And a second trigger.

When a unit in a unit group dies....then spawn a skeleton at the position of the dying unit.

plz help:smile:
 
Level 9
Joined
Dec 4, 2007
Messages
562
Thanks for quick answear :thumbs_up:

Umm this is the one that is supposed to spawn a skeleton when a unit dies (that is in the unit group)

  • Graveyard Spawn
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is in GY_DamageGroup) Equal to True
    • Actions
      • Set GY_DiePosition = (Position of (Dying unit))
      • Unit - Create 1 Skeleton Warrior for (Owner of Graveyard_caster) at GY_DiePosition facing Default building facing degrees
      • Special Effect - Create a special effect attached to the chest of (Last created unit) using Abilities\Spells\Undead\Darksummoning\DarkSummonTarget.mdl
      • Special Effect - Destroy (Last created special effect)
And this is the one that is supposed to teleport them to a unit if they come in range of a specific unit (I think I added all of the specific unit to the variable group GY_EndGroup, but if you know a way to just pick every unit in range of a unit type then plz share with me) :D

  • Graveyard Flee
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in GY_EndGroup and do (Unit Group - Pick every unit in (Units within 40.00 of (Position of (Picked unit)) matching (((Matching unit) has buff Graveyard ) Equal to True)) and do (Unit Group - Add (Matching unit) to GY_Flee))
and this to
  • Graveyard Tele
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in GY_Flee and do (Actions)
        • Loop - Actions
          • Unit - Move (Picked unit) instantly to ((Position of GY_Dummy) offset by 10.00 towards (Angle from (Position of (Picked unit)) to (Position of Graveyard_Dummy)) degrees)
 
Level 16
Joined
Jun 25, 2008
Messages
1,043
.. gimme a seocnd

but if you know a way to just pick every unit in range of a unit type then plz share with me) :D
  • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to #Type of Unit#)) and do (Actions)
    • Loop - Actions
      • Set TempPoint = (Position of (Picked unit))
      • Set TempGroup = (Units within #Some Number# of TempPoint matching (#Whatever Conditions you want#)
      • Unit Group - Add (Picked unit) to (#Your Unit Group#)


  • Unit Group - Add (Matching unit) to GY_Flee
This should be (Picked Unit), not matching unit
 
For the second one:

  • Trigger1
  • Events
    • Unit - A unit dies
  • Conditions
    • ((Dying unit) is in (<Your group)) Equal to True
  • Actions
    • Set Point1 = (Position of (Dying unit))
    • Unit - Create 1 Unit at (Point1) for (Owner of (Dying unit)) (?) facing default building degrees
    • Custom script: call RemoveLocation (udg_Point1)
For the first trigger,
  • Trigger2
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Set Unit_Group1 = (Units of type <your unit type>)
    • Unit Group - Pick up every unit in (Unit_Group1) and do (Actions)
      • Loop - Actions
        • Set Unit1 = (Picked unit)
    • Set Unit_Group = (The group you want to check if a unit belongs to)
    • Unit Group - Pick up every unit in (Unit_Group) and do (Actions)
      • Loop - Actions
        • Set Unit2 = (Picked unit)
        • Trigger - Add to Trigger3 <gen> the Event (Unit - Unit2 comes within 100.00 of Unit1)
    • Custom script: call DestroyGroup (udg_Unit_Group_1)
    • Custom script: call DestroyGroup (udg_Unit_Group)
  • Trigger3
  • Events
  • Conditions
  • Actions
    • Set X = <your point>
    • Set Y = ((X) offset by 128.00 towards (Facing of (Unit1)))
    • Unit - Move Unit2 (Instantly) at Y
    • Custom script: call RemoveLocation (udg_X)
    • Custom script: call RemoveLocation (udg_Y)
 
Level 9
Joined
Dec 4, 2007
Messages
562
Thanks both, but Pharaoh, I cant seem to find the event (Unit2 comes within 100.00 of Unit1) only (A unit comes within 100.00 of Unit1).
 
Level 9
Joined
Dec 4, 2007
Messages
562
Ok thanks :D

EDIT: The triggers still doesnt work.

Here is teleport

  • Graveyard Flee
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • Set GY_EndGroup = (Units of type Graveyard End Dummy)
      • Unit Group - Pick every unit in GY_EndGroup and do (Actions)
        • Loop - Actions
          • Set GY_EndDummy = (Picked unit)
      • Set GY_TeleportGroup = GY_DamageGroup
      • Unit Group - Pick every unit in GY_TeleportGroup and do (Actions)
        • Loop - Actions
          • Set GY_UnitTeleporting = (Picked unit)
          • Trigger - Add to Graveyard Tele <gen> the event (Unit - A unit comes within 100.00 of GY_EndDummy)
          • Custom script: call DestroyGroup (udg_GY_EndGroup)
          • Custom script: call DestroyGroup (udg_GY_TeleportGroup)
  • Graveyard Tele
    • Events
    • Conditions
      • (Triggering unit) Equal to GY_UnitTeleporting
    • Actions
      • Set GY_X = (Position of GY_UnitTeleporting)
      • Set GY_Y = (GY_X offset by 180.00 towards (Angle from GY_X to GY_Mid) degrees)
      • Unit - Move GY_UnitTeleporting instantly to GY_Y
      • Custom script: call RemoveLocation (udg_GY_Y)
      • Custom script: call RemoveLocation (udg_GY_X)
And for the skeleton spawn when die.

  • Graveyard Spawn
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is in GY_DamageGroup) Equal to True
    • Actions
      • Set GY_DiePosition = (Position of (Dying unit))
      • Unit - Create 1 Skeleton Warrior for (Owner of Graveyard_caster) at GY_DiePosition facing Default building facing degrees
      • Special Effect - Create a special effect attached to the chest of (Last created unit) using Abilities\Spells\Undead\Darksummoning\DarkSummonTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation (udg_GY_DiePosition)
 
Last edited:
Level 9
Joined
Dec 4, 2007
Messages
562
Erm, not to sound like an negative asshole, but I heard Events inside actions leaked a lot? Correct me If I'm wrong or how big the issue would be to have them..

Ok lol thanks, then I will just have that event there the on the trigger instead of adding it there.
I dont think it matters anyways :).

EDIT: Seems like I cant make that an event like this
  • Trigger - Add to Graveyard Tele <gen> the event (Unit - A unit comes within 100.00 of GY_EndDummy)
only with an action that creates it. (Cant use unit dummys in events I think.)
 
Level 25
Joined
May 11, 2007
Messages
4,650
Ok lol thanks, then I will just have that event there the on the trigger instead of adding it there.
I dont think it matters anyways :).

EDIT: Seems like I cant make that an event like this
  • Trigger - Add to Graveyard Tele <gen> the event (Unit - A unit comes within 100.00 of GY_EndDummy)
only with an action that creates it. (Cant use unit dummys in events I think.)

Yeah, that's one of the biggest fails in mapmaking without Jass, you can't use variables in Events (only conditions and actions) You need jass for that. (Unless that Add event doesn't leak too much / works, I'm testing that now).

EDIT: Just a tip, add a Game - Display text to Graveyard tele to see if it works, like a debug. If not, maybe set the picked units that you have set to GY_UnitTeleporting and make it into a group and make the Event:
"a unit comes in range of GY_EndDummy
condition: unit belongs in group GY_teleportingUnits.


Sorry if it got messy, I'm a bit tired :p
 
Status
Not open for further replies.
Top