Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Problem with moving a class-npc (https://forums.graalonline.com/forums/showthread.php?t=134264687)

pig132 10-02-2011 04:19 AM

Problem with moving a class-npc
 
So I have something made in a class-npc (a particle effect, placed in a weapon with putnpc2) and I would like the entire NPC to be moved by any means. (ive tried all ways and only setting its x and y work but they reset the particle). Anyways, I'm looking for a way to move the npc smoothly preferably with the move() function but it does not seem to be working...

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
setshape(13232);
  
with (findimg(1)) {
    
with (findplayer("pig132")) {

      
player.x;
      
player.y;
      
      
layer 2;
      
      
emitter.delaymin 0.1;
      
emitter.delaymax 0.1;
      
emitter.nrofparticles 2;
      
emitter.maxparticles 100;
      
      
emitter.particle.lifetime 4;
      
emitter.particle.image "g4_particle_tornado.png";
      
emitter.particle.mode 1;
      
emitter.particle.zoom 1;
      
emitter.particle.alpha 0.3;
      
      
emitter.particle.angle pi 2;
      
emitter.particle.speed 4.8;
      
emitter.addglobalmodifier("once"00"angle""add"00);
      
emitter.addemitmodifier("impulse"00"movex""replace", -0.750.75);
      
emitter.addlocalmodifier("once"00"rotation""replace"07);
      
      
emitter.addlocalmodifier("once"00"zoom""replace"0.60.6);
      
      
emitter.addlocalmodifier("once"00"spin""replace"8.310.3);
      
emitter.addlocalmodifier("range"0.154"zoom""add"0.22);
      
emitter.addlocalmodifier("range"33"alpha""replace"0.50.1);
    }
  }


not sure if it really matters but there is my code. using move() does not work at all

fowlplay4 10-02-2011 04:32 AM

Put your particle emitter in a gani. I.e:

yourserver_effect.gani

PHP Code:

GANI0001

SCRIPT
function onPlayerEnters() {
  
with (findimg(1)) {

    
attachtoowner true;

    
layer 2;

    
emitter.delaymin 0.1;
    
emitter.delaymax 0.1;
    
emitter.nrofparticles 2;
    
emitter.maxparticles 100;

    
emitter.particle.lifetime 4;
    
emitter.particle.image "g4_particle_tornado.png";
    
emitter.particle.mode 1;
    
emitter.particle.zoom 1;
    
emitter.particle.alpha 0.3;

    
emitter.particle.angle pi 2;
    
emitter.particle.speed 4.8;
    
emitter.addglobalmodifier("once"00"angle""add"00);
    
emitter.addemitmodifier("impulse"00"movex""replace", -0.750.75);
    
emitter.addlocalmodifier("once"00"rotation""replace"07);

    
emitter.addlocalmodifier("once"00"zoom""replace"0.60.6);

    
emitter.addlocalmodifier("once"00"spin""replace"8.310.3);
    
emitter.addlocalmodifier("range"0.154"zoom""add"0.22);
    
emitter.addlocalmodifier("range"33"alpha""replace"0.50.1);

  }
}
SCRIPTEND 

Then use showani, setani, shoot, or store it in a attr.

pig132 10-02-2011 04:51 AM

Oh sorry I should have said this up front. I'm not looking for it to move with me, just move where i specify like in the move command. If i were to use a gani, I would have to make the npc that was placed show the gani, and then what? Its still in the class and for whatever reason move() doesn't want to work

fowlplay4 10-02-2011 04:59 AM

move() move's the npc not necessarily the showimg/findimg it creates. You can attach the findimg to the npc like this:

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
with (findimg(200)) {
    
image "block.png";
    
thiso.x;
    
thiso.y;
    
// The magic 'attach' command you want:
    
attachtoowner true;
  }
  
move(0101.60);



pig132 10-02-2011 05:06 AM

Exactly what I was looking for, thank you so much!

Just another quick question. Does the move() command only show it moving for the client? i've tried on both the clientside and serverside and still others do not see it moving.

fowlplay4 10-02-2011 05:15 AM

Quote:

Originally Posted by pig132 (Post 1669738)
Exactly what I was looking for, thank you so much!

Just another quick question. Does the move() command only show it moving for the client? i've tried on both the clientside and serverside and still others do not see it moving.

move on the client-side will only move it for you.

move on the server-side will show for everyone.

Post the code you're using if it doesn't work properly when u move on the server-side.

pig132 10-02-2011 05:17 AM

Actually just got it, thanks so much again!!


All times are GMT +2. The time now is 11:44 PM.

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