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 params + player.attr[] (https://forums.graalonline.com/forums/showthread.php?t=72108)

Chompy 02-10-2007 08:02 PM

gani params + player.attr[]
 
Well, this is what I am doing

PHP Code:

//#CLIENTSIDE
funciton onCreated()
{
  
player.attr10] = "";
  
player.attr10] = "chompy_float-text.gani,+12";


This is what I do to show the gani, now..

In the gani script I am using emitter to show some text at the players position, but it won't recieve params[ 0] (which should be +12)...
so the emitter is suppose to show +12 as text, but it doesn't show anything at all..

Anyone know what's not working?

Chompy 02-10-2007 08:54 PM

Hmm, I got it to work, by using two attrs, BUT!

When I use emitters (emitter.particle.text) in the gani script, then only the client can see it, the text :[

Which is quite annoying..

Kristi 02-10-2007 11:12 PM

Quote:

Originally Posted by Chompy (Post 1275892)
Hmm, I got it to work, by using two attrs, BUT!

When I use emitters (emitter.particle.text) in the gani script, then only the client can see it, the text :[

Which is quite annoying..

Is the text itsself assigned to an attr?

Chompy 02-11-2007 12:27 AM

Quote:

Originally Posted by Kristi (Post 1275937)
Is the text itsself assigned to an attr?

I did

PHP Code:

//#CLIENTSIDE
function onCreated()
{
  
player.attr10] = "";
  
player.attr10] = "chompy_float-text.gani";
  
player.attr11] = "";
  
player.attr11] = "+12";


When I do that, only I can see the '+12' text, and no others.. quite annoying

xXziroXx 02-11-2007 12:29 AM

Quote:

Originally Posted by Chompy (Post 1275960)
I did

PHP Code:

//#CLIENTSIDE
function onCreated()
{
  
player.attr10] = "";
  
player.attr10] = "chompy_float-text.gani";
  
player.attr11] = "";
  
player.attr11] = "+12";


When I do that, only I can see the '+12' text, and no others.. quite annoying

Uhm, why are you making the attributes blank before assigning a value..?

Chompy 02-11-2007 01:04 AM

Quote:

Originally Posted by xXziroXx (Post 1275962)
Uhm, why are you making the attributes blank before assigning a value..?

>_>

I know I don't need it for the attr 11, but I have to make it blank before assigning it to a gani..

Kristi 02-11-2007 01:45 AM

Quote:

Originally Posted by Chompy (Post 1275960)
I did

PHP Code:

//#CLIENTSIDE
function onCreated()
{
  
player.attr10] = "";
  
player.attr10] = "chompy_float-text.gani";
  
player.attr11] = "";
  
player.attr11] = "+12";


When I do that, only I can see the '+12' text, and no others.. quite annoying

may i see the code in the gani?

Chompy 02-11-2007 02:15 AM

PHP Code:

SCRIPT
function onCreated()
{
  
thiso.text player.attr11];
  
withfindimg20))
  {
    
attachtoowner true;
    
layer 2;
    
player.random( -0.5, -1);
    
player.random( -1, -0.1);

    
emitter.continueafterdestroy true;
    
emitter.nrofparticles 1;
    
emitter.emitautomatically false;

    
emitter.particle.lifetime 0.75;
    
emitter.particle.text thiso.text;
    
emitter.particle.mode 1;
    
    
emitter.particle.red 0;
    
emitter.particle.blue 0;
    
emitter.particle.green 1;
    
    
emitter.particle.style "b";
    
emitter.particle.alpha 1;
    
emitter.particle.zoom 0.95;

    
emitter.particle.angle pi 2;
    
emitter.particle.speed 1;

    
emitter.addlocalmodifier"range"0.3750.875"alpha""replace"10);
    
emitter.addlocalmodifier"range"0.10.75"speed""replace"42);
    
    
emitter.emit();
  }

SCRIPTEND 


Chandler 02-11-2007 10:30 AM

HTML Code:

SCRIPT
function onPlayerEnters()
{
  temp.messageText = player.attr[11];
  with(findimg(10))
  {
    attachtoowner = true;
    layer = 2;
    x = player.x - random( -0.5, -1);
    y = player.y - random( -1, -0.1);

    with (emitter)
    {
      continueafterdestroy = true;
      nrofparticles = 1;
      emitautomatically = false;

      with (particle)
      {
        lifetime = 0.75;
        text = temp.messageText;
        mode = 1;
   
        red = 0;
        blue = 0;
        green = 1;
   
        style = "b";
        alpha = 1;
        zoom = 0.95;

        particle.angle = pi / 2;
        particle.speed = 1;
      }

      addlocalmodifier("range", 0.375, 0.875, "alpha", "replace", 1, 0);
      addlocalmodifier("range", 0.1, 0.75, "speed", "replace", 4, 2);
      emit();
    }
  }
}
SCRIPTEND

Should work

xXziroXx 02-11-2007 11:13 AM

Quote:

Originally Posted by Chompy (Post 1275982)
>_>

I know I don't need it for the attr 11, but I have to make it blank before assigning it to a gani..

No you dont.. :noob:

Chompy 02-11-2007 11:22 AM

Quote:

Originally Posted by Chandler (Post 1276142)
HTML Code:

SCRIPT
function onPlayerEnters()
{
  temp.messageText = player.attr[11];
  with(findimg(10))
  {
    attachtoowner = true;
    layer = 2;
    x = player.x - random( -0.5, -1);
    y = player.y - random( -1, -0.1);

    with (emitter)
    {
      continueafterdestroy = true;
      nrofparticles = 1;
      emitautomatically = false;

      with (particle)
      {
        lifetime = 0.75;
        text = temp.messageText;
        mode = 1;
   
        red = 0;
        blue = 0;
        green = 1;
   
        style = "b";
        alpha = 1;
        zoom = 0.95;

        particle.angle = pi / 2;
        particle.speed = 1;
      }

      addlocalmodifier("range", 0.375, 0.875, "alpha", "replace", 1, 0);
      addlocalmodifier("range", 0.1, 0.75, "speed", "replace", 4, 2);
      emit();
    }
  }
}
SCRIPTEND

Should work

Hmm, still only shows it for the client (myself), I can't see it on other players;

I am testing this with two players (myself and the gani maker),
we both have the same wnpc which trigger the attr's.
But, when I update the wnpc, only I, as the client can see the emitter text?

Is it me, should I use emitter.particle.text? I could use particle.emitter.code... hmm.. I gotta test the code one




Quote:

Originally Posted by xXziroXx (Post 1276161)
No you dont.. :noob:

I just tested it at my server; without clearing the attr before assigning it to a gani result in that it will only show the gani once (that happened to me), and with clearing the attr before assigning it to a gani will allow it to show everytime I update the wnpc (that happened to me..)

Chandler 02-11-2007 07:23 PM

Quote:

Originally Posted by Chompy (Post 1276164)
Hmm, still only shows it for the client (myself), I can't see it on other players;

I am testing this with two players (myself and the gani maker),
we both have the same wnpc which trigger the attr's.
But, when I update the wnpc, only I, as the client can see the emitter text?

Is it me, should I use emitter.particle.text? I could use particle.emitter.code... hmm.. I gotta test the code one

Shouldn't really effect it.
Make it display random integers and then check if you see the same text?

Chompy 02-12-2007 04:21 PM

Quote:

Originally Posted by Chandler (Post 1276234)
Shouldn't really effect it.
Make it display random integers and then check if you see the same text?

I see the text, whatever I change the player.attr[ 11] to..
Its just that, only I can see the text, whatever I do, only I can see the emitter text.. quite annoying

Chandler 02-12-2007 07:27 PM

Quote:

Originally Posted by Chompy (Post 1276628)
I see the text, whatever I change the player.attr[ 11] to..
Its just that, only I can see the text, whatever I do, only I can see the emitter text.. quite annoying

Ahh, I see. Instead of the emitter, try making it showtext? just as a test for now

Chompy 02-12-2007 08:38 PM

Quote:

Originally Posted by Chandler (Post 1276665)
Ahh, I see. Instead of the emitter, try making it showtext? just as a test for now

That's what I did before, but then the text went flying around (the anis were flying around, randomly appearing), but then I used showani.. hmm

Kristi 02-12-2007 11:36 PM

its because the ani is already created. "" doesnt unset it in other players eyes, and also, it doesnt update that fast. setting it in a timeout however would cause some major slowage.

i came up with this, its a slight modification to your gani
PHP Code:

SCRIPT
function onCreated()
{
  
withfindimg(202))
  {
    
attachtoowner true;
    
layer 2;
    
player.random( -0.5, -1);
    
player.random( -1, -0.1);

    
emitter.continueafterdestroy true;
    
emitter.nrofparticles 1;
    
emitter.emitautomatically false;

    
emitter.particle.lifetime 0.75;
    
emitter.particle.text player.attr[11];
    
emitter.particle.mode 1;
    
    
emitter.particle.red 0;
    
emitter.particle.blue 0;
    
emitter.particle.green 1;
    
    
emitter.particle.style "b";
    
emitter.particle.alpha 1;
    
emitter.particle.zoom 0.95;

    
emitter.particle.angle pi 2;
    
emitter.particle.speed 1;

    
emitter.addlocalmodifier"range"0.3750.875"alpha""replace"10);
    
emitter.addlocalmodifier"range"0.10.75"speed""replace"42);

  }
  
onTimeout();


function 
onTimeout() {
    if(
player.attr[17] != thiso.currentinstruction) {
      
thiso.currentinstruction player.attr[17];
      
with(findimg(202)) {
        
emmiter.particle.text player.attr[11];
        
emitter.emit();
      }
   }
   
setTimer(.05);
}
SCRIPTEND 

you keep the ani set as attr whatever (10 is which youre doing), then, you update player.attr[17] to something it wasnt before (anything really), and it will emit a new particle with whatever is stored in 11. Example weapon.
PHP Code:

//#CLIENTSIDE
function onCreated() 

  
player.attr[18] = "hellraventest15.gani";
  
player.attr[17] = "ab";


function 
onPlayerchats() {
  if(
player.chat == "greenytest") {
    
this.teststring player.attr[17] @ player.attr[17];
    
player.attr[17] = this.teststring.substring(1,2);
    
player.chat player.attr[17];
  }
  
player.attr[11] = "+12";


in that case, 17 is flipping between "ab" and "ba".

This method works best if youre constantly using this.

Chompy 02-13-2007 07:29 PM

Thanks :D I made some small modifications and it now works perfectly :D
Thanks Kristi! Rep ++;


All times are GMT +2. The time now is 05:13 AM.

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