Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Players Can't see stretchx? (https://forums.graalonline.com/forums/showthread.php?t=134269249)

i8bit 05-28-2014 10:54 PM

Players Can't see stretchx?
 
So I was doing some tests and I found out that other players can't see the manipulation function of 'stretch'..

PHP Code:

//#CLIENTSIDE
function onKeyPressed(codekey){
 if (
key == "z"){
  
player.stretchx = -1;
  
player.chat "Reflection Test";
 }


Obviously when you do it, you can see it on your screen.... But how do I set it so other players can see the manipulation too?

Jakov_the_Jakovasaur 05-28-2014 11:02 PM

the problem here is that stretchx/stretchy/red/green/blue/alpha/mode/rotation/zoom etc are not synchronised between players

the most common way to accomplish this is to set a player.attr[index] value (these are synchronised between players) to a gani script (which are processed on every players client), and then set stretchx within that gani script

i8bit 05-28-2014 11:42 PM

Quote:

Originally Posted by Jakov_the_Jakovasaur (Post 1727518)
the problem here is that stretchx/stretchy/red/green/blue/alpha/mode/rotation/zoom etc are not synchronised between players

the most common way to accomplish this is to set a player.attr[index] value (these are synchronised between players) to a gani script (which are processed on every players client), and then set stretchx within that gani script

How do you modify the gani script or stretchx through the weapon script?
I am trying to do everything through that...


Allow me to elaborate on what I'm doing..

I have a system where the player can only move left and right.
All the player's ganis are set to singledir and they face left.
The system detects which way the player is facing and sets the stretchx according to that.

PHP Code:

if (player.globaldir == "left"){
 
player.stretchx 1;
}
if (
player.globaldir == "right"){ 
 
player.stretchx = -1;


globaldir is just a variable I made and sets when needed.

ANYWAY, I need the modifications done through the weapons script so other players can see. Help please :)

Jakov_the_Jakovasaur 05-29-2014 05:16 PM

in that case why not just make a left and right version of the gani, and then for each gani file edit them as text and include:

PHP Code:

SCRIPT
function onPlayerEnters() {
  
player.stretchx = -1;
  
//player.stretchx = 1;
}
SCRIPTEND 


i8bit 05-29-2014 05:23 PM

Quote:

Originally Posted by Jakov_the_Jakovasaur (Post 1727551)
in that case why not just make a left and right version of the gani, and then for each gani file edit them as text and include:

PHP Code:

SCRIPT
function onPlayerEnters() {
  
player.stretchx = -1;
  
//player.stretchx = 1;
}
SCRIPTEND 


I thought about it but wanted to avoid the complications of it because I'm using replaceAni but I'll figure it out! thanks for input though..
I'll see what I can do. If you think of anything else let me know!

Emera 05-29-2014 05:53 PM

Quote:

Originally Posted by i8bit (Post 1727552)
I thought about it but wanted to avoid the complications of it because I'm using replaceAni but I'll figure it out! thanks for input though..
I'll see what I can do. If you think of anything else let me know!

You can set an animation as an attribute.

PHP Code:

//player.attr[index] = "TheAni.gani";
player.attr[5] = "swim.gani"


i8bit 05-29-2014 07:20 PM

Quote:

Originally Posted by Emera (Post 1727554)
You can set an animation as an attribute.

PHP Code:

//player.attr[index] = "TheAni.gani";
player.attr[5] = "swim.gani"


I could just use setAni for same thing...I messed around with it and I'd still have to make a left and a right of all the Ganis which I don't want to have to do...
It gets messed up with replaceAni.. (using default movement)

Why can't player.stretchx just work correctly :(
Maybe I should put in feature requests

fowlplay4 05-29-2014 07:33 PM

example

Weapon:

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
faceLeft();
}

function 
faceLeft() {
  
player.attr[5] = "";
  
player.attr[5] = "server_stretch.gani,1";
}

function 
faceRight() {
  
player.attr[5] = "";
  
player.attr[5] = "server_stretch.gani,0";


server_stretch.gani

PHP Code:

SCRIPT
function onPlayerEnters() {
  
player.stretchx = (params[0] == 1) ? -1;
}
SCRIPTEND 


i8bit 05-29-2014 09:11 PM

That was a bit** to figure out. BUT I GOT IT :)

I set the player.attr[4] to either 1 or -1
1 = left
-1 = right

In the gani script for each animation I just made the stretchx = player.attr[4]


All times are GMT +2. The time now is 08:48 PM.

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