• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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