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

Moving multiple units for multiple players

Status
Not open for further replies.
Level 17
Joined
Jun 17, 2010
Messages
2,275
It seems that i have been gone for a very long time and i just cannot seem to remember how to move multiple units in the same instance, and remove those units from the instance when they are done being used. I believe it has something to do with integer loops, any insight on the subject would help. GUI please.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Store the data you need to manage the unit movement in a hashtable within the Unit Handle ID, then use that data in a periodic trigger.

To get the Handle of something you can use
  • Custom script: set IntegerVariable = GetHandleId(AnythingYoUWant())
· Save (Handle of the Unit You Want to Move towards to) as 0 of (Dummy Handle ID) in Hashtable
· Save (Speed of the unit you want to move) as 1 of (Dummy Handle ID) in Hashtable
· Save (Max Distance the dummy can travel) as 2 of (Dummy Handle ID) in Hashtable
· Save (Dummy Lifetime) as 3 of (Dummy Handle ID) in Hashtable
· Save (String path of the Special effect that's created when the dummy dies or reaches its targets or its max distance) as 4 of (Dummy Handle ID) in Hashtable
· Save (Damage the Dummy Should deal) as 5 of (Dummy Handle ID) in Hashtable
· Save (The Handle ID of the Unit that casts the dummy and should deal the damage, so the damage is dealt by the caster, and not by the dummy) as 6 of (Dummy Handle ID) in Hashtable
etc...

After that, you just recall the data as desired in a periodic trigger.

It makes anything MUI (Multi Instanceable) and works for any amount of units and any amount of players.
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
You have my idea wrong, my purpose is to have a dummy unit stalk another unit until a certain spell is used, or the spell is broken, via death or any other means. How would i recall these hashtables attributes in a periodic? And how do i save a heroes stats (abilities, experience, stats) in a hashtable? So that it comes back to the game as if it were never removed from it.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
As long as I Know, Experience is an Integer. Abilities ID and Abilities Levels are Integers. Hero Stats are Reals. Use "Hastable - Save Real" and "Hastable - Save Integer" accordingly.

The way your ability works is up to you. You can save the ID of the Caster in the same dummy and check if the (Load Handle of caster) is still alive. You can also check dhe distance between the dummy and the target if that's a requirement for the spell.

You can tell me exactly what you want, it's easier to help you that way.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
move multiple units in the same instance, and remove those units from the instance when they are done being used
Put them in a Unit Group and at the loop, pick all the units in the Unit Group and move them ? Either GUI function or SetUnitX/Y, your choice.
But first, you must save the duration (or something, that would stop the movement of those units) and save them each time they are moved, and do a Comparison when Duration Less than or equal to 0.00, remove those units from the Unit Group and clear the data from the hashtable and check whether remaining unit still in the Unit Group.
If no unit in the Unit Group, turn off looping trigger (save performance).

Is this what you want ?
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
hm... i was thinking of using a unit group but i have no idea what functions will do what you are suggesting, could you show me an example? Because just the words alone doesnt form the trigger in my head.

Ah i see what you are getting at, but how the spell is set up there is no defined duration, could i save a Boolean instead? and then check if the boolean is true?
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
Def I ran the first spell workshop, and then worked with you in the spell workshop you set up after i closed mine down, you are telling me you dont remember any of that, or the work that i did?

That aside, i have always avoided hashtables, and im rather good with indexing, atleast i'd like to believe so, but im starting to try to understand hashtables, how can i save a conidition in hashtables, and then use that to completely remove a units saved info?
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
You mentioned this;
It seems that i have been gone for a very long time and i just cannot seem to remember...
that's why I asked, sorry if I offended you in any way.

I can only show you Hashtable, I did not learn Indexing as much as I learned Hashtable, here goes;
  • Untitled Trigger 002
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hashtable = (Last created hashtable)
  • Melee Initialization
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Banish
    • Actions
      • Set Target = (Target unit of ability being cast)
      • Set Caster = (Triggering unit)
      • Set Duration = 5.00
      • Set TempLoc = (Position of Caster)
      • Set TempLoc2 = (Position of Target)
      • Set TargetAngle = (Angle from TempLoc to TempLoc2)
      • Custom script: set udg_Key = GetHandleId(udg_Target)
      • Hashtable - Save Duration as 0 of Key in Hashtable
      • Hashtable - Save TargetAngle as 1 of Key in Hashtable
      • Unit Group - Add Target to UnitGroup
      • Trigger - Turn on Untitled Trigger 001 <gen>
      • Custom script: call RemoveLocation(udg_TempLoc)
      • Custom script: call RemoveLocation(udg_TempLoc2)
  • Untitled Trigger 001
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (UnitGroup is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Unit Group - Pick every unit in UnitGroup and do (Actions)
            • Loop - Actions
              • Set Target = (Picked unit)
              • Custom script: set udg_Key = GetHandleId(udg_Target)
              • Set Duration = (Load 0 of Key from Hashtable)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Duration Greater than 0.00
                  • (Target is alive) Equal to True
                • Then - Actions
                  • Set TargetAngle = (Load 1 of Key from Hashtable)
                  • Set TempLoc = (Position of Target)
                  • Set TempLoc2 = (TempLoc offset by 10.00 towards TargetAngle degrees)
                  • Unit - Move Target instantly to TempLoc2
                  • Hashtable - Save (Duration - 0.03) as 0 of Key in Hashtable
                  • Custom script: call RemoveLocation(udg_TempLoc)
                  • Custom script: call RemoveLocation(udg_TempLoc2)
                • Else - Actions
                  • Hashtable - Clear all child hashtables of child Key in Hashtable
                  • Unit Group - Remove Target from UnitGroup
These are the simple triggers which is used to move a Single-target unit. Move as in "knockback".

You can ask any question if you don't understand or simply to understand more.
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
Thats interesting i never knew hashtables could be so efficient. So i can remove duration, and under "If - conditions" duration, i can change that condition to
  • SpellBoolean Equal to true
and have a seperate trigger

  • Spell cast
  • Events
    • Unit - Unit starts the effect of an ability
  • Conditions
    • Ability being cast Equal to Ability
  • Actions
    • Set SpellBoolean Equal to true
    • Unit Group - Remove triggering unit from UnitGroup
Of course i will have to find a way to link the certain ability being cast to the specific unit of the unit group...

Maybe i can have it do the last part induvidually *Changed trigger*

But how will i remove the hashtable properties of that unit?
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
Will it help if i posted the spell description for you? So you can get an idea of what im trying to achieve?

Allows an Assassin to hide in the shadows, giving up movement speed to move quieter and stealthier. When making contact with an enemy soldier you knock him out and take his identity to get close to your mark. When dusgiuised you have the option to follow orders for a while or take over and end your targets life.

My idea was to create a dummy unit that has a movement option, so that i can issue orders to the unit still controlled by the enemy and move it where i please, but it still belongs to the enemy, i'll have a dummy spell on the unit that takes control of the disguise and becomes your unit, and a dummy spell that does the assassination, and a dummy spell that relinquishes the disguise. I want the dummy unit to follow the units movements on par and right clicking the ground with the dummy unit will move the target unit.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
I am confused, because that spell you're trying to make is not same at all as your question in post #1.

You want to move unit (knockback) all at once and when time is up, remove the unit and clear instances.

What's got to do with that assassin ?

Or are you just trying to grab the concept of Hashtable ? The saving and all of that ?

If this spell is for the Zephyr, credit me please :) Haha
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
No, i want the dummy unit to follow the target unit, it has nothing to do with knocking back, you must have misread what i said, The dummy unit is invisable, and untargetable, it is there to just be a controller for the unit that is being taken over. The point of this topic is to figure out how to move the unit controller to stay with the target unit, and to make that MUI. And yes it is for zephyr and sure ill credit you. And i want you to look at this post. You may not remember it but it might make that PM i sent you more clear, and what i said earlier more clear to you. A Long Long time ago.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Ahhh I get it, the dummy follows the target unit until you decide to end the unit's life, right ?
I did not understand it at first, that's why I'm curious to know why it's related @.@"

Huh, that post ?
So good to remember the past~
And my post kinda retarded at that time.
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
Def, i regret what i said, i shouldve let you join and learn, but i was young and stupid. I realize now if i had let you join your energy might have kept the original spell workshop alive.


Have you ever seen a movie where one of the enemies takes a guards armor, and sneaks into the enemies camp, to try to assasinate a general, or captain, or any other commanders, or people of rank. That is what i am trying to accomplish.

and yes, i need the unit to follow the target, but i need that to follow every target this spell has been used on. I need it MUI. Ill try to use that knockback spell and alter it so that it will work, once i have something tangible ill post it on the contest and spell section, then maybe you can test it if u want.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Have you ever seen a movie where one of the enemies takes a guards armor, and sneaks into the enemies camp, to try to assasinate a general, or captain, or any other commanders, or people of rank. That is what i am trying to accomplish.
But then again, do you still want to retain the original unit's functionality ?
I mean, items, abilities, HP, etc etc ?

If not, you could simply kill the target unit and hide your original unit, create a new unit (Unit-type of TargetUnit) and there you have it, a dummy unit.
And when you end the Target's live, kill the unit/hide and unhide your original unit to the location of the killed unit.

But if you want to truly copies the stats of the original unit (items, abilities, ability levels, etc), it's gonna be more hard to handle the unit.
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
Well it can only target lower level units, like footmen, grunts, etc. And it nothing will change to the unit because then it would tip the enemy off that that unit could be a fake. And if something died, then they would know something isnt right. I kind of want it to be like a save system, where it restores the level, and abilities, and items.
 
Status
Not open for further replies.
Top