Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Gani Scripting and Player Referencing (https://forums.graalonline.com/forums/showthread.php?t=134270012)

devilsknite1 06-19-2015 07:23 PM

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.

fowlplay4 06-19-2015 09:44 PM

player.attr[#] = "youricon.gani,image.png";

then in the script reference:

temp.icon = (@player.attr[#])[1];

cbk1994 06-20-2015 12:31 AM

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.

devilsknite1 06-20-2015 05:32 PM

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.

cbk1994 06-20-2015 11:26 PM

Quote:

Originally Posted by devilsknite1 (Post 1736818)
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!

devilsknite1 06-21-2015 12:48 AM

Quote:

Originally Posted by cbk1994 (Post 1736819)
no Linux client

I feel your pain. :p


All times are GMT +2. The time now is 07:37 PM.

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