• 🏆 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] Jass Script Problem

Status
Not open for further replies.
Level 3
Joined
Jul 12, 2005
Messages
48
Ok im not quite sure how to use the actions "call toforce" and set function parameters. Im pretty sure im making some stupid mistake, but as im fairly inexperienced in jass, i would appreciate any help. the error im getting in the quoted lines are "expected '"



function random_hero takes rect selection returns
nothing
local player p = GetEnumPlayer()
local unit r = GroupPickRandomUnit(GetUnitsInRectOfPlayer(selection, Player(PLAYER_NEUTRAL_PASSIVE)))
if ( udg_Hero_Picking_Status[GetConvertedPlayerId(p)] == false ) then
set udg_Hero_Picking_Status[GetConvertedPlayerId(p)] = true
call SetUnitPositionLoc( r, GetPlayerStartLocationLoc(p) )
call SetUnitOwner( r, p, true )
call PanCameraToTimedLocForPlayer( p, GetUnitLoc(r), 0.50 )
set r = null
set p = null
else
endif
endfunction

function Trig_Hero_Selection_End_FuncRemoveUnit takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Hero_Selection_End_Actions takes nothing returns nothing
call TriggerSleepAction( 1.00 )
call DestroyTimerDialogBJ( GetLastCreatedTimerDialogBJ() )

call ForForce( udg_Alliance, function random_hero (gg_rct_Allied_Region_Selection))
call ForForce( udg_Undead, function random_hero (gg_rct_Undead_Region_Selection))
call ForGroup( GetUnitsInRectAll(gg_rct_Allied_Region_Selection), function Trig_Hero_Selection_End_FuncRemoveUnit )
call ForGroup( GetUnitsInRectAll(gg_rct_Undead_Region_Selection), function Trig_Hero_Selection_End_FuncRemoveUnit )
call DestroyTrigger( gg_trg_Hero_Selection_1)
call DestroyTrigger( gg_trg_Hero_Selection_2)
call DestroyTrigger( GetTriggeringTrigger() )
endfunction

//===========================================================================
function InitTrig_Hero_Selection_End takes nothing returns nothing
set gg_trg_Hero_Selection_End = CreateTrigger( )
call TriggerRegisterTimerExpireEventBJ( gg_trg_Hero_Selection_End, udg_Hero_Selection_Timer )
call TriggerAddAction( gg_trg_Hero_Selection_End, function Trig_Hero_Selection_End_Actions )
endfunction
 
Level 8
Joined
Nov 27, 2004
Messages
251
i think i got where the error is.


JASS:
if ( udg_Hero_Picking_Status[GetConvertedPlayerId(p)] == false ) then
set udg_Hero_Picking_Status[GetConvertedPlayerId(p)] = true
call SetUnitPositionLoc( r, GetPlayerStartLocationLoc(p) )
call SetUnitOwner( r, p, true )
call PanCameraToTimedLocForPlayer( p, GetUnitLoc(r), 0.50 )
set r = null
set p = null
else // here you tell to do else actions,but is empty!!! this could be the problem.
endif
 
Level 3
Joined
Jul 12, 2005
Messages
48
Thats not the problem, you dont have to tell it to do anything, if you leave it blank then nothing happens. Thanks for your reply though.
 
Level 13
Joined
Dec 29, 2004
Messages
597
call ForForce( udg_Alliance, function random_hero (gg_rct_Allied_Region_Selection))
call ForForce( udg_Undead, function random_hero (gg_rct_Undead_Region_Selection))

You can't use function that requires a parameter on ForForce, since ForForce expected a paramater as a code.

Oh, and it should be

JASS:
if true then
....
....
endif

rather than,

JASS:
if true then
....
....
else
endif

If you don't need 'else'.
 
Status
Not open for further replies.
Top