Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (AndrewAMD, TipmyPip), 12,420 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to emit some beams at the same time? #229076
09/24/08 11:59
09/24/08 11:59
Joined: Nov 2007
Posts: 37
L
LavenderSs Offline OP
Newbie
LavenderSs  Offline OP
Newbie
L

Joined: Nov 2007
Posts: 37
Hi. buddies!

I just want to make some beams emitted from one person to some other ones at the same time. Also the method I'd like to use is writing one particle function (contains 'effect' function) and other function could call it for showing a beam. However, I found that it was unreachable. Only one beam could exist at a time. But I think it's terrible to write partical functions as many as the number of beams. Do someone here have a better solution with this matter? I would really appreciate it!

Re: How to emit some beams at the same time? [Re: LavenderSs] #229094
09/24/08 13:04
09/24/08 13:04
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
You should be able to have more that one beam at any one time.

Can you post the code segment that seem to be limited to one beam?
You description of "it was unreachable" isnt very clear to me.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: How to emit some beams at the same time? [Re: EvilSOB] #229214
09/25/08 15:20
09/25/08 15:20
Joined: Nov 2007
Posts: 37
L
LavenderSs Offline OP
Newbie
LavenderSs  Offline OP
Newbie
L

Joined: Nov 2007
Posts: 37
OK. Codes are as follows:

function fade_normal(PARTICLE *p)
{
var mdl_dist,p_dist;
mdl_dist = vec_dist(emit_dst_pos.x, emit_src_pos.x);
p_dist = vec_dist(p.x, emit_src_pos.x);
if (p_dist > (mdl_dist-100)) //cut surplus length of beam
{
p.lifespan = 0;
}
}

function effect_normal(PARTICLE *p)
{
VECTOR particle_direction;
vec_set(particle_direction.x, emit_dst_pos.x);
vec_sub(particle_direction.x, emit_src_pos.x);

vec_normalize (particle_direction, random(100)); //250:velocity
vec_add(p.vel_x, particle_direction);
p.alpha = 60 + random(20);
p.bmap = barrier_tga;
vec_set(p.blue, vector(emit_color.x, emit_color.y, emit_color.z));
p.size = 3;
p.flags |= (TRANSLUCENT | BRIGHT | MOVE);
p.flags |= emit_flag;
p.event = fade_normal;
}

function emit_beam(var* dst, var* src,
var* color, var seconds, int src_type, int dst_type, int flag)
{

int start_sec = sys_seconds;
//ignore arguments with setting dst,src,color etc.

while(1)
{
effect(effect_normal, 50/(0.1 + time_step),
vector(emit_src_pos.x-6, emit_src_pos.y-20+random(41),emit_src_pos.z-30+random(11)), nullvector);

if(seconds > 0)
{
if((start_sec + seconds) % 60 == sys_seconds)
{
break;
}
}

wait(1);
}
}

function test_beam()
{
//ignore code setting dst, src, clr, etc.
emit_beam(dst, src, clr, 5, HK, PC, 0);
//Every time I call emit_beam(), only one beam exists.
}

Re: How to emit some beams at the same time? [Re: LavenderSs] #229540
09/28/08 13:44
09/28/08 13:44
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Sorry I havent answered sooner, but Ive been off-forum this weekend.

Im afraid Im too noob at particles to even get your code to produce a beam,
(I think my test-level scales are too different).
But I CAN see where I think the one-beam-limit is coming from.

In your particle functions effect_normal and fade_normal you are calling
on global vectors emit_dst_pos, emit_src_pos, and emit_color.
I think that that because emit_dst_pos, emit_src_pos are globals,
when you create a second beam, these globals "drag" any existing beams
to the same orientation(ie underneath/inside).

I dont have a fix, and I know what you mean about not being able to pass
"customising" parameters through the effect function. I would like to
be able to too. But no luck so far.


Hope this is of help in finding a work-around. Sorry I couldnt help more.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: How to emit some beams at the same time? [Re: EvilSOB] #229619
09/29/08 03:21
09/29/08 03:21
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Hmm, OK. Ive finally gotten the beams up and kicking,
but I need some clarification.

We'll start simple and work up from there please, for my sake as Im
new to particles in A7.

So you want multiple targets, with one solid beam each to start with right?

Try this
Code:
function effect_streak(PARTICLE* p)
{
	VECTOR dir;
	vec_set(dir.x, p.vel_x);
	vec_sub(dir.x, p.x);
	vec_set(p.vel_x, dir.x);
	p.alpha = 60 + random(20);
	p.bmap = barrier_tga;
	p.size = 3;
	set(p,TRANSLUCENT|BRIGHT|STREAK);
	p.event = NULL;
	p.lifespan = 25 + random(50);
}
//
//
function test_beam()
{
	effect( effect_streak, 1, source.x, target.x ); 
}

The only part of your old stuff it uses is "barrier_tga"

Lemme know how it goes, then we'll move on to the next step.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: How to emit some beams at the same time? [Re: EvilSOB] #229666
09/29/08 13:45
09/29/08 13:45
Joined: Nov 2007
Posts: 37
L
LavenderSs Offline OP
Newbie
LavenderSs  Offline OP
Newbie
L

Joined: Nov 2007
Posts: 37
Well, I've seen that the viarables related to every beam are global, thus there are unique values for beam function when a beam is showing up each time.
Just hope GS fix such issue in Partical.

Anyway, thanks for your effort to this problem:)

Last edited by LavenderSs; 09/29/08 13:46.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1