how do i order an unit to cast a certain spell

rax_7

New Member
Reaction score
1
i made a custom spell. if i have 2 heroes and both of them cast the same spell, 1 of their spell is cancel. but i am not sure if that effects other players as well. i dont wanna release the map yet. so i am trying to find a trigger that orders an unit to cast a spell. i wanna test it with a AI 1st.
Code:
Events
    Player - Player 1 (Red) types a chat message containing go as An exact match

what would the action be? i tried Unit-issue order targeting a unit. but it doesnt cast spell.
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
> if i have 2 heroes and both of them cast the same spell, 1 of their spell is cancel.

Do you use any triggers to power the spell?

Also, you said you tried issuing an order targeting a unit. Did you use the correct base spell? And was the spell a unit targeting spell?
 

rax_7

New Member
Reaction score
1
Cast Glaive Copy
Code:
  Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Bouncing Glaive
    Actions
        Trigger - Turn off ARazor Return Copy <gen>
        Unit - Kill AUnitsArray[2]
        Set AUnitsArray[1] = (Triggering unit)
        Unit - Create 1 Flying Razor for (Owner of (Triggering unit)) at ((Position of (Triggering unit)) offset by 100.00 towards (Facing of (Triggering unit)) degrees) facing (Target point of ability being cast)
        Set AUnitsArray[2] = (Last created unit)
        Sound - Play EnsnareMissile <gen> at 100.00% volume, attached to AUnitsArray[1]
        Set AIntergerArray[1] = (Integer((Angle from (Position of (Triggering unit)) to (Target point of ability being cast))))
        Set AIntergerArray[2] = ((Level of Bouncing Glaive for AUnitsArray[1]) x 10)
        Set AIntergerArray[3] = 0
        Set AIntergerArray[4] = (Terrain cliff level at (Position of AUnitsArray[2]))
        Unit - Set AUnitsArray[2] movement speed to 900.00
        Animation - Change AUnitsArray[2] flying height to 100.00 at 1000000000.00
        Animation - Play AUnitsArray[2]'s stand animation, using only Common animations
        Animation - Change AUnitsArray[2] turn speed to 0.00
        Unit - Turn collision for AUnitsArray[2] Off
        Set Movepoint = ((Position of AUnitsArray[1]) offset by 1000.00 towards (Real(AIntergerArray[1])) degrees)
        Unit - Order AUnitsArray[2] to Move To Movepoint
        Trigger - Turn on ARazor Doodad Collision Copy <gen>
        Trigger - Turn on ARazor Units Collision Copy <gen>
        Trigger - Turn on ARazor Wall Bounce Collision <gen>
        Trigger - Turn on ARazor Secondary Movement Copy <gen>

i try this spell with 2 hero. if A hero throw the glaive after B hero, B hero's glaive is removed. but both of them are in the same team(red). i am not sure if that also effect other hero in other team. thats why i wanna test if i throw a glaive after blue(AI), would that remove blue's glaive. but i cant find a trigger that orders blue to cast this spell(Bouncing Glaive).
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
Code:
Trigger - Turn on ARazor Doodad Collision Copy <gen>
Trigger - Turn on ARazor Units Collision Copy <gen>
Trigger - Turn on ARazor Wall Bounce Collision <gen>
Trigger - Turn on ARazor Secondary Movement Copy <gen>

What are all these triggers?
 

Sooda

Diversity enchants
Reaction score
318
> i made a custom spell.

The order string to activate/ order to use/ or target point would be order string what you based off of your custom spell. When I would use Human Storm Bolt as base spell for my custom spell then I would use action like this to order unit to use it:
Code:
Actions
    Unit - Order (Triggering unit) to Human Mountain King - Storm Bolt (Picked unit)
Triggering unit and Picked unit will change in your trigger think as Unit A (Caster,Triggering unit) would target unit B (Target,Picked unit).
If you want to make trigger what orders your unit to use ability on other unit will need first a bit of triggering. You need caster and target or point where to cast your spell.
For that first store your units to variable array:
"unitsInReaction" is unit variable array with default starting value.
"unitCounter" is integer variable with default starting value.
Code:
Select To Units For Test
    Events
        Player - Player 1 (Red) Selects a unit
    Conditions
    Actions
        Set unitCounter = (unitCounter + 1)
        Set unitsInReaction[unitCounter] = (Triggering unit)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                unitCounter Greater than or equal to 2
            Then - Actions
                Set unitCounter = 0
            Else - Actions
Code:
Order unit A To Target Unit B
    Events
        Player - Player 1 (Red) types a chat message containing -gounit as An exact match
    Conditions
    Actions
        Unit - Order unitsInReaction[1] to Human Mountain King - Storm Bolt unitsInReaction[2]
Code:
Order unit A To Target Point
    Events
        Player - Player 1 (Red) types a chat message containing -goPoint as An exact match
    Conditions
    Actions
        Unit - Order unitsInReaction[1] to Undead Dreadlord - Carrion Swarm ((Position of unitsInReaction[1]) offset by 100.00 towards (Facing of unitsInReaction[1]) degrees)
It should give you idea how to order units to cast/ attack other units or locations.

EDIT: Hm... next time please be more specific what you want to tell us. Simply your spell isn' t MUI what means more than one unit can' t cast your spell at same time or while your spell trigger is still running. For that you need to use local variables or global arrays.
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
> those triggers are just the animation triggers. some buff effect.

Do they have waits? It would be helpful if I could see them....
 

rax_7

New Member
Reaction score
1
Code:
ARazor Doodad Collision Copy
    Events
        Time - Every 0.37 seconds of game time
    Conditions
        AIntergerArray[2] Greater than AIntergerArray[3]
    Actions
        Destructible - Pick every destructible within 100.00 of (Position of AUnitsArray[2]) and do (Set BounceOffDoodads = (Picked destructible))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Distance between (Position of AUnitsArray[2]) and (Position of BounceOffDoodads)) Less than or equal to 100.00
            Then - Actions
                Set Movepoint = ((Position of AUnitsArray[2]) offset by 500.00 towards ((Facing of AUnitsArray[2]) - (180.00 + (Random real number between -55.00 and 55.00))) degrees)
                Unit - Make AUnitsArray[2] face Movepoint over 0.00 seconds
                Unit - Order AUnitsArray[2] to Move To Movepoint
                Special Effect - Create a special effect at (Position of AUnitsArray[2]) using Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
                Set SFX = (Last created special effect)
                Special Effect - Destroy SFX
                Set AIntergerArray[3] = (AIntergerArray[3] + 1)
                If (AIntergerArray[2] Equal to AIntergerArray[3]) then do (Trigger - Run ARazor Return Copy <gen> (ignoring conditions)) else do (Do nothing)
            Else - Actions
                Do nothing

Code:
ARazor Units Collision Copy
    Events
        Time - Every 0.37 seconds of game time
    Conditions
        AIntergerArray[2] Greater than AIntergerArray[3]
    Actions
        Unit Group - Pick every unit in (Units in (Region centered at (Position of AUnitsArray[2]) with size (200.00, 200.00)) matching ((((Matching unit) belongs to an enemy of (Owner of AUnitsArray[1])) Equal to True) and (((Matching unit) is alive) Equal to True))) and do (Set BounceOff = (Picked unit))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Distance between (Position of BounceOff) and (Position of AUnitsArray[2])) Less than or equal to 100.00
            Then - Actions
                Set Movepoint = ((Position of AUnitsArray[2]) offset by 500.00 towards ((Facing of AUnitsArray[2]) - (180.00 + (Random real number between -55.00 and 55.00))) degrees)
                Unit - Make AUnitsArray[2] face Movepoint over 0.00 seconds
                Unit - Order AUnitsArray[2] to Move To Movepoint
                Special Effect - Create a special effect at (Position of AUnitsArray[2]) using Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
                Set SFX = (Last created special effect)
                Special Effect - Destroy SFX
                Unit - Cause AUnitsArray[1] to damage BounceOff, dealing (15.00 x (Real((Level of Bouncing Glaive for AUnitsArray[1])))) damage of attack type Normal and damage type Normal
                Set AIntergerArray[3] = (AIntergerArray[3] + 1)
                If (AIntergerArray[2] Equal to AIntergerArray[3]) then do (Trigger - Run ARazor Return Copy <gen> (ignoring conditions)) else do (Do nothing)
            Else - Actions
                Do nothing

Code:
ARazor Wall Bounce Collision
    Events
        Time - Every 0.10 seconds of game time
    Conditions
        AIntergerArray[2] Greater than AIntergerArray[3]
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Terrain cliff level at (Position of AUnitsArray[2])) Greater than AIntergerArray[4]
            Then - Actions
                Set Movepoint = ((Position of AUnitsArray[2]) offset by 500.00 towards ((Facing of AUnitsArray[2]) - (180.00 + (Random real number between -55.00 and 55.00))) degrees)
                Unit - Make AUnitsArray[2] face Movepoint over 0.00 seconds
                Unit - Order AUnitsArray[2] to Move To Movepoint
                Special Effect - Create a special effect at (Position of AUnitsArray[2]) using Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
                Set SFX = (Last created special effect)
                Special Effect - Destroy SFX
                Set AIntergerArray[3] = (AIntergerArray[3] + 1)
                If (AIntergerArray[2] Equal to AIntergerArray[3]) then do (Trigger - Run ARazor Return Copy <gen> (ignoring conditions)) else do (Do nothing)
            Else - Actions
                Do nothing
Code:
ARazor Secondary Movement Copy
    Events
        Time - Every 0.05 seconds of game time
    Conditions
        AIntergerArray[2] Greater than AIntergerArray[3]
    Actions
        If ((Distance between (Position of AUnitsArray[2]) and Movepoint) Less than or equal to 200.00) then do (Set Movepoint = (Movepoint offset by 800.00 towards (Angle from (Position of AUnitsArray[2]) to Movepoint) degrees)) else do (Do nothing)

Code:
ARazor Return Copy
    Events
        Time - Every 0.50 seconds of game time
    Conditions
    Actions
        Trigger - Turn on (This trigger)
        Trigger - Turn off ARazor Doodad Collision Copy <gen>
        Trigger - Turn off ARazor Units Collision Copy <gen>
        Trigger - Turn off ARazor Secondary Movement Copy <gen>
        Trigger - Turn off ARazor Wall Bounce Collision <gen>
        Animation - Change AUnitsArray[2] turn speed to 1.00
        Set Movepoint = (Position of AUnitsArray[1])
        If ((Distance between (Position of AUnitsArray[1]) and (Position of AUnitsArray[2])) Less than or equal to 150.00) then do (Unit - Kill AUnitsArray[2]) else do (Do nothing)

Code:
ARazor Movement Copy
    Events
        Time - Every 0.10 seconds of game time
    Conditions
    Actions
        Unit - Make AUnitsArray[2] face Movepoint over 0.00 seconds
        Unit - Order AUnitsArray[2] to Move To Movepoint
        Animation - Change AUnitsArray[2] flying height to 100.00 at 1000000000.00

now this is the full trigger of the spell plus the one above.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top