| 08-13-2007, 07:10 AM | #1 |
Okay, so as previously stated, I'm really new to JASS. As in learning it tonight. Heres an attempt at converting a GUI trigger to JASS, but I'm having so much trouble... or something. JASS:function Trig_Attack_Copy_3_Copy_2_Func001Func002002003 takes nothing returns boolean return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetSpellAbilityUnit())) == true ) endfunction function Trig_Attack_Copy_3_Copy_2_Func001Func003002 takes nothing returns nothing call UnitDamageTargetBJ( GetSpellAbilityUnit(), GetEnumUnit(), ( 100.00 + ( I2R(GetHeroStatBJ(bj_HEROSTAT_STR, GetSpellAbilityUnit(), true)) * 2.50 ) ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL ) endfunction function Trig_Attack_Copy_3_Copy_2_Func001Func004002 takes nothing returns nothing call AddSpecialEffectTargetUnitBJ( "origin", GetEnumUnit(), "Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl" ) endfunction function Trig_Attack_Copy_3_Copy_2_Func001C takes nothing returns boolean if ( not ( GetSpellAbilityId() == 'A000' ) ) then return false endif return true endfunction function Trig_Attack_Copy_3_Copy_2_Actions takes nothing returns nothing if ( Trig_Attack_Copy_3_Copy_2_Func001C() ) then local unit c = GetTriggerUnit() local location cl = PolarProjectionBJ(c), 100.00, GetUnitFacing(c) local group hg = GetUnitsInRangeOfLocMatching(100.00, cl)], Condition(function Trig_Attack_Copy_3_Copy_2_Func001Func002002003)) call ForGroupBJ( hg)], function Trig_Attack_Copy_3_Copy_2_Func001Func003002 ) call ForGroupBJ( hg)], function Trig_Attack_Copy_3_Copy_2_Func001Func004002 ) set c = null set cl = null set hg = null else call DoNothing( ) endif endfunction //=========================================================================== function InitTrig_Attack_Copy_3_Copy_2 takes nothing returns nothing set gg_trg_Attack_Copy_3_Copy_2 = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Attack_Copy_3_Copy_2, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddAction( gg_trg_Attack_Copy_3_Copy_2, function Trig_Attack_Copy_3_Copy_2_Actions ) endfunction It is having problems with JASS:local unit c = GetTriggerUnit() local location cl = PolarProjectionBJ(c), 100.00, GetUnitFacing(c) local group hg = GetUnitsInRangeOfLocMatching(100.00, cl)], Condition(function Trig_Attack_Copy_3_Copy_2_Func001Func002002003)) call ForGroupBJ( hg)], function Trig_Attack_Copy_3_Copy_2_Func001Func003002 ) call ForGroupBJ( hg)], function Trig_Attack_Copy_3_Copy_2_Func001Func004002 ) set c = null set cl = null set hg = null I'm really new, so sorry if this is really obvious, but why can't I just do that and have it all work out? For when I'm setting locals it says "Expected 'endif'" and for the calls it says "Expected a name" and for the nulls it says "Expected a variable name." I'm guessing this all stems from the inability to set the locals, but if thats not how you set locals then how do you? Sorry >< |
| 08-13-2007, 07:18 AM | #2 |
|
| 08-13-2007, 07:26 AM | #3 |
Oh. There are some ] floating around. At the start of the function? Wait... but if I want to make it an if don't I need to do that first and then declare the variables? |
| 08-13-2007, 09:35 AM | #4 | ||
steem, the local variables must ever be declared as first no matter what you want to do. The only thing allowed to make before declaring the variables is to add comments. I reorganized your trigger and changed a few things.
Also i move the entire thing to x and y value, due you made some mistakes beside the mentioned. e.g. you tried to use a unit as location. Also you would have leaked 2 location and 1 group every time this function would have been executed. Beside that why did you use an if for getting the Spell Ability and didn't add it directly into the Trigger Condition? Well, in my oppinion it could still be a bit optimized, but i think this is much better. Here's the changelog
|
| 08-13-2007, 09:43 AM | #5 |
Erm. A lot of the errors came (maybe) from me first making this not multinstanceable in GUI and then trying to both a) convert it to JASS and b) make it multinstanceable, which I don't know if I succeeded in doing yet, but I was somewhat stuck over those errors. Thanks. EDIT: I tried to do it in X, Y first but I couldn't figure out how so then I tried it a different way. I'm also going about learning JASS all wrong (well not really, but read on) and I just sort of downloaded JassCraft and tried to guess at a lot of things while vaguely looking at the Stomp Spell tutorial for ideas on how to make this work... so um... yeah. |
