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
4 registered members (NewbieZorro, Grant, TipmyPip, AndrewAMD), 13,346 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
Effects in C-Lite? #124547
04/17/07 00:05
04/17/07 00:05
Joined: Sep 2006
Posts: 128
Sweden
Tiinusen Offline OP
Member
Tiinusen  Offline OP
Member

Joined: Sep 2006
Posts: 128
Sweden
Hi i got a major problem. my game crashes when i uses the effect function in C-Lite. i post a code snippet that uses the function.

Code:
  
// helper function: sets the vector to random direction and length
function vec_randomize (var* vec, var range)
{
vec[0] = random(1) - 0.5;
vec[1] = random(1) - 0.5;
vec[2] = random(1) - 0.5;
vec_normalize(vec,random(range));
}

// helper function: fades out a particle
function part_alphafade(PARTICLE *p)
{
p.alpha -= 2*time_step;
if (p.alpha <= 0) p.lifespan = 0;
}

// particle function: generates a fading explosion into vel direction
function effect_explo(PARTICLE *p)
{
var temp[3];
vec_randomize(temp,10);
vec_add (p.vel_x, temp);
p.alpha = 25 + random(25);
p.bmap = "blood.tga";
p.flags |= (BRIGHT | MOVE);
p.event = part_alphafade; // change to a shorter, faster function
}

function hit()
{
if(event_type == EVENT_ENTITY)
{
if(you.skill4 == 2)
{
you.skill3 -= 5;
}
if(you.skill66 == 0 && you != pl){
you.pan = ang(my.pan + 90);
}

ent_morph(me, "blood.tga");
my.flags |= OVERLAY;

my.event=NULL;
vec_scale(normal,10); // produce an explosion into the normal direction
effect(effect_explo,1,my.x,normal);
my.x = you.x;
my.y = you.y;


wait(1);
c_move(my,vector(0-10*speed,0,0),nullvector,GLIDE);
my.skill80=1;
}

if(event_type == EVENT_SURFACE)
{
my.event=NULL;

wait(1);

ent_remove(me);
}
}




Where is my manual? i think i lost it. i have been searching everywere. ohh there it is F1 I'm 17 years old, with 4 years of programing I can programming a lot of languages check my Bio out,
Re: Effects in C-Lite? [Re: Tiinusen] #124548
04/18/07 07:57
04/18/07 07:57
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
Which line is crashing? You can step through with the debugger to find out.

Re: Effects in C-Lite? [Re: jcl] #124549
04/18/07 08:29
04/18/07 08:29
Joined: Sep 2006
Posts: 128
Sweden
Tiinusen Offline OP
Member
Tiinusen  Offline OP
Member

Joined: Sep 2006
Posts: 128
Sweden
well ill fiex the crashing. but the problem is that it aint spawning any particles. thats the problem. so the question have changed. how to make it spawn particles. it chould work but it dosent.


Where is my manual? i think i lost it. i have been searching everywere. ohh there it is F1 I'm 17 years old, with 4 years of programing I can programming a lot of languages check my Bio out,
Re: Effects in C-Lite? [Re: Tiinusen] #124550
04/18/07 08:42
04/18/07 08:42
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
Ok, then I need to reformulate the question: Why isn't it spawning particles?

Again, use the debugger to find out whether effect() is called at all, and whether or not the particle function is running.

Re: Effects in C-Lite? [Re: jcl] #124551
04/18/07 09:10
04/18/07 09:10
Joined: Sep 2006
Posts: 128
Sweden
Tiinusen Offline OP
Member
Tiinusen  Offline OP
Member

Joined: Sep 2006
Posts: 128
Sweden
yes it is. i checked that, u placed error("test"); before the effect. so its called. and i placed error("test2"); in the event thats called by the particles. and its called too


Where is my manual? i think i lost it. i have been searching everywere. ohh there it is F1 I'm 17 years old, with 4 years of programing I can programming a lot of languages check my Bio out,
Re: Effects in C-Lite? [Re: Tiinusen] #124552
04/18/07 09:13
04/18/07 09:13
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
Ok, then the particles are spawned but you don't see them. They could be totally transparent, for instance, or at a different position than you expect.

Next things to check: remove all flags, have alpha at 100% and use an opaque bitmap until you see the particles.

Re: Effects in C-Lite? [Re: jcl] #124553
04/18/07 09:15
04/18/07 09:15
Joined: Sep 2006
Posts: 128
Sweden
Tiinusen Offline OP
Member
Tiinusen  Offline OP
Member

Joined: Sep 2006
Posts: 128
Sweden
well i try that. thank you. i reply when i got some result or no results at all


Where is my manual? i think i lost it. i have been searching everywere. ohh there it is F1 I'm 17 years old, with 4 years of programing I can programming a lot of languages check my Bio out,

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