Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-19-2015, 07:23 PM
devilsknite1 devilsknite1 is offline
C:
devilsknite1's Avatar
Join Date: Jul 2006
Location: Florida, USA
Posts: 269
devilsknite1 has a spectacular aura about
Send a message via AIM to devilsknite1 Send a message via MSN to devilsknite1 Send a message via Yahoo to devilsknite1
Gani Scripting and Player Referencing

I have run into an issue that I am not entirely sure how to resolve. I currently am using a gani to display an image above the players' head of that players' specific choosing. I am displaying the gani through a player attribute. This is my gani script:
PHP Code:
SCRIPT
//#CLIENTSIDE
function onCreated() {
  
onPlayerEnters();
}
function 
onPlayerEnters() {
  
with findImg) ) {
    
image clientr.player_icon;
    
player.x;
    
player.y;
    
attachToOwner true;
    
attachOffset "1.1,-1.3,0";
    
mode 1;
  }
}
SCRIPTEND 
The problem I seem to run into now is that clientr.player_icon is not by any means attaching to the specific player that the gani is stored to in that player's attributes. Instead, it will display my clientr.player_icon image. How do I store the image differently, or at least reference the other player's clientr.player_icon so it shows theirs on my screen and mine on theirs? I would like to keep the display of the image inside the gani if possible.

I understand this is a tad confusing in the wording, so essentially what is happening is if I am player a, and player b is another player, and we both have different clientr.player_icon images, player a will see his icon image on his screen, and player b's icon will also display player a's clientr.player_icon, even when they are different and vice versa. Any help is appreciated.

I also know that the index of the image is always the same, which could be an issue, but I wouldn't think that it would matter if it is stored in a gani and displayed through a player attribute... Though I could be wrong. I have the script clientside in the gani, so I'm not so sure that would make a difference anyways.
Reply With Quote
  #2  
Old 06-19-2015, 09:44 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
player.attr[#] = "youricon.gani,image.png";

then in the script reference:

temp.icon = (@player.attr[#])[1];
__________________
Quote:
Reply With Quote
  #3  
Old 06-20-2015, 12:31 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
Jer is right of course, but for context, remember that other players' attributes (client/clientr/most of player except stuff like nick, dir, x, y, attr, etc) are not synced clientside. So you won't be able to access another players' client/clientr variables locally.

(The obvious reason for this is that it would require sending tons of data. Plus it might contain information you don't want to be known to other players.)

The suggestion above is to shove them into attr, which is one of the attributes that *is* synced to other players.
__________________
Reply With Quote
  #4  
Old 06-20-2015, 05:32 PM
devilsknite1 devilsknite1 is offline
C:
devilsknite1's Avatar
Join Date: Jul 2006
Location: Florida, USA
Posts: 269
devilsknite1 has a spectacular aura about
Send a message via AIM to devilsknite1 Send a message via MSN to devilsknite1 Send a message via Yahoo to devilsknite1
Thanks for the help you two!
I couldn't load the attribute as an array by using (@player.attr[#])[1], so I had to end up treating it as a string and using:
PHP Code:
temp.icon player.attr12 ].substringplayer.attr12 ].pos"," ) + 1player.attr12 ].length() ); 
However, it still does not load gani, which obviously disallows the image to be shown. Is it still possible for the gani to be shown with the attribute of which contains the gani and is also storing the image displaying in the gani? Storing it in two separate attributes works fine, but it would be nice to condense it into one.

Last edited by devilsknite1; 06-20-2015 at 06:56 PM..
Reply With Quote
  #5  
Old 06-20-2015, 11:26 PM
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 devilsknite1 View Post
I couldn't load the attribute as an array by using (@player.attr[#])[1], so I had to end up treating it as a string and using:
PHP Code:
temp.icon player.attr12 ].substringplayer.attr12 ].pos"," ) + 1player.attr12 ].length() ); 
It might be easier to do something like

PHP Code:
temp.icon player.attr[12].tokenize(",")[1]; 
I think this will work but not entirely certain.

Quote:
However, it still does not load gani, which obviously disallows the image to be shown. Is it still possible for the gani to be shown with the attribute of which contains the gani and is also storing the image displaying in the gani? Storing it in two separate attributes works fine, but it would be nice to condense it into one.
I think so, but unfortunately can't remember and can't test it (no Linux client), sorry!
__________________
Reply With Quote
  #6  
Old 06-21-2015, 12:48 AM
devilsknite1 devilsknite1 is offline
C:
devilsknite1's Avatar
Join Date: Jul 2006
Location: Florida, USA
Posts: 269
devilsknite1 has a spectacular aura about
Send a message via AIM to devilsknite1 Send a message via MSN to devilsknite1 Send a message via Yahoo to devilsknite1
Quote:
Originally Posted by cbk1994 View Post
no Linux client
I feel your pain.
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:26 PM.


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