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
  #1  
Old 09-07-2010, 06:41 AM
iSlayer iSlayer is offline
Snk for manager
iSlayer's Avatar
Join Date: Feb 2010
Location: Room 7, Era Hotel, Era
Posts: 202
iSlayer will become famous soon enough
Adding players EXP once baddy killed

Ok this is serverside and it happens once the baddy is dead

PHP Code:
if(this.hp <= 0) {
 
getnearestplayer(this.xthis.y
Not sure what to do next
__________________
Snk for manager




Quote:
Originally Posted by Admins View Post
Snk for manager of Era
Reply With Quote
  #2  
Old 09-07-2010, 06:45 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Just keep track of the player who last hit it, no reason to use findNearestPlayers.
__________________
Reply With Quote
  #3  
Old 09-07-2010, 06:45 AM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
have it send the players account as a parameter every time the player attacks as you would with damage then have it check to see if it is dead everytime it takes damage and if it is either have it join a class for player functions or join it to the player directly. then do addExp(amount); you can also do some checks to see if they are in a party and if so evenly distribute it throught the party.
Reply With Quote
  #4  
Old 09-07-2010, 06:46 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Cubical View Post
have it send the players account as a parameter every time the player attacks as you would with damage then have it check to see if it is dead everytime it takes damage and if it is either have it join a class for player functions or join it to the player directly. then do addExp(amount); you can also do some checks to see if they are in a party and if so evenly distribute it throught the party.
No reason to send the account as a parameter. The player will be in scope in triggers.
__________________
Reply With Quote
  #5  
Old 09-07-2010, 06:47 AM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
Quote:
Originally Posted by cbk1994 View Post
No reason to send the account as a parameter. The player will be in scope in triggers.
oh u rite, the other stuff still applies.
Reply With Quote
  #6  
Old 09-07-2010, 07:02 AM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
class
PHP Code:
function addExp(amount){
  
clientr.exp += amount;

baddy
PHP Code:
join("player_functions");
function 
onActionServerside(cmd){
  switch (
cmd){
    case 
"addexp":
      
addExp(amount);
      break;
  }
}
//#CLIENTSIDE
function onCheckDead(){
  
// do checks
  
triggerserver("gui"name"addexp"); 

However joining the player to the class on login could simplify it and make it a bit more accessible. Using the same class you can just do player.addExp(amount); anywhere serverside by doing this on login.

PHP Code:
  player.join("player_functions"); 
then your code would look like this
PHP Code:
function onActionServerside(cmd){
  switch (
cmd){
    case 
"addexp":
      
player.addExp(amount);
      break;
  }
}
//#CLIENTSIDE
function onCheckDead(){
  
// do checks
  
triggerserver("gui"name"addexp"); 

Reply With Quote
  #7  
Old 09-07-2010, 07:13 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Unless your baddies are completely clientside (different for each player), there's no excuse for doing checks on clientside like that. If he's using triggers he can handle those serverside.
__________________
Reply With Quote
  #8  
Old 09-08-2010, 06:41 AM
iSlayer iSlayer is offline
Snk for manager
iSlayer's Avatar
Join Date: Feb 2010
Location: Room 7, Era Hotel, Era
Posts: 202
iSlayer will become famous soon enough
Quote:
Originally Posted by Cubical View Post
class
PHP Code:
function addExp(amount){
  
clientr.exp += amount;

baddy
PHP Code:
join("player_functions");
function 
onActionServerside(cmd){
  switch (
cmd){
    case 
"addexp":
      
addExp(amount);
      break;
  }
}
//#CLIENTSIDE
function onCheckDead(){
  
// do checks
  
triggerserver("gui"name"addexp"); 

However joining the player to the class on login could simplify it and make it a bit more accessible. Using the same class you can just do player.addExp(amount); anywhere serverside by doing this on login.

PHP Code:
  player.join("player_functions"); 
then your code would look like this
PHP Code:
function onActionServerside(cmd){
  switch (
cmd){
    case 
"addexp":
      
player.addExp(amount);
      break;
  }
}
//#CLIENTSIDE
function onCheckDead(){
  
// do checks
  
triggerserver("gui"name"addexp"); 

Hmm where would I put the exp because the baddy uses this.exp
__________________
Snk for manager




Quote:
Originally Posted by Admins View Post
Snk for manager of Era
Reply With Quote
  #9  
Old 09-08-2010, 07:08 AM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
Quote:
Originally Posted by iSlayer View Post
Hmm where would I put the exp because the baddy uses this.exp
PHP Code:
player.addExp(this.amount); 
or if you don't have the class joined to the player but you have it joined to the npc then do
PHP Code:
addExp(this.amount); 
or if you have it in a different weapon as a public function do
PHP Code:
(@ "Systems/PlayerFunctions").addExp(this.amount); 
Reply With Quote
  #10  
Old 09-08-2010, 09:21 AM
iSlayer iSlayer is offline
Snk for manager
iSlayer's Avatar
Join Date: Feb 2010
Location: Room 7, Era Hotel, Era
Posts: 202
iSlayer will become famous soon enough
But where?
__________________
Snk for manager




Quote:
Originally Posted by Admins View Post
Snk for manager of Era
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 11:40 AM.


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