Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-03-2017, 09:40 AM
Kamaeru Kamaeru is offline
G2k1
Kamaeru's Avatar
Join Date: Dec 2001
Posts: 1,040
Kamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud of
need help with particle scripting

I want to use this in my emitter to draw the particle image at a different 90 degree angle depending on the player's direction. It should work I think, but it doesn't. I'm assuming it only calculates the rotated image once and never again. I can't think of a way to change it though. Is there a way to handle this?

NPC Code:
rotation = (pi / 2) + player.dir * (pi / 2);



To be more specific, I'm working on a script that draws footsteps behind the player when they walk, and to finish it I need to get the footsteps to draw in the correct corresponding direction. Seems like it would be easy, but I just spent a few hours trying to figure it out and failed. It seems like there is no way to change the image or rotate it once the emitter has started. I also couldn't find any documentation explaining how to properly stop an emitter.

NPC Code:
function drawFootSteps() {
this.drawdir = player.dir;

with (findImg(200)) {
attachtoowner = true;
offsetx = 1.0 - vecx(player.dir);
offsety = 1.5 + (vecy(player.dir) * 0.8) + (abs(vecx(player.dir)) * 0.2) - (vecx(player.dir) * 0.15);
layer = 0;

with (emitter) {
delaymin = 0.1;
delaymax = 0.2;
nrofparticles = 1;
continueafterdestroy = true;

with (particle) {
emissionoffset = {0.2 + offsetx,0.2 + offsety,0};

spin = 0;
angle = 0;

rotation = (pi / 2) + this.drawdir * (pi / 2);


image = "bi_effect_footsteps.png";
speed = 0;
mode = 1;

lifetime = 1.2;
alpha = 1;
zoom = 1;
}

addLocalModifier("range",0.5,1.2,"alpha","add",- 0.7,- 0.7);
addLocalModifier("once",0,0,"x","add",- vecy(player.dir) * 0.3,vecy(player.dir) * 0.3);
temp.addy1 = (vecx(player.dir) > 0 ? - vecx(player.dir) * 0.2 : vecx(player.dir) * 0.3);
temp.addy2 = (vecx(player.dir) < 0 ? - vecx(player.dir) * 0.2 : vecx(player.dir) * 0.3);
addLocalModifier("once",0,0,"y","add",temp.addy1,t emp.addy2);
settimer(.05);
}
}
}

__________________
3DS friendcode: 1118-0226-7975
Reply With Quote
  #2  
Old 06-03-2017, 11:23 AM
Kamaeru Kamaeru is offline
G2k1
Kamaeru's Avatar
Join Date: Dec 2001
Posts: 1,040
Kamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud of
Okay I did figure out how to handle this, but still need help understanding how to stop an emitter without using hideimg() which causes a glitch with my script where the variables from the scope of the original emitter add to the new one instead of resetting when i do it that way. i just want to stop the emitter when my player is idle.
__________________
3DS friendcode: 1118-0226-7975
Reply With Quote
  #3  
Old 06-03-2017, 05:25 PM
Kirko Kirko is offline
Registered Guest
Join Date: Dec 2014
Location: Texas
Posts: 61
Kirko is a jewel in the roughKirko is a jewel in the rough
Maybe something like this
NPC Code:
findimg(200).emitter.emitAutomatically = (player.ani == "idle" ? false : true);

Reply With Quote
  #4  
Old 06-03-2017, 07:04 PM
Kamaeru Kamaeru is offline
G2k1
Kamaeru's Avatar
Join Date: Dec 2001
Posts: 1,040
Kamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud of
Quote:
Originally Posted by Kirko View Post
Maybe something like this
NPC Code:
findimg(200).emitter.emitAutomatically = (player.ani == "idle" ? false : true);

Thanks I will try that when I get home later
__________________
3DS friendcode: 1118-0226-7975
Reply With Quote
  #5  
Old 06-04-2017, 10:27 AM
Kamaeru Kamaeru is offline
G2k1
Kamaeru's Avatar
Join Date: Dec 2001
Posts: 1,040
Kamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud of
Your advice helped, thanks. I am still wondering what the best way is to handle rotating the particle by 90 degrees depending on the player direction. I've tried stuff like " findimg(200).rotation " but it doesn't appear to work that way.
__________________
3DS friendcode: 1118-0226-7975
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 07:56 PM.


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