PDA

View Full Version : Players Can't see stretchx?


i8bit
05-28-2014, 10:54 PM
So I was doing some tests and I found out that other players can't see the manipulation function of 'stretch'..

//#CLIENTSIDE
function onKeyPressed(code, key){
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
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.

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:


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

i8bit
05-29-2014, 05:23 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:


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
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.

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

i8bit
05-29-2014, 07:20 PM
You can set an animation as an attribute.

//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:


//#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


SCRIPT
function onPlayerEnters() {
player.stretchx = (params[0] == 1) ? -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]