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

How do i controll 2 Last Created Unit?

Status
Not open for further replies.
Level 21
Joined
Aug 21, 2005
Messages
3,699
Instead of the first "Else - actions"; do:
Set "AssassinateCasterPosition" = position of casting unit
Set "Assassinatedunit"=random unit from units within 1000 of Assassinatecasterposition
Set "AssassinatePosition"=position of Assassinatedunit
Unit - Create 1 Shadow (level 2) for owner of casting unit at AssassinatePosition
Unit - Add a 1 second Expirationtimer
Unit - Order (last created unit) to attack Assassinatedunit

Set "Assassinatedunit"=random unit from units within 1000 of Assassinatecasterposition
Set "AssassinatePosition"=position of Assassinatedunit
Unit - Create 1 Shadow (level 2) for owner of casting unit at AssassinatePosition
Unit - Add a 1 second Expirationtimer
Unit - Order (last created unit) to attack Assassinatedunit

Custom script: call RemoveLocation( udg_AssassinateCasterPosition )
Custom script: call RemoveLocation( udg_AssassinatePosition )

In order to avoid leaks at level 1, do +/- the same as I did in level 2.
 
Level 9
Joined
Jun 26, 2005
Messages
511
Hmm am not very good with variables, but i found a way to do it, if it works ill post.

EDIT: damit it didnt work, i was gonna do a muti trigger, but its still the samething, i dont really use variable cuz i suck at it and i dont know how it works :(, ill probably go with 1 unit, thanks everybody.
 
Level 4
Joined
Jun 5, 2007
Messages
65
Don't give up yet!

If you ask it to Create 1 Assassin then set Last created unit to a variable, ASSASSIN1, then create another one, and set the last created unit to ASSASSIN2, it will seem as though they were summoned at the same time, since their is no wait function in between the two actions.

You can do it like this:
  • Assassinate
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Assassinate
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Assassinate for (Casting unit)) Equal to 1
        • Then - Actions
          • Unit - Create 1 Shadow for (Owner of (Casting unit)) at ((Position of (Casting unit)) offset by 125.00 towards 0.00 degrees) facing Default building facing degrees
          • Set ASSASSIN1[(Player number of (Owner of (Casting unit)))] = (Last created unit)
          • Wait 0.25 seconds
          • Unit - Move ASSASSIN1[(Player number of (Owner of (Casting unit)))] instantly to (Position of (Random unit from (Units within 1000.00 of (Position of (Casting unit)) matching (((Picked unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True))))
          • Unit - Order ASSASSIN1[(Player number of (Owner of (Casting unit)))] to Attack (Picked unit)
          • Wait 0.65 seconds
          • Unit - Remove ASSASSIN1[(Player number of (Owner of (Casting unit)))] from the game
          • Set ASSASSIN1[(Player number of (Owner of (Casting unit)))] = No unit
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Assassinate for (Casting unit)) Equal to 2
            • Then - Actions
              • Unit - Create 1 Shadow for (Owner of (Casting unit)) at ((Position of (Casting unit)) offset by 125.00 towards 0.00 degrees) facing Default building facing degrees
              • Set ASSASSIN1[(Player number of (Owner of (Casting unit)))] = (Last created unit)
              • Unit - Create 1 Shadow for (Owner of (Casting unit)) at ((Position of (Casting unit)) offset by 125.00 towards 180.00 degrees) facing Default building facing degrees
              • Set ASSASSIN2[(Player number of (Owner of (Casting unit)))] = (Last created unit)
              • Wait 0.25 seconds
              • Unit - Move ASSASSIN1[(Player number of (Owner of (Casting unit)))] instantly to (Position of (Random unit from (Units within 1000.00 of (Position of (Casting unit)) matching (((Picked unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True))))
              • Unit - Order ASSASSIN1[(Player number of (Owner of (Casting unit)))] to Attack (Picked unit)
              • Unit - Move ASSASSIN2[(Player number of (Owner of (Casting unit)))] instantly to (Position of (Random unit from (Units within 1000.00 of (Position of (Casting unit)) matching (((Picked unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True))))
              • Unit - Order ASSASSIN2[(Player number of (Owner of (Casting unit)))] to Attack (Picked unit)
              • Wait 0.65 seconds
              • Unit - Remove ASSASSIN1[(Player number of (Owner of (Casting unit)))] from the game
              • Unit - Remove ASSASSIN2[(Player number of (Owner of (Casting unit)))] from the game
              • Set ASSASSIN1[(Player number of (Owner of (Casting unit)))] = No unit
              • Set ASSASSIN2[(Player number of (Owner of (Casting unit)))] = No unit
            • Else - Actions
              • Do nothing
Using ASSASSIN1 as an array (with a size of 12 - or one for each player that isn't a computer) allows this to be multi-instanceable.
BE SURE that at the end you set BOTH ASSASSIN1 and ASSASSIN2 to
'No unit' because otherwise it will cause leaks, and you don't want that.

Hope this helps.
-Z
 
Last edited:
Level 21
Joined
Aug 21, 2005
Messages
3,699
Ok, I'm in a good mood today.

Here's the trigger you need, commented as well.

Following trigger uses these Variables:
AssassinationCaster : Point Variable : No Initial Value
TargettedUnit : Unit Variable : No Initial Value
TargettedUnitPosition: Point Variable : No Initial Value

  • Assassination
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Assassinate
    • Actions
      • Set AssassinationCaster = (Position of (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Assassinate for (Triggering unit)) Equal to 1
        • Then - Actions
          • -------- I'm using "Triggering Unit" instead of "Casting Unit" because I'm not sure if there's a casting unit, considering the event. --------
          • Set TargettedUnit = (Random unit from (Units within 1000.00 of AssassinationCaster))
          • Set TargettedUnitPosition = (Position of TargettedUnit)
          • Unit - Create 1 Shadow for (Owner of (Triggering unit)) at TargettedUnitPosition facing Default building facing degrees
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • -------- The expiration timer will remove the shadow after 1 second. Change "1.00" into any value you wish the shadow to remain. --------
          • Unit - Order (Last created unit) to Attack TargettedUnit
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Assassinate for (Triggering unit)) Greater than 1
            • Then - Actions
              • -------- The following actions will create 1 "shadow" for each level you have. If you have level 3 "Assassinate", 3 shadows will spawn. If that's not what you want, I'll change it. --------
              • For each (Integer A) from 1 to (Level of Assassinate for (triggering unit)), do (Actions)
                • Loop - Actions
                  • Set TargettedUnit = (Random unit from (Units within 1000.00 of AssassinationCaster))
                  • Set TargettedUnitPosition = (Position of TargettedUnit)
                  • Unit - Create 1 Shadow for (Owner of (Triggering unit)) at TargettedUnitPosition facing Default building facing degrees
                  • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                  • -------- The expiration timer will remove the shadow after 1 second. Change "1.00" into any value you wish the shadow to remain. --------
                  • Unit - Order (Last created unit) to Attack TargettedUnit
            • Else - Actions
              • Do nothing
      • -------- These custom scripts will *remove* the location variables to avoid leaks. --------
      • Custom script: call RemoveLocation( udg_TargettedUnitPosition )
      • Custom script: call RemoveLocation( udg_AssassinationCaster )
P.s. Zoraykos' trigger is not completelly MUI: Every player will only be able to cast 1 at the same time. Mine should be fully MUI... should be...
 
Level 9
Joined
Jun 26, 2005
Messages
511
Zorayko's trigger didnt work, but thanks anyway, and Eleandor since your in a good mood, can you convert your trigger similar to Zorayko's? cause your trigger is a bit confusing, the part i have problem is, do the assassins create at the casting unit and then moved to random unit, or do they just spawn at random unit?

EDIT: and i cant do
Set TargettedUnit = (Random unit from (Units within 1000.00 of AssassinationCaster))

random unit from blah blah is only from position of unit right? i set targetted unit a unit variable and they only let me pick last created unit, picked unit etc.
 
Last edited:
Level 4
Joined
Jun 5, 2007
Messages
65
Hmm.. that's odd. I made that in WE and it worked for me, can you be more specific about the problem? Maybe then I can modify it to your needs.
 
Level 4
Joined
Jun 5, 2007
Messages
65
its under

Unit - Move unit instantly
> Unit - Position of unit
> Random units from unit group
>Units in range matching condition
>boolean comparison
>unit belongs to an enemy of player

That should do it for you.

Another thing to keep in mind:

If you order the unit to attack a unit, but that unit is in some way invulnerable, it won't work. What i suggest is to in the MATCHING section, use the AND, then use booleans to check whether or not the conditions are met.
 
Level 4
Joined
Jun 5, 2007
Messages
65
Hmm.. interesting. I'll see if I can figure out what the problem is. Post the trigger you're using and I'll look at it.
 
Level 9
Joined
Jun 26, 2005
Messages
511
post #14 was the trigger that you told me to do and i tried to do.

by the way, can anyone post juggernaut in DotA? its alike, and it would help alot, for those who dont play DotA, its just alike my trigger but only with one unit.

and if you happen to know how to make muti unit please post that also, thanks you.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Ok, I'll just upload the map for you, but don't expect that to happen for each request you do, I'm just a kind person :)

Note: I make the shadow spawn at the position of a random unit because it's useless to create it at the position of the casting unit if you immediatelly move it to the random unit anyway... But if you really insist...

P.s. I didn't make alot of custom data, so right now the shadows are just footmen. You just got to change that in your map.
 
Last edited:
Level 6
Joined
Aug 5, 2006
Messages
126

Shot at 2007-07-05

Ah...a similar problem happened to me from this sort, you should separate the actions "Assasinate level 2 and 3", because if you do a tree like that, you'll need 2 assasinate skills (one that's level 2 and 1 that's level 3) :/, separating them will salute your problem (sort of) i'm not really listening to your main problem, it's just that if you connect the if/then/else triggers in another, then the first if/then/else action should be made and then the other.

for example

Event
A player types a message containing _______ as an exact match
Condition
blank
Action
If/then/else
-If
"Hero Variable" Dies
-Then
Game: Display Text message: you can't type this if your main hero is dead.
-Else
If/then/else (again)
-If
TriggerScore greater than to 10.00
-Then
Game: Display Text message: "something", is now in position --or-- score is now passed to Player 1.

"So that trigger means the Hero has to die and a picked player has a score of 10 and over in order to activate the next trigger."

"Communicating through that, the Trigger will not activate if your Score Variable is over 10 "BUT" your hero is still alive."
 
Level 9
Joined
Jun 26, 2005
Messages
511
Eleandor you gave me the same trigger as you gave me on this forum T_T.

ok ill explain this ability so everybody can understand.
let say am using a blademaster as the caster, then create a effect of mirror image, hide casting unit, then creates two custom blademaster units, and add some cool effect to their blades (so it looks like a mirror image skill) then make those unit blink to random unit and do a omnislash like skill, then move the units back to casting unit and removed from the game as well, then unhide casting unit, and make player select casting unit.

hmm Quote to F4talWr4th:
i dont think it would have any problems, i been doing that with all my triggered spell skills from lvl1-10 on one piece of trigger, and so far their working well.
 
Level 9
Joined
Jun 26, 2005
Messages
511
thats what Zoraykos told me to do, but it doesnt work :\

post#14 was the trigger i did, please take a look to see any mistakes on it.

EDIT: this got really bad, the generic expiration timer kills the unit and leave its body on the floor, but am scare to do remove unit, cause i can have a chance to remove something else.
 
Last edited:
Level 9
Joined
Jun 26, 2005
Messages
511
OMG i love you donut, i didnt even see that, now it wows perfectly xD, thank you everybody thank you :D

EDIT: wait, one question, why are we using picked unit as a random unit when moving last created unit? there was no unit that was picked.

blah nevermind you guys dont have to answer it, as long as it works, am happy.
 
Last edited:
Level 27
Joined
Feb 22, 2006
Messages
3,052
That shouldn't be working.. instead, make a global variable TempUnit and a group variable named ALG and a point variable named ALP and do such:
  • Set ALP = Position of Last Created Unit
  • Set ALG = Units within 1000 of ALP
  • Custom Script: call RemoveLocation(udg_ALP)
  • Set TempUnit = Random unit in ALG
  • Set ALP = Position of TempUnit
  • Unit - Move LastCreatedUnit to ALP
  • Unit - Order LastCreatedUnit to attack TempUnit
  • Custom Script: call RemoveLocation(udg_ALP)
  • Custom Script: call DestroyGroup(udg_ALG)
--donut3.5--
 
Status
Not open for further replies.
Top