- Joined
- Mar 4, 2018
- Messages
- 29
I am looking to design, among other future migraine inducers, an intricate aura. I'm starting with some baby steps and simply trying to make it so that if one hero is within 1000 distance of a certain other hero, they automatically learn a skill that grants them 5 int. If they leave this distance, they unlearn the skill again. I decided on this approach rather than just simply modifying the base int partly because I like that it's a green added number so you know it's a bonus, and partly because I expect it has less potential to bug out and permanently add or remove int.
So from looking at Blizzard-generated code and other people's code and changing things until I stopped getting error messages, I have arrived at the following creation.
And now let's talk about it. Firstly, I don't know where these unit names come from, I only figured them out by manually clicking the heroes with the GUI. Secondly, I believe I didn't need to introduce the variable u but some voices in my head are telling me that this will be needed later so that the "aura" can check for any allied unit.
But what's bugging me is why is this not enough? Blizzard wouldn't let me save the map with this trigger, so I pasted it into an empty Blizzard trigger and tinkered with it so it now looks like
I haven't made a trigger since StarCraft 1, but it seems to me I have a condition (a hero comes within a range of another) and something that happens if that is met, so I don't know why I need this gibberish afterwards.
But moving on, even having progressed to the point that I get no error messages, it's not actually doing anything in-game. I'll have you know that the great heroine known to you as gg_unit_H000_0006 does have the int bonus skill available to her and the trigger works when I design it with the GUI, but 1) I can only learn the skill with the GUI, not unlearn and 2) I'm reading pretty much everywhere that the GUI is inferior so I should not use it over code.
And lastly, with the GUI trigger it actually spent our great heroine gg_unit_H000_0006's initial skill point to learn the int boost, which also isn't intended behavior.
My body is ready to hear all the ways I suck at coding and there's plenty of lube available, but please do go easy on me.
So from looking at Blizzard-generated code and other people's code and changing things until I stopped getting error messages, I have arrived at the following creation.
Code:
function Augment takes nothing returns nothing
local unit u=gg_unit_H000_0006
if (IsUnitInRange(u,gg_unit_H001_0004, 1000)) then
call SetUnitAbilityLevel(u,'A00A',1)
else
call SetUnitAbilityLevel(u,'A00A',0)
endif
set u=null
endfunction
And now let's talk about it. Firstly, I don't know where these unit names come from, I only figured them out by manually clicking the heroes with the GUI. Secondly, I believe I didn't need to introduce the variable u but some voices in my head are telling me that this will be needed later so that the "aura" can check for any allied unit.
But what's bugging me is why is this not enough? Blizzard wouldn't let me save the map with this trigger, so I pasted it into an empty Blizzard trigger and tinkered with it so it now looks like
Code:
function Augment takes nothing returns nothing
local unit u=gg_unit_H000_0006
if (IsUnitInRange(u,gg_unit_H001_0004, 1000)) then
call SetUnitAbilityLevel(u,'A00A',1)
else
call SetUnitAbilityLevel(u,'A00A',0)
endif
set u=null
endfunction
//===========================================================================
function InitTrig_Augment takes nothing returns nothing
set gg_trg_Augment = CreateTrigger( )
call TriggerAddAction( gg_trg_Augment, function Augment )
endfunction
I haven't made a trigger since StarCraft 1, but it seems to me I have a condition (a hero comes within a range of another) and something that happens if that is met, so I don't know why I need this gibberish afterwards.
But moving on, even having progressed to the point that I get no error messages, it's not actually doing anything in-game. I'll have you know that the great heroine known to you as gg_unit_H000_0006 does have the int bonus skill available to her and the trigger works when I design it with the GUI, but 1) I can only learn the skill with the GUI, not unlearn and 2) I'm reading pretty much everywhere that the GUI is inferior so I should not use it over code.
And lastly, with the GUI trigger it actually spent our great heroine gg_unit_H000_0006's initial skill point to learn the int boost, which also isn't intended behavior.
My body is ready to hear all the ways I suck at coding and there's plenty of lube available, but please do go easy on me.
Last edited: