| 10-11-2006, 01:31 PM | #1 |
I wrote the following trigger and when I try to save it WEU tells me it has a bunch of problems, but it looks fine to me. Can anyone tell me if its just WEU being annoying or where i've gone wrong? JASS:function Dimir_Machinations_Conditions takes nothing returns boolean if ( not ( GetSpellAbilityId == 'A0OM' ) ) then return false else return true endif endfunction Function Dimir_Machinations_Actions takes nothing returns nothing set bj_forLoopIndexA = 1 set bj_forLoopIndexAEnd = 2 loop Exitwhen bj_forLoopIndexA > bj_forLoopIndexAEnd call UnitRemoveItemFromSlotSwapper ( GetRandomInt (1, 6), GetSpellTargetUnit() ) call RemoveItem ( GetLastRemovedItem() ) set bj_forLoopIndexA = bj_forLoopIndexA + 1 endloop endfunction //** ===================================================================================== function InitTrig_Dimir_Machinations takes nothing returns nothing set gg_trg_Dimir_Machinations = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ ( gg_trg_Dimir_Machinations, EVENT_PLAYER_UNIT_SPELL_CAST ) call TriggerAddCondition( gg_trg_Dimir_Machinations, Condition( function Trig_Dimir_Machinations_Conditions ) ) call TriggerAddAction( gg_trg_Dimir_Machinations, function Trig_Dimir_Machinations_Actions ) endfunction |
| 10-11-2006, 01:44 PM | #2 |
You might want to replace Code:
UnitRemoveItemFromSlotSwapper Code:
UnitRemoveItemFromSlotSwapped |
| 10-11-2006, 02:11 PM | #3 |
Rewrote the trigger, it now looks like this: JASS:function Dimir_Machinations_Conditions takes nothing returns boolean if ( Not( GetSpellAbilityId == 'G0OM') ) then return false else return true endif endfunction function Dimir_Machinations_Actions takes nothing returns nothing set BJ_ForloopAindex = 1 set BJ_ForloopAindexend = 2 loop exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd UnitRemoveItemFromSlotSwapped(GetRandomInt(1, 6),GetSpellTargetUnit) RemoveItem(GetLastRemovedItem) set bj_forLoopAIndex = bj_forLoopAIndex +1 endloop endfunction function InitTrig_Dimir_Machinations takes nothing returns nothing set gg_trg_Dimir_Machinations = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(gg_trg_Dimir_macinations, EVENT_PLAYER_UNIT_SPELL_CAST) call TriggerAddCondition(gg_trg_Dimir_machinations,Dimir_Macinations_Conditions) call TriggerAddAction(gg_trg_dimir_machinations,Dimir_Macinations_Actions) endfunction |
| 10-11-2006, 02:24 PM | #4 |
you forgot the the () after GetSpellTargetUnit and GetLastRemovedItem when i'm correct ![]() |
| 10-11-2006, 02:55 PM | #5 | |
Quote:
oops fixed those and therefore call functions in front...still won't accept it >.<. Got 2 trigger with similar problems...the second probably has more errors than the first :( JASS:function Dimir_Machinations_Conditions takes nothing returns boolean if ( Not( GetSpellAbilityId() == 'G0OM') )then return false endif return true endfunction function Dimir_Machinations_Actions takes nothing returns nothing local integer BJ_ForloopAindex local integer BJ_ForloopAindexend set BJ_ForloopAindex = 1 set BJ_ForloopAindexend = 2 loop exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd call UnitRemoveItemFromSlotSwapped(GetRandomInt(1, 6),GetSpellTargetUnit()) call RemoveItem(GetLastRemovedItem()) set bj_forLoopAIndex = bj_forLoopAIndex +1 endloop endfunction function InitTrig_Dimir_Machinations takes nothing returns nothing set gg_trg_Dimir_Machinations = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(gg_trg_Dimir_macinations, EVENT_PLAYER_UNIT_SPELL_CAST) call TriggerAddCondition(gg_trg_Dimir_machinations,Dimir_Macinations_Conditions) call TriggerAddAction(gg_trg_dimir_machinations,Dimir_Macinations_Actions) endfunction JASS:function Dimir_Machinations_Conditions takes nothing returns boolean if ( Not( GetSpellAbilityId() == 'G0OM') )then return false endif return true endfunction function Dimir_Machinations_Actions takes nothing returns nothing local integer i = 1 loop exitwhen i>2 call UnitRemoveItemFromSlotSwapped(GetRandomInt(1, 6),GetSpellTargetUnit()) call RemoveItem(GetLastRemovedItem()) set i = i +1 endloop endfunction function InitTrig_Dimir_Machinations takes nothing returns nothing set gg_trg_Dimir_Machinations = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(gg_trg_Dimir_macinations, EVENT_PLAYER_UNIT_SPELL_CAST) call TriggerAddCondition(gg_trg_Dimir_machinations,Dimir_Macinations_Conditions) call TriggerAddAction(gg_trg_dimir_machinations,Dimir_Macinations_Actions) endfunction |
| 10-11-2006, 03:14 PM | #6 |
change your conditions func to: JASS:function Dimir_Machinations_Conditions takes nothing returns boolean if GetSpellAbilityId() == 'G0OM' then return true endif return false endfunction dunno why but JassShopPro gives me these errors in your current cond. func: Line 2: Cannot convert boolean to boolexpr Line 5: Cannot convert boolexpr to boolean you also forgot to press enter after 'then' so that your 'return false' got on its own line/row. |
| 10-11-2006, 03:22 PM | #7 |
Or event to: JASS:function Dimir_Machinations_Conditions takes nothing returns boolean return (GetSpellAbilityId() == 'G0OM') endfunction Also, JASS is case sensitive IIRC. So BJ_ForloopAindex and BJ_ForloopAindexend are not the same as bj_forLoopAIndex and bj_forLoopAIndexEnd JASS:function Dimir_Machinations_Actions takes nothing returns nothing local integer BJ_ForloopAindex local integer BJ_ForloopAindexend set BJ_ForloopAindex = 1 set BJ_ForloopAindexend = 2 loop exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd call UnitRemoveItemFromSlotSwapped(GetRandomInt(1, 6),GetSpellTargetUnit()) call RemoveItem(GetLastRemovedItem()) set bj_forLoopAIndex = bj_forLoopAIndex +1 endloop endfunction |
| 10-11-2006, 03:23 PM | #8 |
Fix your condition adding: call TriggerAddCondition(gg_trg_Dimir_machinations,Condition(Dimir_Macinations_Conditions)) |
| 10-11-2006, 03:30 PM | #9 |
Just about fixed one of them: JASS:function Dimir_Machinations_Conditions takes nothing returns boolean if GetSpellAbilityId() == 'A00M'then return true endif return false endfunction function Dimir_Machinations_Actions takes nothing returns nothing local integer i = 1 loop exitwhen i>2 call UnitRemoveItemFromSlotSwapped(GetRandomInt(1, 6),GetSpellTargetUnit()) call RemoveItem(GetLastRemovedItem()) set i = i +1 endloop endfunction function InitTrig_Dimir_Machinations takes nothing returns nothing local trigger gg_trg_Dimir_Machinations set gg_trg_Dimir_Machinations = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(gg_trg_Dimir_macinations, EVENT_PLAYER_UNIT_SPELL_CAST) call TriggerAddCondition(gg_trg_Dimir_machinations,Condition(Dimir_Macinations_Conditions)) call TriggerAddAction(gg_trg_dimir_machinations,Action(Dimir_Macinations_Actions)) endfunction What have i done now :( Be trying to sort the other one out now. Edit: Just realized i've only posted one so far...here is the other: JASS:function Induce_Paranoia_Conditions takes nothing returns boolean if GetSpellAbilityId() == 'A00K' then return true endif return false endfunction function Induce_Paranoia_func001 takes nothing returns boolean local group array Original_Owner if IsUnitInGroup(GetSpellTargetUnit, udg_Original_Owner[GetForLoopIndexA()]) == true then return true endif return false endfunction function Induce_Paranoia_Actions takes nothing returns nothing local integer i = 1 local group array Original_Owner local unit array player_hero set i = 1 loop exitwhen i > 10 if (Induce_Paranoia_func001()) then call UnitRemoveItemFromSlotSwapped(GetRandomInt(1,6), Player_hero[GetForLoopIndexA()]) call RemoveItem(GetLastRemovedItem()) endif set i = i + 1 endloop endfunction function InitTrig_Induce_Paranoia takes nothing returns nothing local trigger gg_trig_Induce_Paranoia set gg_trig_Induce_Paranoia = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(gg_trig_Induce_Paranoia,EVENT_PLAYER_UNIT_SPELL_CAST) call TriggerAddCondition(gg_trig_Induce_Paranoia,Induce_Paranoia_Conditions ) call TriggerAddAction(gg_trig_Induce_paranoia, Induce_Paranoia_Actions) |
| 10-11-2006, 03:30 PM | #10 |
you could also do some more optimizing (not that it matters in this case): from this: JASS:function Dimir_Machinations_Actions takes nothing returns nothing local integer i = 1 loop exitwhen i>2 call UnitRemoveItemFromSlotSwapped(GetRandomInt(1, 6),GetSpellTargetUnit()) call RemoveItem(GetLastRemovedItem()) set i = i +1 endloop endfunction to this: JASS:function Dimir_Machinations_Actions takes nothing returns nothing local integer i = 1 loop exitwhen i>2 call RemoveItem(UnitRemoveItemFromSlot(GetSpellTargetUnit(),GetRandomInt(0,5))) set i = i +1 endloop endfunction JASS:call TriggerAddAction(gg_trg_dimir_machinations,function Dimir_Macinations_Actions) call TriggerAddCondition(gg_trg_Dimir_machinations,Condition(function Dimir_Macinations_Conditions)) |
| 10-11-2006, 03:43 PM | #11 |
I did what you suggested, got rid of one more error, 3 become 2 :) JASS:function Dimir_Machinations_Conditions takes nothing returns boolean if GetSpellAbilityId() == 'A00M'then return true endif return false endfunction function Dimir_Machinations_Actions takes nothing returns nothing local integer i = 1 loop exitwhen i>2 call RemoveItem(UnitRemoveItemFromSlot(GetSpellTargetUnit(),GetRandomInt(0,5))) set i = i +1 endloop endfunction function InitTrig_Dimir_Machinations takes nothing returns nothing local trigger gg_trg_Dimir_Machinations set gg_trg_Dimir_Machinations = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(gg_trg_Dimir_Macinations, EVENT_PLAYER_UNIT_SPELL_CAST) //Error : Expected Name call TriggerAddCondition(gg_trg_Dimir_Machinations,Condition(function Dimir_Machinations_Conditions)) call TriggerAddAction(gg_trg_Cimir_Machinations, function Dimir_Machinations_Actions) //Error Expected Name endfunction |
| 10-11-2006, 03:47 PM | #12 |
JASS:call TriggerRegisterAnyUnitEventBJ(gg_trg_Dimir_Macinations, EVENT_PLAYER_UNIT_SPELL_CAST) JASS:call TriggerAddAction(gg_trg_Cimir_Machinations, function Dimir_Machinations_Actions) same thing here.. Cimir/Dimir |
| 10-11-2006, 03:50 PM | #13 |
The condition thing I posted about only applies to the condition, not the action. |
| 10-11-2006, 04:03 PM | #14 |
Yipee, one down one to go :D Gonna check it for typos after testing this trigger! Edit: Done another trigger: JASS:local integer i local unit array Player_Hero set i = GetPlayerId(GetOwningPlayer(GetSpellAbilityUnit())) call SetHeroInt(Player_Hero[i],R2I(GetHeroInt(Player_Hero[i],true) * 0.95), true) |
| 10-12-2006, 07:04 AM | #15 |
You didn't put anything inside Player_Hero, so the unit you're referring to as Player_Hero[i] doesn't exist. And I don't see why you should include bonuses in the int reduction. |
