Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Gani Construction (https://forums.graalonline.com/forums/forumdisplay.php?f=50)
-   -   Trying to attach a particle effect gani to the player. (https://forums.graalonline.com/forums/showthread.php?t=134259350)

Jiroxys7 05-30-2010 10:00 AM

Trying to attach a particle effect gani to the player.
 
I've never been sure how to do this and i cant seem to find answers. I have a particle effect gani and i'm trying to get it to stick to a particular coordinate on the player and move around with them and such. the closest i can seem to get is using attachplayertoobj or something similar, in which case itll only appear at the player's 0,0. then of course it doesnt move around with me. >_<

cbk1994 05-30-2010 10:01 AM

Try adding 'attachtoowner = true;'

Jiroxys7 05-30-2010 10:25 AM

cool thanks! :D

now i dont suppose there would be any way to treat this as an object and place it in the player's hand so it can move based on where their hands are, would there? :9

Fulg0reSama 05-30-2010 10:32 AM

Uhm... Creative particle scripting might be a way.. Or make graphics that go around the hand for the ganis you are doing and make the illusion of what particles could do (depends how you want to do it)

Jiroxys7 05-30-2010 10:54 AM

i found a solution! i have it so the particle will trail off while you move. so i'm going to see if i can make the offset change based on your direction. this way, it doesnt look like it's not moving with the arm, and it collects back together when the player stops moving.

ok 2 more questions. 1: whats the best way to do a check to see what the player's direction is, in a gani script?
2: it seems my gani disappears once i leave the room. more specifically, it's only visible to other players in the same room that i activated it. why would this be?

taylor 06-02-2010 12:28 AM

How are you displaying the gani?

cbk1994 06-02-2010 12:33 AM

Post the GANI script.

Jiroxys7 06-02-2010 09:33 PM

PHP Code:

GANI0001


DEFAULTATTR1 hat0
.png
DEFAULTHEAD head19
.gif
DEFAULTBODY body
.png

SCRIPT
function onPlayerEnters()
{
  if (!
particleeffectsenabled) return;
  
with (findimg(200))
  {
    
spin degtorad(0);
    
rotation degtorad(0);

    
with (emitter)
    {
      
delaymin 0.1;
      
delaymax 0.3;
      
nrofparticles 1;
      
emitautomatically true;
      
autorotation false;
      
firstinfront false;
      
emissionoffset = {1.6,1.5,0};
      
attachposition false;
      
checkbelowterrain false;
      
continueafterdestroy false;
      
maxparticles 100000;
      
particleTypes 1;
      
attachtoowner=true;
      
// Light
      
with (particles[0])
      {
        
image "light2s.png";
        
zoom 1;
        
red random(0,0.1);
        
green 1;
        
blue 1;
        
alpha 0.7;
        
mode 0;
        
lifetime 1;
        
angle degtorad(32);
        
zangle degtorad(0);
        
speed 0.25;
        
rotation degtorad(80);
        
spin degtorad(0);
        
partx 0;
        
party 0;
        
partw 0;
        
parth 0;
        
stretchx 1;
        
stretchy 1;
        
sound "";
        
layer 2;
      }
      
      
addlocalmodifier("impulse"0.050.05"movey""add", -0.1, -1); // Wind
      
addlocalmodifier("once"00"angle""replace"degtorad(-200), degtorad(200)); // Random Angle
      
addlocalmodifier("impulse"0.20.2"alpha""add", -0.2, -0.2); // Dim
      
addlocalmodifier("range"12"speed""add"1020); // Spread
      
addlocalmodifier("impulse"2020"red""replace"01); // Recolor
    
}
  }
}
SCRIPTEND 

I was thinking about putting something in another weapon that generated client.vars that i could place in the offset here that change based on the player's direction. but that feels like it might be unnecessary clutter.

edit: urg. yet another problem =X it seems that when i change levels with this, the local modifiers stop working. What would cause that to happen?

Admins 08-15-2010 02:47 AM

Add a call to removemodifiers(); before adding new modifiers (otherwise it will add all the modifiers again on onPlayerEnters and mess it up).


All times are GMT +2. The time now is 08:26 AM.

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