• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] What am I doing wrong?

Status
Not open for further replies.
Level 5
Joined
Nov 22, 2009
Messages
181
JASS:
function Trig_portal_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A000' ) ) then
        return false
    endif
    return true
endfunction

function portal_actions takes nothing returns nothing
    local location loc1 = GetRectCenter(RectFromCenterSizeBJ(GetUnitLoc(GetSpellAbilityUnit()), 100.00, 100.00))
    local location loc2 = GetRectCenter(RectFromCenterSizeBJ(GetSpellTargetLoc(), 100.00, 100.00))
    local unit portal1
    local unit portal2
        call CreateNUnitsAtLoc( 1, 'h000', GetOwningPlayer(GetSpellAbilityUnit()), loc1, bj_UNIT_FACING )
        set portal1 = GetLastCreatedUnit()
        call CreateNUnitsAtLoc( 1, 'h000', GetOwningPlayer(GetSpellAbilityUnit()), loc2, bj_UNIT_FACING )
        set portal2 = GetLastCreatedUnit()
        call WaygateSetDestinationLocBJ( portal1, loc2 )
        call WaygateSetDestinationLocBJ( portal2, loc1 )
        call RemoveLocation(loc1)
        call RemoveLocation(loc2)
        set loc1 = null
        set loc2 = null
        set portal1 = null
        set portal2 = null
endfunction

function InitTrig_portal takes nothing returns nothing
  set udg_portal = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( udg_portal, EVENT_PLAYER_UNIT_SPELL_FINISH )
    call TriggerAddCondition( udg_portal, Condition( function Trig_portal_Conditions ) )
    call TriggerAddAction( udg_portal, function portal_actions )
endfunction

Unit 'h000' is a custom unit called Portal with the waygate ability. This JASS script is supposed to create 2 Portals. One portal should be located at the casters location and the other should be located at the ability's target location. Then it should set the waygate destination of the first portal to the location of the second and vice versa. What did I do wrong for each line? I've tried testing the trigger but it says:

"Line 64:Expected a variable name"
the line is: "set gg_trg_portal = CreateTrigger( )"
"Line 65: Expected a name"
and it seems to go: "EVENT_PLAYER_UNIT_SPELL_FINISH" in the add event part of the InitTrig_portal function."
"Line 66: Expected a name"
then it shows and highlights: "Condition( function Trig_portal_Conditions ) )"
"Line 67: Expected a name"
it shows and highlights: ", function portal_actions )"
 
Last edited:
Level 5
Joined
Nov 22, 2009
Messages
181
ok i ended up fixing those issues with help but for some reason, when i use the spell, it does not do anything. Also what is the point of tags in the first place?
 
Last edited:
Status
Not open for further replies.
Top