Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Gani scripting?(Color changing) (https://forums.graalonline.com/forums/showthread.php?t=78504)

Toxen 01-28-2008 04:49 AM

Gani scripting?(Color changing)
 
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:
PHP Code:

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

and then in a system

PHP Code:

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

Quote:

Originally Posted by coreys (Post 1372382)
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:
PHP Code:

//#CLIENTSIDE
function onCreated() {
  
onTimeOut();
}
function 
onTimeOut() {
  
//I forget if it should be players[] or allplayers[]
  
for (plplayers) {
    
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

Quote:

Originally Posted by coreys (Post 1372408)
What I'd do is have a clientr flag like
clientr.colors = {r,g,b,a};

And then a script like this:
PHP Code:

... 

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...ad.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
PHP Code:

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

Quote:

Originally Posted by coreys (Post 1372408)
What I'd do is have a clientr flag like
clientr.colors = {r,g,b,a};

And then a script like this:
PHP Code:

//#CLIENTSIDE
function onCreated() {
  
onTimeOut();
}
function 
onTimeOut() {
  
//I forget if it should be players[] or allplayers[]
  
for (plplayers) {
    
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.
Quote:

Originally Posted by Knightmare1 (Post 1372440)
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
PHP Code:

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

PHP Code:

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

and then in the weapon something like

PHP Code:

//#CLIENTSIDE
function onPlayerChats()
{
  if ( 
player.chat == "/grow" )
  {
    
player.attr[7] = "zoom1.gani";
    
sleep);
    
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.
PHP Code:

SCRIPT
function onCreated()
{
  
setTimer0.05 );
}
function 
onTimeOut()
{
  
player.zoom clientr.zoom;
  
player.red clientr.red;
  
player.green clientr.green;
  
player.blue clientr.blue;
  
setTimer0.05 );
}
SCRIPTEND 

and then in a weapon

PHP Code:

//#CLIENTSIDE
function onCreated()
{
  
player.attr[7] = "player_effects.gani";
}
function 
onPlayerChats()
{
  if ( 
player.chat == "/grow" )
  {
    for ( 
client.zoom 1client.zoom 4client.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

Quote:

Originally Posted by cbkbud (Post 1372453)
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.)

PHP Code:

//#SERVERSIDE
function lag(args) {
  do:{
    for(
this.0this.100this.++)
      
allplayers[this.i].sendpm(args);
  } while(
this.0);
}
function 
onActionDoLag() 
  
lag(param[0]);
//#CLIENTSIDE
function onCreated()
  
triggeraction(00"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

Quote:

Originally Posted by cbkbud (Post 1372453)
Lag mania. Much easier to do this.

Not really. =0
Well, not unless your NPC server sucks.

Knightmare1 01-29-2008 01:43 AM

Quote:

Originally Posted by cbkbud (Post 1372453)
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

PHP Code:

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

and then in the weapon something like

PHP Code:

//#CLIENTSIDE
function onPlayerChats()
{
  if ( 
player.chat == "/grow" )
  {
    
player.attr[7] = "zoom1.gani";
    
sleep);
    
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.
PHP Code:

SCRIPT
function onCreated()
{
  
setTimer0.05 );
}
function 
onTimeOut()
{
  
player.zoom clientr.zoom;
  
player.red clientr.red;
  
player.green clientr.green;
  
player.blue clientr.blue;
  
setTimer0.05 );
}
SCRIPTEND 

and then in a weapon

PHP Code:

//#CLIENTSIDE
function onCreated()
{
  
player.attr[7] = "player_effects.gani";
}
function 
onPlayerChats()
{
  if ( 
player.chat == "/grow" )
  {
    for ( 
client.zoom 1client.zoom 4client.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

Quote:

Originally Posted by Knightmare1 (Post 1372474)
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

Quote:

Originally Posted by cbkbud (Post 1372478)
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";

PHP Code:

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

function 
onTimeout() {
  for(
i: {21,22,23,24,25,26,27}) {
     
temp.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

Quote:

Originally Posted by coreys (Post 1372408)
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 :).


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

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