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

[Trigger] Action in function of a variable

Status
Not open for further replies.
Level 14
Joined
Sep 28, 2011
Messages
968
I tryed to make a mod where there is approx 600 spells and where each spell have a differant effect. But or I need to make hundreds of if then else or I need to make hundreds of triggers whith conditions so I think that if they were a way to make an action in function of an array variable would make all easy.For example I want to lower life of one unit in one of my spell I set a variable to call "SetWidgetLife(udg_U,100)" and when the spell is casted it apply the variable code.But I think it is not possible I tryed three times in three differant ways.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
It is possible, you just need to bind the function to a trigger which you run or use the slower execute function native that takes a string for function name. Ofcourse this means a wrapper function.

function wraper takes nothing returns nothing
SetWidgetLife(udg_U,100)
endfunction

Consider making an engine which only loads event responses for abilities that are actually usable. Pointless checking for an ability to be cast that is impossible to cast in the current game state.
 
Level 14
Joined
Sep 28, 2011
Messages
968
But with that will you be able to make vary the executed function in function of the index of the variable without if then else abuse.I am trying.thanks.And where you talking of ExecuteFunc (string funcName)
 
Last edited:
Status
Not open for further replies.
Top