- Joined
- Jun 6, 2015
- Messages
- 82
Ok so I am trying to learn LUA but I cant get anything to work. Yes I have changed to LUA in the Map Options. Example trigger:
This should kill my unit when he uses Summon Water Element. However, nothing happens, as with any other code.
I use Visual Studio Code and copy the code from there to a new custom script.
I thought I just did the codes wrong for a like 2 days now (maybe I did? Is the code above wrong?) but now it just seems that absolutely nothing works.
I am trying to learn programming in general, so I thought wc3 would be a great place to learn because here I can actually create something. I started with python the other day but I couldnt find anything to "create". In wc3, I can create anything.
I am aware that the solution is probably super easy, but I cant seem to find it.
If someone could tell me what I am doing wrong in the above script I'd be very happy.
Thanks in advance.
Lua:
function StartEffectOfAbility()
local trigger = CreateTrigger()
TriggerRegisterAnyUnitEventBJ(trigger, EVENT_PLAYER_UNIT_SPELL_EFFECT)
TriggerAddAction(trigger, function()
local caster = GetTriggerUnit()
if GetSpellAbilityId() == FourCC("AHwe") then
KillUnit(caster)
end
end)
end
This should kill my unit when he uses Summon Water Element. However, nothing happens, as with any other code.
I use Visual Studio Code and copy the code from there to a new custom script.
I thought I just did the codes wrong for a like 2 days now (maybe I did? Is the code above wrong?) but now it just seems that absolutely nothing works.
I am trying to learn programming in general, so I thought wc3 would be a great place to learn because here I can actually create something. I started with python the other day but I couldnt find anything to "create". In wc3, I can create anything.
I am aware that the solution is probably super easy, but I cant seem to find it.
If someone could tell me what I am doing wrong in the above script I'd be very happy.
Thanks in advance.