Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Lightning problem
Lightning problem
2003-03-05, 4:38 AM #1
Hi!
My level crashes because of this COG:
Code:
# Zap Zap Zap
#
# By Edward
symbols

message		startup
message		pulse

thing		ghost0
thing		ghost1
thing		ghost2
thing		ghost3
thing		ghost4

template	lightning

int		r	local

end
#
code
startup:
	SetPulse(0.2);
return;
pulse:
	r=rand()*5;
	CreateThing(lightning,ghost0[r]);
return;
end

I set my lightning template to: +force_lightning

/Edward
Edward's Cognative Hazards
2003-03-05, 8:02 AM #2
rand? use
Code:
For(r=0; r<6; r=r+1)
{
}


------------------
The miners of Kiith Somtaaw sacificed much, and risked all. For their efforts they were brought into the inner most circle of Hiigaren power. Naabal, S'jet, and Sobanii bowed before them. And from that day to this, Somtaaw's children have been known to one and all as Beastslayers..
2003-03-05, 8:09 AM #3
I don't want an orderly ZAP! I want to surprise the player! If I put it in order then he will simply slip through or know where to go when!

/Edward
Edward's Cognative Hazards
2003-03-05, 9:44 AM #4
Try this...
Code:
# Zap Zap Zap
#
# By Edward
symbols

message startup
message pulse

thing ghost0
thing ghost1
thing ghost2
thing ghost3
thing ghost4

template lightning

int r local

end
#
code
startup:
SetPulse(0.2);
return;
pulse:
r=rand()*5;
If(r >= 5) r = 4;
CreateThing(lightning,ghost0[r]);
return;
end


Although its very rare, 'Rand()*5' will occasionally return 5. Its always a good idea to account for it.

------------------
Createthingatpos(GBK, 0, '0 0 0', '0 0 0');
And when the moment is right, I'm gonna fly a kite.

↑ Up to the top!