Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-29-2009, 04:02 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Quote:
Originally Posted by sssssssssss View Post
having a problem setting the area when the player dies.
Your code only sets out one player, unless they both die. If you look at what I was trying to do, it's pretty obvious that I wanted to warp out both players if one dies. it doesnt matter who wins in this code, they both need to be warped out once one dies.

So, I guess i could use what you did, and put the timer, and check for sparring, and then go through and look for the hearts, but, in a spar, the only people that should be dying are the people sparring, and checking for a tie, winner 1, or winner 2, and all that is a bit redundant compared to just using a serverside function onPlayerDies() to check the level for any player that dies, then warp them both back, eh?

First code in 4 years btw, not first code.
Anywho, changed it a bit, no results. Im trying to set it where when it starts the match, it finds the players by comm name, then sets a this.array to hold it in, so that way, if the playerdies, it can check if any account in the level is in that array, then warp them out of the spar. This is what i have thus far.

PHP Code:
function onCreated() {
  
this.setshape(13232);
}

function 
onActionWarpPlayer(pobj)
  {
  
temp.player1 pobj[0];
  
temp.player2 pobj[1];
  
temp.pl1 findplayerbycommunityname(player1);
  
temp.pl2 findplayerbycommunityname(player2);
  
temp.dest = {"testtourny.nw"2020};
  
pl1.setlevel2(dest[0], dest[1], dest[2]);
  
pl2.setlevel2(dest[0], dest[1], dest[2]);
  
this.playerbattle = {pl1pl2};
  
player.chat this.playerbattle;
}

function 
onActionWarpPlayert(){
  
temp.desta = {"testtourny.nw"4040};
  
player.setlevel2(desta[0], desta[1], desta[2]);

}

function 
onActionSetMatchServer(matchvplayersplayer) {
  for (
temp.0temp.<= 10temp.i++) {
    if (
match == imakevar("this.sdematch" i) = {vplayersplayer};
  }
}


function 
onPlayerTouchsMe(){
  
temp.matchlist "";
  for (
temp.1temp.<= 10temp.++)
    {
    
matchlist @= "Match " ": " this.(@"sdematch" i)[0] @ " vs. " this.(@"sdematch" i)[1] @ "#b";
  }
  
say2(matchlist);

}
function 
onPlayerChats(){
  if (
player.account in serverr.sdeaccess)
    {
    if (
player.chat.starts("setmatch")) {
      
temp.match player.chat.tokenize()[1];
      
temp.vplayer player.chat.tokenize()[2];
      
temp.splayer player.chat.tokenize()[3];
      
triggeraction(this.0.5this.0.5"SetMatchServer"temp.matchtemp.vplayer,temp.splayer);
    }
    if (
player.chat.starts("startmatches")){
      for (
temp.1temp.<= 10temp.i++) {
        
this.whatmatch = {this.(@"sdematch" i)};
        if (
this.whatmatch == 0){
          
this.whatmatch ++;
        }else{
          
triggeraction(this.0.5this.0.5"WarpPlayer"this.whatmatch);

        }
      }
    }
  }
}
//#CLIENTSIDE
function onPlayerDies(){
  if (
player.account in this.playerbattle)
    {
    
triggeraction(this.0.5this.0.5"WarpPlayert""");
  }

__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #2  
Old 08-29-2009, 04:05 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Quote:
Originally Posted by sssssssssss View Post
Your code only sets out one player, unless they both die. If you look at what I was trying to do, it's pretty obvious that I wanted to warp out both players if one dies. it doesnt matter who wins in this code, they both need to be warped out once one dies.

So, I guess i could use what you did, and put the timer, and check for sparring, and then go through and look for the hearts, but, in a spar, the only people that should be dying are the people sparring, and checking for a tie, winner 1, or winner 2, and all that is a bit redundant compared to just using a serverside function onPlayerDies() to check the level for any player that dies, then warp them both back, eh?

First code in 4 years btw, not first code.
He's not your butler, he's trying to help you.

"I want this, I want that!"

god
Reply With Quote
  #3  
Old 08-29-2009, 06:56 PM
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
Quote:
Originally Posted by sssssssssss View Post
Your code only sets out one player, unless they both die. If you look at what I was trying to do, it's pretty obvious that I wanted to warp out both players if one dies. it doesnt matter who wins in this code, they both need to be warped out once one dies.

So, I guess i could use what you did, and put the timer, and check for sparring, and then go through and look for the hearts, but, in a spar, the only people that should be dying are the people sparring, and checking for a tie, winner 1, or winner 2, and all that is a bit redundant compared to just using a serverside function onPlayerDies() to check the level for any player that dies, then warp them both back, eh?
I coded it as an example of what it could be, and my code does only check the people who are sparring, which are stored in this.player_a and this.player_b. Obviously I wasn't going to include the warping of the players.

I don't trust onPlayerDies(), nor have I used it. Personally I would probably have the death check directly in the damage system but that depends on the setup of the server, and the systems they have.

This script should be it's own DB-NPC, because then you can actually see the errors as you code it, and can use it easily over multiple levels.
__________________
Quote:
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:28 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.