2007.10.22, 08:45 PM
I'm not sure what's wrong with this. It works fine offline, but on a server it doesn't work. Supposed to restart the map every foo amount of time. Should be fairly obvious as to how it works. Could it be that functionality like this doesn't work online?
-- Please no off-topic posting. Try to keep your answers useful.
-- Please no off-topic posting. Try to keep your answers useful.
Code:
// ***********************************************************
//
// Game Script
//
// This script is the main script for the entire game.
//
// ***********************************************************
// menu item ids
var MENU_ITEM_CONTINUE=0;
var MENU_ITEM_SETUP=2;
var MENU_ITEM_SAVE_LOAD=3;
var MENU_ITEM_SHOW_CONSOLE=10;
var MENU_ITEM_HIDE_CONSOLE=11;
// other ids, etc
const GAME_TIMER_ID=100;
var currentTime=60;
//
// game startup
//
function gameConstruct(game)
{
// set the scaling factor for the bitmaps
iface.screen.widthScale=640;
iface.screen.heightScale=480;
// get starting spot for player
if (map.setting.multiplayer) {
map.action.setHostMap('Spawn','Player');
}
game.event.startTimer(10,GAME_TIMER_ID);
// set timer variable, in seconds
currentTime=60;
}
function gameTimer(game)
{
if (currentTime!=0) {
iface.text.setText('Timer',currentTime);
currentTime--;
} else {
game.event.clearTimer();
game.event.sendMessageToPlayer(997);
game.event.startWait(50, 996);
}
}
//
// handle menu events
//
function gameMenuSelect(id)
{
switch (id) {
case MENU_ITEM_CONTINUE:
return;
case MENU_ITEM_SETUP:
iface.interaction.startSetup();
return;
case MENU_ITEM_SAVE_LOAD:
iface.interaction.startSaveLoad();
return;
case MENU_ITEM_SHOW_CONSOLE:
iface.console.show();
return;
case MENU_ITEM_HIDE_CONSOLE:
iface.console.hide();
return;
}
}
//
// handle score changes for players in game
//
function gameScore(game)
{
switch (game.setting.type) {
case 'CTF':
game.score.setScore(game.score.goal);
break;
default:
game.score.setScore(game.score.kill+1);
break;
}
}
//
// handle game events
//
function event(game,mainEvent,subEvent,id,tick)
{
switch (mainEvent) {
case DIM3_EVENT_CONSTRUCT:
gameConstruct(game);
return;
case DIM3_EVENT_MENU:
gameMenuSelect(id);
return;
case DIM3_EVENT_RULE_SCORE:
gameScore(game);
return;
case DIM3_EVENT_WAIT:
map.action.restartMap();
return;
}
}
All network games that are quake/UT like are client to client with the server acting as a negotiator.