View Full Version : Laser Projector

11-19-2000, 11:11 AM
Can somebody examine this COG, I put it in JED, did all the usual stuff, tested it and it fired at itself twice before crashing the game:

message crossed
#The trigger the computer is meant to look for
surface adjoin0 id=1
surface adjoin1 id=1
surface adjoin2 id=1
surface adjoin3 id=1
#These are the surfaces which trigger the laserprojector
thing laserprojector
#Well duh...The laser projector
template laser=+stlaser
#The laser projectile itself
thing activator
#The person that crossed the adjoin
message pulse
#A pulse function to generate a loading time for the projector (I'm not evil enough to just make it kill them outright)
flex pulselength=0.5
#You can change this, but it is the best for the purpose.
flex damagedone=30
#This is the amount of damage each shot does, be as sadistic as you please
sound fire=trprsht1.wav
#The firing sound

if(GetSenderID() == 1) {
#If it's one of the adjoins above
activator = GetSourceRef();
#Make the activator the person that activated the projector
#Starts the pulse

FireProjectile(laserprojector, laser, fire, , actor, 0, , , 180, 1);
#Fires the laser at the activator
DamageThing(activator, damagedone);
#Damages the activator of the projector by the above flex

You were right about one thing master, the negotiators were short

11-19-2000, 01:27 PM
's pr'y the fireprojectile command in the pulse message , it doesn't have values for all the parameters , jk doesn't like that..(:


#define QUESTION((2b) | | !(2b))

11-20-2000, 10:34 AM
I'm not a cog expert, but here are a few ideas:

You didn't end your "if" statement with a }. That might have something to do with it. It's just good practice to use proper coding.

Try putting in "-1" for the values you don't use in the "fireprojectile" statement.

You need a "return" at the end of your messages, or the game only thinks it needs to do it once.

I don't see what the purpose of the "pulse" message is. It seems that it could all be done under the "crossed" message.

Docking Bay 94 (http://expert.cc.purdue.edu/~thompsnd/db94/)

11-20-2000, 01:27 PM
Home Sliced is exactly right.. use Cogwriter to check your syntax, it's full of errors http://forums.massassi.net/html/smile.gif

As for the pulse, I believe it's to make the laser fire repeatedly... otherwise it'd fire once. Also, I'm pretty sure the laser will keep firing indefinitely, as there's no SetPulse(0.0);


11-21-2000, 12:14 PM
I've never understood what the return thing means, what exactly does it do? The pulse is to make it fire repeatedly and the reason why I didn't fill in the FireProjectile values is that JKSpecs doesn't tell you what they are, I haven't tried it yet but I'll give it a go.

PS Did anybody else realise that it the taskbar CogWriter is spelt cogwirter ?

You were right about one thing master, the negotiators were short

11-21-2000, 01:46 PM
if you want it to shoot the stormtrooper rifle laser.. fill in FireProjectile() params in your cog that you don't know with the params in the st rifle cog http://forums.massassi.net/html/smile.gif

return; tells the cog that the current message has ended..

and yes.. cogwirter http://forums.massassi.net/html/smile.gif


11-22-2000, 01:14 AM
Cheers Jipe, I'll try that, I also noticed that my IDs are put as ID and not LinkID

You were right about one thing master, the negotiators were short