Deleted member 231919
D
Deleted member 231919
I am new to jass, just trying to figure out how to initialize and use a global variable. The code below doesn't work for some reason. I have been asking chat gpt for help and it has been very helpful in accelerating my learning with jass. I am using TESH WC3 editor. I can get this code to work with local variables, but needing to use globals. I have tried declaring GUI globals and then using udg_currentStrength and udg_newStrength, but that doesn't work either. I know multiple programming languages, so I am not new to coding. Thanks for any help.
JASS:
globals
real currentStrength = 0.0
real newStrength = 0.0
endglobals
function Trig_Dart_Transform_Actions takes nothing returns nothing
// Get the hero's current strength
set currentStrength = GetHeroStr(gg_unit_H000_0000, true)
// Calculate the new strength
set newStrength = currentStrength * 1.50
call SetHeroStr(gg_unit_H000_0000, R2I(newStrength), true)
endfunction
//===========================================================================
function InitTrig_Dart_Transform takes nothing returns nothing
set gg_trg_Dart_Transform = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Dart_Transform, GetOwningPlayer(gg_unit_H000_0000), "dd", true )
call TriggerAddAction( gg_trg_Dart_Transform, function Trig_Dart_Transform_Actions )
endfunction