Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #31  
Old 08-28-2009, 05:25 AM
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
xD i just did that and was posting as fixed. Ty.
__________________
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
  #32  
Old 08-28-2009, 06:41 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by Skyld View Post
Get off my forum
__________________
Do it with a DON!
Reply With Quote
  #33  
Old 08-28-2009, 08:24 AM
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
Its for the same code, so I'm going to keep posting the same problems with it here.
PHP Code:
function onCreated() {
  
this.setshape(13232);
}
function 
onActionWarpPlayert() {
  
temp.dest = {"testtourny.nw"22};
  
player.setlevel2(dest[0], dest[1], dest[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 ++;
          
this.chat "End of Round!";

        }else{
          
temp.mplayer1 = @ this.(@"sdematch" this.whatmatch)[0] @;
          
temp.mplayer2 = @ this.(@"sdematch" this.whatmatch)[1] @;
          
this.chat this.whatmatch;
        }
      }
    }
  }

What im working on now is where it does the "startmatches". Trying to get it to work where it goes through each match, warps the players in, then when they die, warps them out, then moves to match 2, and does the same thing all the way through match 10.
An example, or even just an explanation of what code to use. Tried everything I can remember, been 4 years since I touched this stuff.
__________________
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
  #34  
Old 08-28-2009, 05:46 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
Why are you putting @'s in the middle of no where lol.

I.e: this.whatmatch = @ this.(@"sdematch" @ i) @;
Should just be: this.whatmatch = this.(@"sdematch" @ i);

You generally use @ when you want to append things together. I.e:

PHP Code:
function onCreated() {
  
temp."ABC";
  
this.chat temp."DEF"// chat will be "ABCDEF"

and when you're using dynamic variables.

PHP Code:
function onCreated() {
  
this.lol "jk";
  
temp.var = "lol";
  
this.chat this.(@temp.var); // chat will be "jk"

But you are already using it that way.
__________________
Quote:
Reply With Quote
  #35  
Old 08-28-2009, 06:40 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
It didnt change a thing. Coding at 3am, that was my fault, I already understand how that works.
__________________
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...



Last edited by sssssssssss; 08-29-2009 at 07:03 AM..
Reply With Quote
  #36  
Old 08-29-2009, 07:31 AM
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
Ok, so it got it to at least start one match, having a problem setting the area when the player dies. This was my last attempt. Ive already tried using the function onPlayerDies() as well, instead of the player.hp part, neither worked at all. Any obvious thing Im missing?

PHP Code:
function onCreated() {
  
this.setshape(13232);
}
function 
onActionWarpPlayer(pobj)
  {
  
temp.player1 pobj[0];
  
temp.player2 pobj[1];
  
this.playerbattle = {player1player2};
  
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]);
  
player.chat this.playerbattle;
}

function 
onActionWarpPlayert(){
  
temp.desta = {"testtourny.nw"3030};
  
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 onCreated(){
  if (
player.hp <= 0){
    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
  #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
  #38  
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
  #39  
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
  #40  
Old 08-29-2009, 04:10 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
um, no crap?
People bomb on the way I do things, so if i do to someone else he is now my "butler"?
geeze.
__________________
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
  #41  
Old 08-29-2009, 04:11 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
um, no crap?
People bomb on the way I do things, so if i do to someone else he is now my "butler"?
geeze.
he's allowed to "bomb on you", cause he's a lot more skilled in GS2 than you
Reply With Quote
  #42  
Old 08-29-2009, 04:12 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
And he had a redundant idea, so I should just shut up? Can't say anything because he's better than me in gs2 even though its completely redundant? Wow.

Quote:
Originally Posted by Pelikano View Post
"I want this, I want that!"

wtf is that coming from? I didn't know i demanded something i wanted. Been asking and saying thank you alot through my posts, and how I appreciate everyones help. -_-
Just going to release this script in the code gallery anyways as finished, once it is.
__________________
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
  #43  
Old 08-29-2009, 05:03 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
Just going to release this script in the code gallery anyways as finished, once it is.
noo! please!
Reply With Quote
  #44  
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
  #45  
Old 08-30-2009, 12:00 AM
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
This forum got way off topic.
DB-NPC would work best, but like I said, no access to it, its not for a server I own or work on.
I went ahead and instead of doing an auto warp out for both sparrers after one dies, I just did a player.chats end match, tokenized, and then pulled a for() out and used that to warp them out after the match is over.
Thank you again for your help everyone.
__________________
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
Reply


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 10:02 AM.


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