Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Gani Script Problem. (https://forums.graalonline.com/forums/showthread.php?t=134267844)

Jiroxys7 02-05-2013 01:18 AM

Gani Script Problem.
 
Is there any reason why this gani doesn't change color for other players? I.e. if I use it, it'll change from yellow to red, but on someone else's screen, it remains yellow. Been trying to get this dumb thing to work for two days now !pissed!

Edit: Magically started working. Can't tell at this point if I'm going crazy or not. :whatever:

PHP Code:

SCRIPT
if (created){
  
thiso.tu 0;
  
onTimeout();
}
function 
onTimeout()

  
//thiso.tu is incremented at the very end.
  
if(thiso.tu 5thiso.tmod 10*(1/3);
  else if(
thiso.tu 9thiso.tmod 10*(2/3);
  else if(
thiso.tu == 10thiso.tmod 10;
  
with (findimg(200))
  {
    
spin degtorad(0);
    
rotation degtorad(0);

    
with (emitter)
    {
      
delaymin 0.2-((0.1/10)*thiso.tmod);
      
delaymax 0.2-((0.1/10)*thiso.tmod);
      
nrofparticles 1+int(random(0,1)+.5);
      
emitautomatically true;
      
autorotation false;
      
firstinfront true;
      
emissionoffset = {0,1.5,0};
      
attachposition false;
      
checkbelowterrain false;
      
continueafterdestroy true;
      
attachtoowner true;
      
maxparticles 100000;

      
particleTypes 1;

      
// Leaf
      
with (particles[0])
      {
        
image "zod-j7energything.png";
        
zoom 1;
        
red 1;
        
green 1-(0.1*thiso.tmod);
        
blue 0;
        
alpha 0;
        
mode 0;
        
lifetime 0.6 - ((0.2/10)*thiso.tu);
        
angle degtorad(90);
        
zangle degtorad(0);
        
speed 5+thiso.tu;
        
rotation degtorad(0);
        
spin degtorad(0);
        
partx 0;
        
party 0;
        
partw 0;
        
parth 0;
        
stretchx 0.8;
        
stretchy 1.8;
        
sound "";
        
layer 2;
      }

      
addlocalmodifier("once"00"x""replace"player.x-1+1player.x+1+1); // [Insert Name]
      
addlocalmodifier("once"00"y""replace"player.y+3player.y+3); // [Insert Name]

      
addlocalmodifier("range"00.25"alpha""replace"00.5+((.5/10)*thiso.tmod)); // [Insert Name]
      
addlocalmodifier("range"0.250.6 - ((0.2/10)*thiso.tu), "alpha""replace"0.5+((.5/10)*thiso.tmod),0); // [Insert Name]

    
}
  }

  
with (findimg(202))
  {
    
spin degtorad(0);
    
rotation degtorad(0);
    
layer 0;

    
with (emitter)
    {
      
delaymin 0;
      
delaymax 0;
      
nrofparticles 1;
      
emitautomatically true;
      
autorotation false;
      
firstinfront true;
      
emissionoffset = {0,0,0};
      
attachposition false;
      
checkbelowterrain false;
      
continueafterdestroy false;
      
attachtoowner true;
      
maxparticles 1;

      
particleTypes 1;

      
// Leaf
      
with (particles[0])
      {
        
image "g4_particle_yellowlight.png";
        
zoom 2;
        
red 1;
        
green - (0.1 thiso.tu);
        
blue 0;
        
alpha 1;
        
mode 0;
        
lifetime .1;
        
angle degtorad(32);
        
zangle degtorad(0);
        
speed 0;
        
rotation degtorad(0);
        
spin degtorad(0);
        
partx 0;
        
party 0;
        
partw 0;
        
parth 0;
        
stretchx 1;
        
stretchy 1;
        
sound "";
        
layer 2;
      }

      
addlocalmodifier("once"00"x""replace"player.x-.5player.x-.5); // [Insert Name]
      
addlocalmodifier("once"00"y""replace"player.y+.5player.y+.5); // [Insert Name]
    
}
  }
  
setTimer(.1);
  if (
thiso.tu 10thiso.tu++;
}

SCRIPTEND 


Deas_Voice 02-05-2013 08:51 PM

well, to start with, learn when to use "this" and when to use "thiso".

then after you learnt that, replace every "thiso" with "this" and that's pretty much what i can see is wrong with you code.

you might even want to use 'if (playerenters)' instead of created, like suggested in your other thread.

hint: "thiso" refers to the orginal object, not the one your currently working with.

Jiroxys7 02-06-2013 03:47 AM

Quote:

Originally Posted by Deas_Voice (Post 1713214)
well, to start with, learn when to use "this" and when to use "thiso".

then after you learnt that, replace every "thiso" with "this" and that's pretty much what i can see is wrong with you code.

you might even want to use 'if (playerenters)' instead of created, like suggested in your other thread.

hint: "thiso" refers to the orginal object, not the one your currently working with.

this.vars that are declared outside of with()'s cannot be accessed within them. That's why I'm using them here.

Crow 02-06-2013 10:16 AM

Quote:

Originally Posted by Jiroxys7 (Post 1713233)
this.vars that are declared outside of with()'s cannot be accessed within them. That's why I'm using them here.

You're using thiso.vars outside of your with blocks. That doesn't make sense, and will probably not work.

Jiroxys7 02-06-2013 03:46 PM

Quote:

Originally Posted by Crow (Post 1713240)
You're using thiso.vars outside of your with blocks. That doesn't make sense, and will probably not work.

..But it does <_>

Crow 02-06-2013 04:30 PM

Quote:

Originally Posted by Jiroxys7 (Post 1713249)
..But it does <_>

It does not make sense, then, and you should stop doing it.

fowlplay4 02-06-2013 04:35 PM

The big selling point of emitters is so you can do the effect without having to resort to a timeout, looping and adding modifiers every time tends to lead to very laggy times.


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

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