Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-05-2013, 01:18 AM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
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

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

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 
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #2  
Old 02-05-2013, 08:51 PM
Deas_Voice Deas_Voice is offline
Deas
Deas_Voice's Avatar
Join Date: Jun 2007
Location: Sweden
Posts: 2,264
Deas_Voice is a jewel in the roughDeas_Voice is a jewel in the rough
Send a message via AIM to Deas_Voice Send a message via MSN to Deas_Voice Send a message via Yahoo to Deas_Voice
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.
__________________
.
WTF is real life, and where do I Download it?
There is no Real Life, just AFK!
since 2003~
I Support~
ღAeonღ | ღTestbedღ | ღDelteriaღ

if you are going to rep me, don't be an idiot, leave your name!
I got nothing but love for you
Reply With Quote
  #3  
Old 02-06-2013, 03:47 AM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Quote:
Originally Posted by Deas_Voice View Post
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.
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #4  
Old 02-06-2013, 10:16 AM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Jiroxys7 View Post
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.
__________________
Reply With Quote
  #5  
Old 02-06-2013, 03:46 PM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Quote:
Originally Posted by Crow View Post
You're using thiso.vars outside of your with blocks. That doesn't make sense, and will probably not work.
..But it does <_>
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #6  
Old 02-06-2013, 04:30 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Jiroxys7 View Post
..But it does <_>
It does not make sense, then, and you should stop doing it.
__________________
Reply With Quote
  #7  
Old 02-06-2013, 04:35 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
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.
__________________
Quote:
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:30 PM.


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