View Single Post
  #37  
Old 08-29-2009, 08:08 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
I see you're using triggers to call functions on the serverside, from the serverside. You can just call them directly:

onActionSetMatchServer(temp.match, temp.vplayer, temp.splayer);

instead of

triggeraction(this.x + 0.5, this.y + 0.5, "SetMatchServer", temp.match, temp.vplayer,temp.splayer);

Generally triggeraction is used to go from client to server, and vice versa.

Personally I'd have a loop watch the players health.

I.e:

PHP Code:
function onCreated() {
  
setTimer(0.5);
}

function 
onTimeout() {
  
// Only watch if there's an actual spar.
  
if (this.sparring) {
    
onWatchSpar();
    
setTimer(0.5);
  }
}

// Variables used for sake of example.
// this.player_a = findplayer("whoever");
// this.player_b = findplayer("someoneelse");

function onWatchSpar() {
  
// Both players dead?
  
if (this.player_a.hearts <= && this.player_b.hearts <= 0onTie();
  
// Player A Alive, and B dead?
  
else if (this.player_a.hearts && this.player_b.hearts <= 0onWin(this.player_a);
  
// Player B Alive, and A dead?
  
else if (this.player_b.hearts && this.player_a.hearts <= 0onWin(this.player_b);

Personally I think this may be a bit complicated for one of your first scripts :P
__________________
Quote:
Reply With Quote