How do you make a Unit Cast a custom spell?

Penultimate

New Member
Reaction score
2
Hi, I'm new to thehelper.net and I believe this is the correct place to post this thread. If not, then I do apologize.

Now that I'm done with the introduction, I will talk about the topic. I read on XXXconanXXX's AI-Basics and Triggers that a way to order a computer controlled unit to cast a spell, you need to either choose a spell from the preset list, or you type the order string of the spell.

Here is what I have:

JASS:

function Trig_Rashok_Actions takes nothing returns nothing
    call TriggerSleepAction( 2.00 )
    call IssueTargetOrderBJ( gg_unit_U000_0020, "fingerofdeath", GetAttacker() )
endfunction

//===========================================================================
function InitTrig_Rashok takes nothing returns nothing
    set gg_trg_Rashok = CreateTrigger(  )
    call TriggerRegisterUnitEvent( gg_trg_Rashok, gg_unit_U000_0020, EVENT_UNIT_ATTACKED )
    call TriggerAddAction( gg_trg_Rashok, function Trig_Rashok_Actions )
endfunction


Trigger:
  • I converted the JASS from a trigger. Here is the trigger:
    • Rashok original
      • Events
        • Unit - Rashok 0020 <gen> Is attacked
      • Conditions
      • Actions
        • Wait 2.00 seconds
        • Unit - Order Rashok 0020 <gen> to Orc Raider - Ensnare (Attacking unit)


The problem I was having involved how the unit Rashok, wouldn't cast an ability. I have put the ability finger of death in Rashok's ability list. Also, Rashok is a Hero. And Finger of Death uses the order string fingerofdeath.

If anyone can help explain to me how to fix my problem, it would be most appreciated. And thank you in advance for reading this post.
 

Solmyr

Ultra Cool Member
Reaction score
30
Natives such as [ljass]GetAttacker()[/ljass] tend to get buggy after [ljass]TriggerSleepAction()[/ljass].

Do this instead:
JASS:
function Trig_Rashok_Actions takes nothing returns nothing
    local unit attacker = GetAttacker()
    call TriggerSleepAction(2.00)
    call IssueTargetOrder(gg_unit_U000_0020, "fingerofdeath", attacker)
    set attacker = null
endfunction

//===========================================================================
function InitTrig_Rashok takes nothing returns nothing
    set gg_trg_Rashok = CreateTrigger(  )
    call TriggerRegisterUnitEvent( gg_trg_Rashok, gg_unit_U000_0020, EVENT_UNIT_ATTACKED )
    call TriggerAddAction( gg_trg_Rashok, function Trig_Rashok_Actions )
endfunction

Nevertheless, you really shouldn't be using [ljass]TriggerSleepAction()[/ljass] if you're planning to make a good map.
 

Penultimate

New Member
Reaction score
2
I just tested it, and that didn't help fix my problem. But thanks anyway. Though I would really like some help on my function/trigger/thing.

Thanks in advance!
 

NeuroToxin

New Member
Reaction score
46
Just go to Neutral Hostile - Finger Of Death in GUI actions, no need for the JASS. Orc Raider - Ensnare is NOT the action for ensnare.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
Some abilities like Finger of Death (Archimonde) don't have a default order string. Change the order string field and try the "fingerofdeath" order again.
 

Penultimate

New Member
Reaction score
2
I'm sorry, but not of that seemed to work. I'm trying to make a boss fight, and I don't want the boss to be a unit with a ton of health that takes maybe five minutes and button mashing. I would really like to make boss that casts spells, not just a boss with a lot of damage and health.

Thanks in advance.
 
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