| 07-23-2006, 01:00 PM | #1 |
Here's my whole trigger. JASS:function Trig_Turn_on_Damage_Conditions takes nothing returns boolean return ( GetSpellAbilityId() == 'A00E' ) endfunction function HasB002Buff takes nothing returns boolean return GetUnitAbilityLevel(GetFilterUnit(), 'B002') > 0 endfunction function StartTimer takes nothing returns nothing loop call StartTimerBJ( t, false, r ) call UnitDamageTargetBJ( tu, GetEnumUnit(), r, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_FIRE, WEAPON_TYPE_WHOKNOWS) call PolledWait( 1 ) endloop endfunction function Trig_Turn_on_Damage_Actions takes nothing returns nothing local unit u = GetTriggerUnit() local integer i = GetUnitAbilityLevelSwapped('A00E', u ) local real r = i * 2 local unit tu local timer t = CreateTimerBJ(false, r) call CreateNUnitsAtLoc( 1, 'e001', GetOwningPlayer(u), GetUnitLoc(u), bj_UNIT_FACING ) set tu = GetLastCreatedUnit() call ForGroupBJ( GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function HasB002Buff)), StartTimer ) endfunction COMPILE ERROR ONE: expected a name JASS:call StartTimerBJ( t, false, r ) COMPILE ERROR TWO: expected a name JASS:call UnitDamageTargetBJ( tu, GetEnumUnit(), r, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_FIRE, WEAPON_TYPE_WHOKNOWS) COMPILE ERROR THREE: expected a '(' JASS:call ForGroupBJ( GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function HasB002Buff)), StartTimer ) I think errors one and two have to do with the 'r' variable, and number 3 I just don't know where to put the dman parentheses... |
| 07-23-2006, 01:05 PM | #2 |
JASS:function StartTimer takes nothing returns nothing loop call StartTimerBJ( t, false, r ) Dude, 'r' is nothing. 'r' does not exist in that function. Neither does 't'. And so on. Maybe you should read the introduction to JASS again. |
| 07-23-2006, 01:09 PM | #3 |
You cannot use locals outside the function they are in. That is the problem with the first two, hence why I used a FirstOfGroup loop. For the third, you need to put in function _____ for the last part, otherwise it thinks you are putting in a local variable. It also leaks a lot. |
| 07-23-2006, 01:30 PM | #4 |
It's been forever since I read the intro to JASS, not to mention this was pretty much the first time I had multiple functions and locals variables. @Captain Griffen- Are the leaks major? I'll use your trigger if I must, but please make sure it does what I needed it to do, as stated in my response in that thread. Can you null variables out of that function, or do you need to null them in the function? |
| 07-23-2006, 02:14 PM | #5 |
I think you need guidance more than a tutorial. So please help us help you, read this what is the correct version of the code, if you have questions about the reasons of the differences please ask. I could not add the thing you want to do with the picked units because I didn't understand that at all, so please explain JASS:function Trig_Turn_on_Damage_Conditions takes nothing returns boolean return ( GetSpellAbilityId() == 'A00E' ) endfunction // What is this about? what is exactly what you want to do? // really, this doesn't make much sense //function StartTimer takes nothing returns nothing // loop // call StartTimerBJ( t, false, r ) // call UnitDamageTargetBJ( tu, GetEnumUnit(), r, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_FIRE, WEAPON_TYPE_WHOKNOWS) // call PolledWait( 1 ) // endloop //endfunction function Trig_Turn_on_Damage_Actions takes nothing returns nothing local unit u = GetTriggerUnit() local integer i = GetUnitAbilityLevelSwapped('A00E', u ) local real r = i * 2 local unit tu local timer t = CreateTimerBJ(false, r) local group g=GetUnitsInRectMatching(GetPlayableMapRect() local unit pickedunit set tu = CreateUnit(GetOwningPlayer(u),'e001',GetUnitX(u),GetUnitY(y),bj_UNIT_FACING) loop set pickedunit=FirstOfGroup(g) exitwhen pickedunit==null if (GetUnitAbilityLevel(pickedunit, 'B002') > 0) then //things to do with picked unit-- endif call GroupRemoveUnit(g,pickedunit) endloop set u=null set tu=null set t=null set g=null endfunction |
| 07-23-2006, 02:34 PM | #6 |
Okay Vex, I'm down to a single error, after tons of changing and other crap. Here is the latest (and hopefully closest to any solution) code. Oh, and about the loop on the previous trigger, it was crappy and incomplete. I was still working on it at the time. JASS:function Trig_Turn_on_Damage_Conditions takes nothing returns boolean return ( GetSpellAbilityId() == 'A00E' ) endfunction function HasB002Buff takes nothing returns boolean return GetUnitAbilityLevel(GetFilterUnit(), 'B002') > 0 endfunction function StartTimer takes nothing returns nothing local unit u = GetTriggerUnit() local integer i = GetUnitAbilityLevelSwapped('A00E', u ) local real r = i * 2 local real r2 = 1.0 local timer t = CreateTimer() local unit tu local unit pu = GetEnumUnit() call CreateNUnitsAtLoc( 1, 'e001', GetOwningPlayer(u), GetUnitLoc(u), bj_UNIT_FACING ) set tu = GetLastCreatedUnit() loop call TimerStart( t, r, false, null) exitwhen (TimerGetRemaining(t) == 0.) call UnitDamageTargetBJ( tu, pu, r, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_FIRE, WEAPON_TYPE_WHOKNOWS) call PolledWait(r2) endloop endfunction function Trig_Turn_on_Damage_Actions takes nothing returns nothing call ForGroupBJ( GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function HasB002Buff)), function StartTimer ) endfunction SPELL: Basically, war stomp, with another trigger to add flames. The spell deals damage (via ability editor) then is supposed to make the units affected take extra damage == to the level of the ability * 2, for (level of ability * 2) seconds. This is what the trigger was needed for. TRIGGER: as of now... The trigger kicks in upon the spell being cast. It checks to see that the spell cast is Flame Stomp (A00E). Then, it runs the unit group action, which adds it's units who match the condition (having Flame Stomp buff) to the group. It then runs the function StartTimer. StartTimer is supposed to deal the damage per second to all units in the unit group. From the way it looks, I doubt that happens. A loop in StartTimer is what deals damage. This can be seen in the trigger. I truly hope this helps, as this spell has taken me (and I'm not kidding) 12 hours on end of work, deleting, checking, adding, subtracting, dancing, and more crap. Hopefully, the last few triggers I put out will work. And once this works, it will be a guide for any future spells of mine that may use a format like this. |
