PDA

View Full Version : Gani scripting?(Color changing)


Toxen
01-28-2008, 04:49 AM
What would be the most east way of makeing a gani where the player is all one color including the hats and shields and swords?

cbk1994
01-28-2008, 05:19 AM
just make a file named whatever you want, and then add this:

SCRIPT
player.red = 1;
player.blue = 0;
player.green = 0;
SCRIPTEND


and then in a system


player.attr[6] = "myfile.gani";

coreys
01-28-2008, 06:19 AM
It seems rather pointless to make that a gani, though, don't you think?

napo_p2p
01-28-2008, 08:14 AM
It seems rather pointless to make that a gani, though, don't you think?

I think it needs to be a gani so that other players can also see the effects.

coreys
01-28-2008, 04:21 PM
What I'd do is have a clientr flag like
clientr.colors = {r,g,b,a};

And then a script like this:

//#CLIENTSIDE
function onCreated() {
onTimeOut();
}
function onTimeOut() {
//I forget if it should be players[] or allplayers[]
for (pl: players) {
pl.red = pl.clientr.colors[0];
pl.blue = pl.clientr.colors[1];
pl.green = pl.clientr.colors[2];
pl.alpha = pl.clientr.colors[2];
}
setTimer(.5);
}
function onPlayerEnters() {
onTimeOut();
}

Using that has worked for me in the past, but I guess a gani would work as well, assuming he used player.attr[]'s for the rgb.

Chompy
01-28-2008, 05:02 PM
What I'd do is have a clientr flag like
clientr.colors = {r,g,b,a};

And then a script like this:

...

Using that has worked for me in the past, but I guess a gani would work as well, assuming he used player.attr[]'s for the rgb.

http://forums.graalonline.com/forums/showthread.php?t=78118

Dusty's player effects :)

Knightmare1
01-28-2008, 11:36 PM
well, i have been working on gani scripting (working as in trying to find out what the heck a gani script is!) and i was wondering, could i just do
//#CLIENTSIDE
function onPlayerChats()
{
if (player.chat == "/grow")
{
client.zoom=1;
sleep(1);
client.zoom=2;
sleep(1);
client.zoom=3;
sleep(1);
client.zoom=4;
}
}

to make the person grow really tall?

cbk1994
01-29-2008, 12:10 AM
What I'd do is have a clientr flag like
clientr.colors = {r,g,b,a};

And then a script like this:

//#CLIENTSIDE
function onCreated() {
onTimeOut();
}
function onTimeOut() {
//I forget if it should be players[] or allplayers[]
for (pl: players) {
pl.red = pl.clientr.colors[0];
pl.blue = pl.clientr.colors[1];
pl.green = pl.clientr.colors[2];
pl.alpha = pl.clientr.colors[2];
}
setTimer(.5);
}
function onPlayerEnters() {
onTimeOut();
}

Using that has worked for me in the past, but I guess a gani would work as well, assuming he used player.attr[]'s for the rgb.
Lag mania. Much easier to do this.
well, i have been working on gani scripting (working as in trying to find out what the heck a gani script is!) and i was wondering, could i just do
//#CLIENTSIDE
function onPlayerChats()
{
if (player.chat == "/grow")
{
client.zoom=1;
sleep(1);
client.zoom=2;
sleep(1);
client.zoom=3;
sleep(1);
client.zoom=4;
}
}

to make the person grow really tall?

No. You need the onPlayerChats to be in a weapon script.

I would have 4 different ganis;
zoom1.gani
zoom2.gani
zoom3.gani
zoom4.gani

and then something like this in each one


SCRIPT
player.zoom = #; // Replace # with 1, 2, 3, or 4
SCRIPTEND

and then in the weapon something like


//#CLIENTSIDE
function onPlayerChats()
{
if ( player.chat == "/grow" )
{
player.attr[7] = "zoom1.gani";
sleep( 1 );
player.attr[7] = "zoom2.gani";
}
}

and repeat that.

Of course, I would recommend having a player affects gani, and then a timeout in it, and then a player variable clientr.zoom. Something like this in the gani script.

SCRIPT
function onCreated()
{
setTimer( 0.05 );
}
function onTimeOut()
{
player.zoom = clientr.zoom;
player.red = clientr.red;
player.green = clientr.green;
player.blue = clientr.blue;
setTimer( 0.05 );
}
SCRIPTEND


and then in a weapon


//#CLIENTSIDE
function onCreated()
{
player.attr[7] = "player_effects.gani";
}
function onPlayerChats()
{
if ( player.chat == "/grow" )
{
for ( client.zoom = 1; client.zoom < 4; client.zoom += .1 )
{
sleep( .05 );
}
}
}


So that you get a more gradual zoom, and it is easier anyway. Note that I used client.zoom in that script, and clientr.zoom in the player effects, so make it client.zoom in both if you want. Sorry, I realized halfway through I needed to use client. vars.

Also, thought I'd mention this, the reason you don't need //#CLIENTSIDE in a gani script is because GANI scripts are always clientside. (No, you may not use //SERVERSIDE; (yes people still does this x.x) next time I see someone do this I will break their face.)

Too much ****ing code! I better get reputation for this! lol j/k

Chompy
01-29-2008, 12:39 AM
Also, thought I'd mention this, the reason you don't need //#CLIENTSIDE in a gani script is because GANI scripts are always clientside. (No, you may not use //SERVERSIDE; (yes people still does this x.x) next time I see someone do this I will break their face.)


//#SERVERSIDE
function lag(args) {
do:{
for(this.i = 0; this.i < 100; this.i ++)
allplayers[this.i].sendpm(args);
} while(this.i > 0);
}
function onActionDoLag()
lag(param[0]);
//#CLIENTSIDE
function onCreated()
triggeraction(0, 0, "DoLag", this.name, "If I can view this pm I don't lag!");


Bah, I just had to do it for lazyness, boredness and creativiness. I just wrote it up, if it works I'll laugh

coreys
01-29-2008, 12:44 AM
Lag mania. Much easier to do this.
Not really. =0
Well, not unless your NPC server sucks.

Knightmare1
01-29-2008, 01:43 AM
Lag mania. Much easier to do this.


No. You need the onPlayerChats to be in a weapon script.

I would have 4 different ganis;
zoom1.gani
zoom2.gani
zoom3.gani
zoom4.gani

and then something like this in each one


SCRIPT
player.zoom = #; // Replace # with 1, 2, 3, or 4
SCRIPTEND

and then in the weapon something like


//#CLIENTSIDE
function onPlayerChats()
{
if ( player.chat == "/grow" )
{
player.attr[7] = "zoom1.gani";
sleep( 1 );
player.attr[7] = "zoom2.gani";
}
}

and repeat that.

Of course, I would recommend having a player affects gani, and then a timeout in it, and then a player variable clientr.zoom. Something like this in the gani script.

SCRIPT
function onCreated()
{
setTimer( 0.05 );
}
function onTimeOut()
{
player.zoom = clientr.zoom;
player.red = clientr.red;
player.green = clientr.green;
player.blue = clientr.blue;
setTimer( 0.05 );
}
SCRIPTEND


and then in a weapon


//#CLIENTSIDE
function onCreated()
{
player.attr[7] = "player_effects.gani";
}
function onPlayerChats()
{
if ( player.chat == "/grow" )
{
for ( client.zoom = 1; client.zoom < 4; client.zoom += .1 )
{
sleep( .05 );
}
}
}


So that you get a more gradual zoom, and it is easier anyway. Note that I used client.zoom in that script, and clientr.zoom in the player effects, so make it client.zoom in both if you want. Sorry, I realized halfway through I needed to use client. vars.

Too much ****ing code! I better get reputation for this! lol j/k
um well this makes everyone grow, but they cant see it.

cbk1994
01-29-2008, 01:57 AM
um well this makes everyone grow, but they cant see it.

I'll help you in a bit if you like; right now I have to go do something. Sorry!

If you're on in a few hours I'll be happy to come on and help you.

Knightmare1
01-29-2008, 02:40 AM
I'll help you in a bit if you like; right now I have to go do something. Sorry!

If you're on in a few hours I'll be happy to come on and help you.

ok tyvm. and btw, you get a rep. and chris, if you come on my server, i can hire you, so we can talk and stuff on the server. its called Final Resort

Kristi
01-29-2008, 03:25 AM
I made one with transitional effects a long while back. You're all free to use it. You set the player's attribute to like
type min max
ex
2 0 1 would make the value go back and forth between 0 and 1 (since mode 2 is back and forth mode). It covered all the good effects

Put this in a gani script and make a player attribute the gani
ie player.attr[15]="whatever.gani";


SCRIPT
function onPlayerEnters() {
this.n = new[31];
this.c = new[31];
for(i: {21,22,23,24,25,26,27}) {
this.n[i] = 1;
this.c[i] = 0;
}
this.s = {"red","green","blue","alpha","zoom","rotation","mode"};
onTimeout();
}

function onTimeout() {
for(i: {21,22,23,24,25,26,27}) {
temp.t = player.attr[i].tokenize();
switch(temp.t[0]) {
case "0": //solid value
player.(@this.s[i-21]) = temp.t[1];
break;
case "1": //random
this.c[i] += .05;
if(this.c[i] >= temp.t[3]) {
this.c[i] = 0;
player.(@this.s[i-21]) = random(temp.t[1],temp.t[2]);
}
break;
case "2": //back and forth range
this.c[i] += .05;
if(this.c[i] >= temp.t[3]) {
this.c[i] = 0;
player.(@this.s[i-21]) += temp.t[4] * this.n[i];
if(player.(@this.s[i-21]) <= temp.t[1]) {
player.(@this.s[i-21]) = temp.t[1];
this.n[i] = 1;
}
if(player.(@this.s[i-21]) >= temp.t[2]) {
player.(@this.s[i-21]) = temp.t[2];
this.n[i] = -1;
}
}
break;
case "3": //constant loop
this.c[i] += .05;
if(this.c[i] >= temp.t[3]) {
this.c[i] = 0;
player.(@this.s[i-21]) += temp.t[4];
if(player.(@this.s[i-21]) <= temp.t[1]) {
player.(@this.s[i-21]) = temp.t[2];
}
if(player.(@this.s[i-21]) >= temp.t[2]) {
player.(@this.s[i-21]) = temp.t[1];
}
}
break;
}
}
setTimer(.05);
}
SCRIPTEND

napo_p2p
01-29-2008, 04:40 AM
What I'd do is have a clientr flag like
clientr.colors = {r,g,b,a};

The last time I checked, you couldn't read the clientr. flags of other players clientside :(. That would work if you used .attr[] though.

Ganis are the way to go with this. Hell Raven has a really good example there :).