Results 1 to 7 of 7

Thread: Laser Projector

  1. #1

    Laser Projector

    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:

    symbols
    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
    end

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

    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
    end

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

  2. #2
    Doesn't know that mice use holes.
    Posts
    2,516
    's pr'y the fireprojectile command in the pulse message , it doesn't have values for all the parameters , jk doesn't like that.:

    peace.
    -Dormouse

    ------------------
    #define QUESTION((2b) | | !(2b))
    /*Shakespeare*/
    Also, I can kill you with my brain.

  3. #3
    Targeted for Annihilation
    Posts
    223
    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
    "Good Asian dubs are like Steven Segal and plot; they just dont appear in the same movie." -Spork

  4. #4
    Registered User
    Posts
    494
    Home Sliced is exactly right.. use Cogwriter to check your syntax, it's full of errors

    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);

    -Jipe

  5. #5
    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

  6. #6
    Registered User
    Posts
    494
    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

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

    and yes.. cogwirter

    -Jipe


  7. #7
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •