Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Virtual Welding (https://forums.graalonline.com/forums/showthread.php?t=134265133)

Gunderak 11-29-2011 11:14 AM

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.

xAndrewx 11-29-2011 07:45 PM

ya use the particle system

Emera 11-29-2011 07:57 PM

Use a light particle, zoom it down and when you execute your welding action, make them fly off at random speeds in random directions.

papajchris 11-29-2011 10:17 PM

I thought this thread was titled virtual wedding. Got my hopes up...

Emera 11-29-2011 10:49 PM

Quote:

Originally Posted by papajchris (Post 1675785)
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.

Fulg0reSama 11-29-2011 10:49 PM

Quote:

Originally Posted by papajchris (Post 1675785)
I thought this thread was titled virtual wedding. Got my hopes up...

+rep, likewise.

edit: uh I mean accidental -rep

papajchris 11-29-2011 11:07 PM

Quote:

Originally Posted by Fulg0reSama (Post 1675790)
+rep, likewise.

Umm you gave me negative! Its okay though, i made myself chuckle

Fulg0reSama 11-29-2011 11:14 PM

Quote:

Originally Posted by papajchris (Post 1675793)
Umm you gave me negative! Its okay though, i made myself chuckle

Uh, sorry D:

I pm'd you some compensation for your loss.

Gunderak 11-29-2011 11:16 PM

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


cbk1994 11-29-2011 11:18 PM

Quote:

Originally Posted by Gunderak (Post 1675797)
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?

Emera 11-29-2011 11:19 PM

Quote:

Originally Posted by Gunderak (Post 1675797)
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.

Gunderak 11-29-2011 11:29 PM

@cbk1994 I can't test it because I am at work.
@Emera Thanks for the link il be sure to check It out.

xAndrewx 11-30-2011 12:03 AM

Quote:

Originally Posted by Fulg0reSama (Post 1675790)
+rep, likewise.

edit: uh I mean accidental -rep

Haha +Rep hahaha

Gunderak 11-30-2011 10:57 PM

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.
      
}
   }



Crow 11-30-2011 10:59 PM

You can control the emitter's behavior by setting emitter.emitautomatically to true or false.


All times are GMT +2. The time now is 07:37 PM.

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