Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   help with targeting system (https://forums.graalonline.com/forums/showthread.php?t=73394)

shadowjones 04-09-2007 10:39 PM

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! ^_^

Rapidwolve 04-09-2007 11:01 PM

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);



Chompy 04-09-2007 11:15 PM

Quote:

Originally Posted by Rapidwolve (Post 1298514)
PHP Code:

//some script.. 


You can't read other player's clientr. strings clientside..

Rapidwolve 04-09-2007 11:22 PM

Quote:

Originally Posted by Chompy (Post 1298523)
You can't read other player's clientr. strings clientside..

Poo :( never knew that, well actually never tried it o_O

shadowjones 04-09-2007 11:23 PM

Quote:

Originally Posted by Rapidwolve (Post 1298525)
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 ^_^

Rapidwolve 04-09-2007 11:33 PM

Quote:

Originally Posted by shadowjones (Post 1298526)
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); 



Skyld 04-10-2007 05:17 PM

Undeleting the thread so that others may see the resolution.


All times are GMT +2. The time now is 02:43 PM.

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