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 04-09-2007, 10:39 PM
shadowjones shadowjones is offline
**** Scripter xD
Join Date: Apr 2007
Posts: 24
shadowjones is on a distinguished road
help with targeting system

As you can probably tell with the past few posts I've made, I blow at GScript, but, o-well I'll learn soon enough. I've was just curious as to how to make a targeting system. To obtain the target you could just click on them. It'd be nice to have it so that it would show this script:

Quote:
showtext 201,32,64,Arial,b,Health: #s(clientr.player_hp)/#s(clientr.player_maxhp);
showtext 202,32,80,Arial,b,Mana: #s(clientr.player_mp)/#s(clientr.player_maxmp);
showtext 203,32,96,Arial,b,Class: #s(clientr.player_type);
To show, but instead of it being the users clientr.*, it would be the targets instead.

Any help would be appriciated! ^_^
Reply With Quote
  #2  
Old 04-09-2007, 11:01 PM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
PHP Code:
//#CLIENTSIDE
function onMouseDown(button){
  switch (
temp.button){
    case 
"left":
      
CheckPlayer(mousexmousey);
    break;
  }
}

function 
CheckPlayer(mxmy){
  
temp.pid testPlayer(temp.mxtemp.my);
  if (
temp.pid > -1
    
setTarget(players[temp.pid]);
}

public function 
setTarget(target){
  
temp.target findPlayer(temp.target);

  
temp.playerhpstats =  {temp.target.clientr.player_hptemp.target.clientr.player_maxhp};
  
temp.playermpstats = {temp.target.clientr.player_mptemp.target.clientr.player_maxmp};
  
temp.playerclass temp.target.clientr.player_type;

  
showText(2003264"Arial""b"format("Health: %f/%f"temp.playerhpstats[0], temp.playerhpstats[1]));
  
changeimgvis(2004);

  
showText(2013280"Arial""b"format("Mana: %f/%f"temp.playermpstats[0], temp.playermpstats[1]));
  
changeimgvis(2014);

  
showText(2023296"Arial""b"format("Class: %s"temp.playerclass));
  
changeimgvis(2024);

Reply With Quote
  #3  
Old 04-09-2007, 11:15 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Rapidwolve View Post
PHP Code:
//some script.. 
You can't read other player's clientr. strings clientside..
__________________
Reply With Quote
  #4  
Old 04-09-2007, 11:22 PM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Quote:
Originally Posted by Chompy View Post
You can't read other player's clientr. strings clientside..
Poo never knew that, well actually never tried it o_O
Reply With Quote
  #5  
Old 04-09-2007, 11:23 PM
shadowjones shadowjones is offline
**** Scripter xD
Join Date: Apr 2007
Posts: 24
shadowjones is on a distinguished road
Quote:
Originally Posted by Rapidwolve View Post
Poo never knew that, well actually never tried it o_O
still got further than this nub could ever get -_- thanks for trying.

I'll continue to try to work on it and make something work ^_^
Reply With Quote
  #6  
Old 04-09-2007, 11:33 PM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Quote:
Originally Posted by shadowjones View Post
still got further than this nub could ever get -_- thanks for trying.

I'll continue to try to work on it and make something work ^_^
As I said what you have to do now is trigger the server to get the information

PHP Code:
function onActionServerside(action){
  switch (
action){
    case 
"GetTargetInfo":
      
temp.target findPlayer(params[1]);
      
temp.hpstats = {temp.target.clientr.player_hptemp.target.clientr.player_maxhp};
      
temp.mpstats = {temp.target.clientr.player_mptemp.target.clientr.player_maxmp};
      
temp.targettype temp.target.clientr.player_type;
 
    
player.triggerClient("weapon"name"GotTargetInfo"temp.hpstatstemp.mpstatstemp.targettype);
    break;
  }
}

//#CLIENTSIDE
function onActionClientside(action){
  switch (
action){
    case 
"GotTargetInfo":
      
ShowTargetInfo(params[1], params[2], params[3]);
    break;
  }
}

function 
setTarget(target)
  
triggerServer("weapon"name"GetTargetInfo"temp.target);

function 
ShowTargetInfo(playerhpstatsplayermpstatsplayertype){

  
showText(2003264"Arial""b"format("Health: %f/%f"temp.playerhpstats[0], temp.playerhpstats[1])); 
  
changeimgvis(2004); 

  
showText(2013280"Arial""b"format("Mana: %f/%f"temp.playermpstats[0], temp.playermpstats[1])); 
  
changeimgvis(2014); 

  
showText(2023296"Arial""b"format("Class: %s"temp.playertype)); 
  
changeimgvis(2024); 

Reply With Quote
  #7  
Old 04-10-2007, 05:17 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Undeleting the thread so that others may see the resolution.
__________________
Skyld
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 06:00 PM.


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