Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-02-2011, 04:19 AM
pig132 pig132 is offline
professional troll
Join Date: May 2006
Posts: 260
pig132 will become famous soon enough
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
Reply With Quote
  #2  
Old 10-02-2011, 04:32 AM
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
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.
__________________
Quote:
Reply With Quote
  #3  
Old 10-02-2011, 04:51 AM
pig132 pig132 is offline
professional troll
Join Date: May 2006
Posts: 260
pig132 will become famous soon enough
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
Reply With Quote
  #4  
Old 10-02-2011, 04:59 AM
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
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);

__________________
Quote:
Reply With Quote
  #5  
Old 10-02-2011, 05:06 AM
pig132 pig132 is offline
professional troll
Join Date: May 2006
Posts: 260
pig132 will become famous soon enough
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.
Reply With Quote
  #6  
Old 10-02-2011, 05:15 AM
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
Quote:
Originally Posted by pig132 View Post
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.
__________________
Quote:
Reply With Quote
  #7  
Old 10-02-2011, 05:17 AM
pig132 pig132 is offline
professional troll
Join Date: May 2006
Posts: 260
pig132 will become famous soon enough
Actually just got it, thanks so much again!!
Reply With Quote
Reply


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 08:10 PM.


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