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 11-29-2011, 11:14 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Virtual Welding

Hey, I am trying to re-create my favourite hobby, ARC Welding.
I am wondering how I could create the "sparks" that fly off though.
Here is the basics of my script so far.
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
hideimgs(200500000);
  
this.indexn 200;
  
onTimeout();
}

function 
onMouseDown(var) {
  if (var == 
"left") {
    
this.mode "on";
  }
}

function 
onMouseUp(var) {
  if (var == 
"left") {
    
this.mode "off";
  }
}

function 
onTimeout() {
  if (
this.mode == "on") {
    
this.indexn += 1;
    
showimg(this.indexn"g4_particle_sun.png"mousex 2mousey 2);
    
findimg(this.indexn).zoom random(0.20.3);
    
findimg(this.indexn).red 1;
    
findimg(this.indexn).green 1;
    
findimg(this.indexn).blue 1;
  }
  
settimer(0.05);

Maybe some kind of particle emmiter would do the job.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #2  
Old 11-29-2011, 07:45 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
ya use the particle system
__________________
Reply With Quote
  #3  
Old 11-29-2011, 07:57 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Use a light particle, zoom it down and when you execute your welding action, make them fly off at random speeds in random directions.
__________________
Reply With Quote
  #4  
Old 11-29-2011, 10:17 PM
papajchris papajchris is offline
Zeus Condero
papajchris's Avatar
Join Date: Jan 2006
Location: Michigan
Posts: 1,600
papajchris is a splendid one to beholdpapajchris is a splendid one to beholdpapajchris is a splendid one to beholdpapajchris is a splendid one to behold
I thought this thread was titled virtual wedding. Got my hopes up...
__________________
Reply With Quote
  #5  
Old 11-29-2011, 10:49 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by papajchris View Post
I thought this thread was titled virtual wedding. Got my hopes up...
That's so weird. I first read it and thought, "What the hell is he playing at now..."

Lol. Strange.
__________________
Reply With Quote
  #6  
Old 11-29-2011, 10:49 PM
Fulg0reSama Fulg0reSama is offline
Extrinsical Anomaly
Fulg0reSama's Avatar
Join Date: Sep 2009
Location: Ohio
Posts: 3,049
Fulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant future
Quote:
Originally Posted by papajchris View Post
I thought this thread was titled virtual wedding. Got my hopes up...
+rep, likewise.

edit: uh I mean accidental -rep
__________________

Careful, thoughts and opinions here scare people.

Last edited by Fulg0reSama; 11-29-2011 at 11:17 PM..
Reply With Quote
  #7  
Old 11-29-2011, 11:07 PM
papajchris papajchris is offline
Zeus Condero
papajchris's Avatar
Join Date: Jan 2006
Location: Michigan
Posts: 1,600
papajchris is a splendid one to beholdpapajchris is a splendid one to beholdpapajchris is a splendid one to beholdpapajchris is a splendid one to behold
Quote:
Originally Posted by Fulg0reSama View Post
+rep, likewise.
Umm you gave me negative! Its okay though, i made myself chuckle
__________________
Reply With Quote
  #8  
Old 11-29-2011, 11:14 PM
Fulg0reSama Fulg0reSama is offline
Extrinsical Anomaly
Fulg0reSama's Avatar
Join Date: Sep 2009
Location: Ohio
Posts: 3,049
Fulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant future
Quote:
Originally Posted by papajchris View Post
Umm you gave me negative! Its okay though, i made myself chuckle
Uh, sorry D:

I pm'd you some compensation for your loss.
__________________

Careful, thoughts and opinions here scare people.
Reply With Quote
  #9  
Old 11-29-2011, 11:16 PM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Does anyone happen to know how to make an image fly off at a random direction?
maybe something like this?
PHP Code:
this.angle random(06.4);
this.-= sin(this.angle)*1;
this.-= cos(this.angle)*1
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #10  
Old 11-29-2011, 11:18 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Gunderak View Post
Does anyone happen to know how to make an image fly off at a random direction?
maybe something like this?
PHP Code:
this.angle random(06.4);
this.-= sin(this.angle)*1;
this.-= cos(this.angle)*1
Why don't you try it and see if it works?
__________________
Reply With Quote
  #11  
Old 11-29-2011, 11:19 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by Gunderak View Post
Does anyone happen to know how to make an image fly off at a random direction?
maybe something like this?
PHP Code:
this.angle random(06.4);
this.-= sin(this.angle)*1;
this.-= cos(this.angle)*1
When I was getting used to making particle effects, I used ziro's particle editor for quick effects. The effect you're trying to achieve can easily be composed using the editor. Have a look here.
__________________
Reply With Quote
  #12  
Old 11-29-2011, 11:29 PM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
@cbk1994 I can't test it because I am at work.
@Emera Thanks for the link il be sure to check It out.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #13  
Old 11-30-2011, 12:03 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Quote:
Originally Posted by Fulg0reSama View Post
+rep, likewise.

edit: uh I mean accidental -rep
Haha +Rep hahaha
__________________
Reply With Quote
  #14  
Old 11-30-2011, 10:57 PM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
I have now made the particle effect but how can I make it emit and stop emitting on command?
I have tried a few things but can't seem to get it to work.
Here is how it's set up.
PHP Code:
with(findimg(200)){ 
  
//Stuff.
    
with(emitter){
    
//More stuff.
      
with(particle[0]){
      
//Even more stuff.
      
}
   }

__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #15  
Old 11-30-2011, 10:59 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
You can control the emitter's behavior by setting emitter.emitautomatically to true or false.
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 09:40 PM.


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