• 🏆 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] One Player Game End

Status
Not open for further replies.
Level 9
Joined
Apr 23, 2011
Messages
460
I was wondering what is wrong with the script. I used Jasscraft to write it, and it parsed successfully, but WE won't let it go, it says that it expected a name in the first function and several other errors. Any Ideas?
JASS:
function GetPlayerCount takes nothing returns integer
local integer count = CountPlayersInForceBJ(udg_Players_Group)
return count
endfunction

function IsOnePlayer takes nothing returns boolean
    if ( not ( GetPlayerCount() == 1 ) ) then
        return false
    endif
return true
endfunction

function PlayerIsOne takes nothing returns nothing
local player p
    if IsOnePlayer() then
        set p = ForcePickRandomPlayer(udg_Players_Group)
        call CustomDefeatBJ(p,"One player not allowed")
    endif
set p = null
endfunction

function InitTrig_One_Player_Game takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerAddAction(t,function PlayerIsOne)
call TriggerRegisterTimerEventPeriodic(t,1)
set t = null
endfunction

edit: fixed indenting for script to be "prettier".
 
Last edited:
Level 19
Joined
Aug 8, 2007
Messages
2,765
You need to use JNGP. JassCraft uses JNGP's JassHelper (a form of it) by default
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
"Expected a Name'" is a common error when you use a vJass script without JassHelper, but i can't tell anything else besides horrible indenting
 
Status
Not open for further replies.
Top