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
3 registered members (NewbieZorro, TipmyPip, AndrewAMD), 14,749 guests, and 7 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
Particle's properies treated as entity's #416108
01/28/13 03:09
01/28/13 03:09
Joined: Dec 2012
Posts: 7
R
RandomUsername Offline OP
Newbie
RandomUsername  Offline OP
Newbie
R

Joined: Dec 2012
Posts: 7
I have recently tried to make a fire particle effect,but the engine won't even start up because it says that parameter "size" is not a property of ENTITY*. The function that "me.size" is in is called by "effect();), though. Does anyone know what's the problem and how to fix it? Thanks in advance.
Here is the code, by the way:

BMAP* flame = "flame_1.bmp";
ENTITY* fire_spawner;
function flame_2()
{
my.skill_a += 6 * time_step;
my.alpha = 100 - abs(my.skill_a);
my.size -= 0.3 * time_step;// problem here
}
function flame_1()
{
my.x += random(16)-8;
my.y += random(16)-8;
my.z += random(16)-8;
my.bmap = flame;
my.size = random(20) +20;
my.lifespan = 32;
my.flare = on;
my.alpha = 0;
my.bright = on;
my.skill_a = -100;
my.gravity = -0.2;
my.move = on;
my.function = flame_2;
}
action fire()
{
fire_spawner = me;
my.passable = on;
my.invisible = on;
while(1){
effect(flame_1, 2 * time_step, my.x, nullvector);
wait(1);
}
}

function main(){
level_load("");
ent_create("basic_sphere.mdl",my.x,fire);
}

Re: Particle's properies treated as entity's [Re: RandomUsername] #416109
01/28/13 03:14
01/28/13 03:14
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Please use code tags when posting code and properly indent it.

Particles do not have a "my" pointer. Instead you have to create a function that takes a particle pointer as it's first parameter. Like in this sample:
Code:
function flame_1(PARTICLE* p)
{
    p->lifespan = 128;
    p->x += random(32) - 16;
    // and so forth...
}


There is also a detailed example in the manual: http://www.conitec.net/beta/apar-beam.htm

Please be careful with the second parameter in you effect instruction. 2 * time_step can easily become smaller than 1 and in this case no particle at all should be emitted.


Always learn from history, to be sure you make the same mistakes again...
Re: Particle's properies treated as entity's [Re: Uhrwerk] #416112
01/28/13 03:45
01/28/13 03:45
Joined: Dec 2012
Posts: 7
R
RandomUsername Offline OP
Newbie
RandomUsername  Offline OP
Newbie
R

Joined: Dec 2012
Posts: 7
Thanks!
Sorry about bad formatting,I wasn't sure how I should have done it.
Is it better if I use
Code:
while(1)
{
   (flame_1, 2, my.x, nullvector);
   wait(-0.06);
}


Thanks again!

Re: Particle's properies treated as entity's [Re: RandomUsername] #416160
01/28/13 14:19
01/28/13 14:19
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
You missed the "effect" when pasting the code. But apart from that this version is perfectly fine.


Always learn from history, to be sure you make the same mistakes again...

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