• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Trigger problem :/

Status
Not open for further replies.
Level 15
Joined
Aug 11, 2009
Messages
1,606
I have a trigger problem.I want to make some of the units that are spawned in my map to use some spells....but this has as an effect to make them go crazy,they lose their destination points and just go wondering the whole map,it also lags...
Anyway here is the spell:
  • UseSpell
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacked unit) is A ground unit) Equal to True
      • (Owner of (Attacked unit)) Equal to Player 1 (Red)
    • Actions
      • Unit Group - Pick every unit in (Units owned by Player 1 (Red) of type Blood Elf Priest) and do (Actions)
        • Loop - Actions
          • Unit Group - Order (Units of type Blood Elf Priest) to Orc Far Seer - Chain Lightning (Attacking unit)
Can someone make this safer?I mean making units cast spells while on their destination Move-Attach paths.Removing lag would help a lot too.
+rep for any help!
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Unit Group - Order (Units of type Blood Elf Priest) to Orc Far Seer - Chain Lightning (Attacking unit)

->

Unit Group - Order (Picked Unit) to Orc Far Seer - Chain Lightning (Attacking unit)

All picked units are Blood Elf Priests anyway.


Set the group to a variable and destroy it like this:

  • Set Temp_Group = (Units within 300.00 of Temp_Loc_2 matching (((Owner of (Matching unit)) Not equal to...
  • Unit Group - Pick every unit in Temp_Group and do (Actions)
    • Loop - Actions
      • Hashtable - Save Temp_Real_2 as (Key Dist) of (Key (Picked unit))...
  • Custom script: call DestroyGroup(udg_Temp_Group)
Why do you want all units of that type to attack the attacking unit? Why not have only the attacked unit attack the attacker?

You could also add all units in the blood elf group when they enter playable map are or if they are in the map from the beginning. Remove them from the group when they die or get removed. That way you don't create the group over and over again.

For the move to - destination, maybe you could save the location to a hashtable and periodically order them to attack move there, with certain conditions of course.
 
Level 15
Joined
Aug 11, 2009
Messages
1,606
Can you give me an example with trigger tags?I don't have a clue about hastbales....And it isn't good to have my mages go all over my map and running like crazy people!So i want to follow their actual path but cast spells to the attacking units in the way too.Thx and i owe you rep :)
EDIT:You way fixed the lag issue,now the only problem is their destination path.
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
This initializes the hashtable:

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Move_Hash = (Last created hashtable)

This makes all existing unit of type...to attack-move to the specified location:

  • Add Units
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set Temp_Loc_1 = (Center of Region 000 <gen>)
      • Set Temp_Group = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Far Seer))
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To Temp_Loc_1
          • Hashtable - Save Handle OfTemp_Loc_1 as (Key loc) of (Key (Picked unit)) in Move_Hash
      • Custom script: call DestroyGroup(udg_Temp_Group)

This makes all entering units of type...to attack-move to the specified location:

  • Enter Region
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Far Seer
    • Actions
      • Set Temp_Loc_1 = (Center of Region 000 <gen>)
      • Unit - Order (Triggering unit) to Attack-Move To Temp_Loc_1
      • Hashtable - Save Handle OfTemp_Loc_1 as (Key loc) of (Key (Triggering unit)) in Move_Hash


This makes all existing unit of type...to use Chain Lightning, and then resume to attack-move to their specified location.

  • Is Attacked
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Far Seer
    • Actions
      • Unit - Order (Triggering unit) to Orc Far Seer - Chain Lightning (Attacking unit)
      • Wait 2.00 seconds
      • Unit - Order (Triggering unit) to Attack-Move To (Load (Key loc) of (Key (Triggering unit)) in Move_Hash)
You might want to add a mana cost check, and a trigger that removes the location when the unit dies, and clears child hashatable.
 
Level 15
Joined
Aug 11, 2009
Messages
1,606
ok thx,let me test this and i will reply soon.
EDIT:Ok...the triggers above don't match with my creep spawning trigger and it would need huge changes to completely remake them,so i have come up with a new idea.My current triggers are Create XX unit at XX location,then to move them XX unit enters XX location,order XX unit to move to XX location.I thought instead of giving the spawned units the command to attack enemy base when they get into this region why not making it periodic time event?I mean having a trigger every 0.03 seconds of game time order XX unit to attack XX location.This actual would solve the problem when any of the creeps "forgot" his path and just went "crazy".It is supposed to continually give the units the command to attack.
This + use spell lightining chain should work,but still doesn't work...Do you know why?If you haven't understood what i mean,just ask.Oh the trigger i am using for the ability is this:
  • UseSpell
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacked unit)) Equal to Blood Elf Priest
      • (Owner of (Attacked unit)) Equal to Player 1 (Red)
    • Actions
      • Unit Group - Order (Units of type Blood Elf Priest) to Orc Far Seer - Chain Lightning (Attacking unit)
      • Wait 2.00 seconds
      • Unit Group - Order (Units in (Playable map area) owned by Player 1 (Red)) to Attack-Move To (Center of Creep Attack1 <gen>)
It partially works but some times...some of my mages just stop moving in a random region,some of them might move later or some other just "stuck" there.
 
Last edited:
Level 15
Joined
Aug 11, 2009
Messages
1,606
So i have to create something like this:
  • Melee Initialization
  • Events
    • Map initialization
  • Conditions
  • Actions
    • Hashtable - Create a hashtable
    • Set Move_Hash = (Last created hashtable)
  • Add Units
  • Events
    • Time - Elapsed game time is 0.03 seconds
  • Conditions
  • Actions
    • Set Temp_Loc_1 = (CreepAttack1 <gen>)
    • Set Temp_Group = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Blood Elf Priest))
  • Unit Group - Pick every unit in Temp_Group and do (Actions)
  • Loop - Actions
    • Unit - Order (Picked unit) to Attack-Move To Temp_Loc_1
    • Hashtable - Save Handle Of Temp_Loc_1 as (Key loc) of (Key (Picked unit)) in Move_Hash
    • Custom script: call DestroyGroup(udg_Temp_Group)

  • Is Attacked
  • Events
    • Unit - A unit Is attacked
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Blood Elf Priest)
  • Actions
    • Unit - Order (Triggering unit) to Orc Far Seer - Chain Lightning (Attacking unit)
  • Wait 3.00 seconds
  • Unit - Order (Triggering unit) to Attack-Move To (Load (Key loc) of (Key (Triggering unit)) in Move_Hash)
 
Status
Not open for further replies.
Top