HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Compiling Jass problems

10-11-2006, 01:31 PM#1
aidan_124
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?
Collapse 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
arpha_storm
You might want to replace
Code:
UnitRemoveItemFromSlotSwapper
with
Code:
UnitRemoveItemFromSlotSwapped
10-11-2006, 02:11 PM#3
aidan_124
Rewrote the trigger, it now looks like this:
Collapse 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
I don't get why it doesn't work :/
10-11-2006, 02:24 PM#4
Fireeye
you forgot the the () after GetSpellTargetUnit and GetLastRemovedItem when i'm correct
10-11-2006, 02:55 PM#5
aidan_124
Quote:
Originally Posted by Fireeye
you forgot the the () after GetSpellTargetUnit and GetLastRemovedItem when i'm correct

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 :(
Collapse 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

Collapse 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
oNdizZ
change your conditions func to:

Collapse 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
Alevice
Or event to:

Collapse 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


Collapse 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
blu_da_noob
Fix your condition adding:
call TriggerAddCondition(gg_trg_Dimir_machinations,Condition(Dimir_Macinations_Conditions))
10-11-2006, 03:30 PM#9
aidan_124
Just about fixed one of them:
Collapse 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
The highlighed lines say Error: Expected name
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:
Collapse 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)
(As a side note, when i try to enable the 2nd one, the Editor crashes, anyone got any idea why that may happen?)
10-11-2006, 03:30 PM#10
oNdizZ
you could also do some more optimizing (not that it matters in this case):
from this:
Collapse 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:

Collapse 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

Collapse 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
aidan_124
I did what you suggested, got rid of one more error, 3 become 2 :)
Collapse 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
Other than that this is amazing and you guys rule :)
10-11-2006, 03:47 PM#12
oNdizZ
Collapse JASS:
call TriggerRegisterAnyUnitEventBJ(gg_trg_Dimir_Macinations, EVENT_PLAYER_UNIT_SPELL_CAST)
check your trigger name again, spelling is important :P Macinations/Machinations

Collapse JASS:
call TriggerAddAction(gg_trg_Cimir_Machinations, function Dimir_Machinations_Actions)

same thing here.. Cimir/Dimir
10-11-2006, 03:50 PM#13
blu_da_noob
The condition thing I posted about only applies to the condition, not the action.
10-11-2006, 04:03 PM#14
aidan_124
Yipee, one down one to go :D
Gonna check it for typos after testing this trigger!

Edit:
Done another trigger:
Collapse 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)
The point of this is to decrease the players intel by 5% when he uses an item, the condition works fine so i think its this bit thats wrong. Should that work or am i doing something wrong?
10-12-2006, 07:04 AM#15
arpha_storm
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.