• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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 63
Joined
Jan 18, 2005
Messages
27,190
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