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 → Where do you go to create cogs?
Where do you go to create cogs?
2003-08-30, 10:52 AM #1
I have been reading the tutorials over and over, and where it goes through how to create objectives, it doesn't tell my where to go to make the cogs.

Please, all I want to do at this point is figure out how to end my level. But, I need someone who is willing to take me through step by step on how (and where) to create a cog that ends the level when the player gets to the x-wing.

Any help I get is appreciated.

------------------
Just call me Madame Newbie
Just call me Madame Newbie
2003-08-30, 12:31 PM #2

Hi there [http://forums.massassi.net/html/smile.gif]

First off, (as I noticed your new-ish around here) welcome to Massassi [http://forums.massassi.net/html/smile.gif]

Now just as it happens, I was working on a cog that caters for ending most of the levels (not every way of ending a level, as there are hundreds of ways for that possibility to occur) but for more than your average needs, why not give this cog a whirl:

Code:
## Jedi Knight COG Script
#
# 00_different_jkendlevels.COG
#
#   This COG Script caters for various types of endings
#   for a jk level.
#
# Set verbose=1, if you want to see print out messages.
# (More for test purposes than anything else...)
#
# This COG script is NOT supported by LucasArts or LEC.
#
# Permission is granted to use this script by the author, as long as credit
# is provided in the readme file for any add-on levels that use this script.
#
# Revised: 26-Aug-2003
#
#
# (c) Richard John Sproston 2001
# E-mail: lucky_jackpot@hotmail.com
# [RJS]
#
##

#...........................................................................................
#...........................................................................................
#...........................................................................................

SYMBOLS

    message entered
    message exited
    message activated
    message touched
    message taken
    message crossed
    message killed


    sector  enter_sector  linkid=1  # Works with "entered" msg,
                                             # (when player enters a specific sector).

    sector  exit_sector    linkid=2  # Works with "exited" msg,
                                             # (when player leaves a specific sector).

    surface switch01       linkid=3  # Use if you want to have the player
                                             # press a switch to end the level.

    surface tread_surf     linkid=4  # A Surface which ends the level
                                             # when the player steps on it.

    thing   item1             linkid=5 # Used if an item needs to be collected
                                             # to end level.

    thing   touched_thing linkid=6 # Used if a player needs to be
                                             # touched "t-e-l".

    thing   activated_thing linkid=7 # If a player needs to activate
                                              # a thing "t-e-l".

    thing   killed_thing      linkid=8  # Used if the player needs to
                                              # kill a thing "t-e-l".

    int     protectMode=0            # Used in conjunction with linkid=8;
                                             # Set to 0, then you must KILL "killed_thing"
                                             # to COMPLETE mission.
                                             #
                                             # Set to 1 then you must PROTECT
                                             # "killed_thing", otherwise you FAIL mission
                                             # if they die.

    thing   enterSector_thing   linkid=9  # Use if a thing enters a specifc sector
                                                    # Used in conjunction with linkid=1

    sound completed=accomplish1.wav
    sound failed

    flex    sleepBeforeEndLevel
    int     verbose=0

END

#...........................................................................................
#...........................................................................................
#...........................................................................................

CODE

#...........................................................................................

entered:

    if ( (GetSenderID() != 1) || (GetSenderID() != 9) )
        return;

    if (GetSenderID() == 1) {
        if (GetSourceRef() == GetLocalPlayerThing() ) {
            if (verbose)
            Print ("Sender ID's match - end level");
            call level_ends_now;    // Successful...
        }
        else
        if (GetSourceRef() == enterSector_thing) {
            if (verbose)
            Print ("Thing entered the trigger sector, before player could stop it - MISSION FAILED");
            JkEndLevel (0); // Fail Mission
        }
    }

    return;

#...........................................................................................

exited:

    if (GetSenderID() != 2)
        return;

    if (GetSenderID() == 2) {
        if (verbose)
        Print ("Sender ID's match - end level");
        call level_ends_now;
    }

    return;

#...........................................................................................

activated:

    if ( (GetSenderID() !=3) || (GetSenderID() != 7) )
        return;


    if (GetSenderID () == 3) {
        if (verbose)
        Print ("ID Match: 3 --- This is surface 'switch01' ...");
        call level_ends_now;
    }

    if (GetSenderID() == 7) {
        if (verbose)
        Print ("ID Match: 7 --- This is an activated thing - console, player etc");
        call level_ends_now;
    }

    return;

#...........................................................................................

taken:

    if (GetSenderRef() != item1) {  // Return to game if the item
        return;                             // was not the sender of the msg.
    }


        // If the message sender was the item, then continue....
    if (GetSenderRef() == item1) {
        if (verbose)
        Print ("Item has been touched - prepare for remove, if criteria fits...");

            // Return to game, if the person who touched the item, was NOT the player...
        if (GetSourceRef() != GetLocalPlayerThing() ) {
            if (verbose)
            Print ("Item touched, but not taken - only player can take the item...");
            return;
        }

            // If the check has passed, then proceed to the custom function call...
        call level_ends_now;
    }

    return;

#...........................................................................................

touched:

    if ( (GetSenderID() != 5) || (GetSenderID() != 6) )
        return;


    if (GetSenderID() == 5) {
        if (verbose)
        Print ("Sender ID Match: 5 --- item thing has been touched");
        call level_ends_now;
    }

    if (GetSenderID() == 6) {
        if (verbose)
        Print ("Sender ID Match: 6 --- thing console, elev, actor, etc");
        call level_ends_now;
    }

    return;

#...........................................................................................

crossed:

    if (GetSenderID() != 4)
        return;

    if (GetSenderRef() == tread_surf) {
        if (verbose)
        Print ("An end-level surface has been touched...");
        call level_ends_now;
    }

    return;


#...........................................................................................

killed:

        // If "killed_thing" thing is killed...
    if (GetSenderID() == 8) {
        if (protectMode == 0) {     // MUST KILL A PERSON !!!
            if (verbose)
            Print ("Target has been killed - Mission Completed Succesfully");
            PlaySoundLocal (completed, 1, 0, 0x0);
            call level_ends_now;
        }
        else
        if (protectMode == 1) {     // MUST STOP A PERSON BEING KILLED !!!
            if (verbose)
            Print ("The person you were meant to protect has died: Mission Failed...");
            PlaySoundLocal (failed, 1, 0, 0x0);
            JKEndLevel (0);     // End in a failure...
        }
    }

    return;

#...........................................................................................


level_ends_now:

    sleep (sleepBeforeEndLevel);
    JkEndLevel (1); // Mission successful

    return;

#...........................................................................................

end


Feel free to post back with any queries/comments/questions etc, as I'll gladly go through them with you (this script should work, but alas I haven't had time to test it recently...) [http://forums.massassi.net/html/biggrin.gif]

Hope this helps, and welcome once again to Massassi (and the COG forum) [http://forums.massassi.net/html/biggrin.gif]

-Jackpot

------------------
Are you feeling lucky, cuz if you are, get your hands off me... ;)

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2003-08-30, 12:45 PM #3

Oh ... btw [http://forums.massassi.net/html/smile.gif] --> for where to place the cogs, once you've written a cog script, place it in the "cog" folder of your level's root directory (or alternatively, run the JKTree plugin that can be found at Code Alliance or Massassi's plugins page, I think) and place the cog script in that folder.

Then, in your level (if you're using Jed), press F7 to bring up the COG window. From here, click the "Add Cog..." button and select your cog script to include from the available resources list (your cog should be in the "COG" folder provided by Jed, I believe). Then it's a case of filling in the parameters as appropriate (whether it be sector, surface, thing etc etc) and click the "Refresh" button [http://forums.massassi.net/html/smile.gif]

Hope this helps [http://forums.massassi.net/html/biggrin.gif]

-Jackpot

------------------
Are you feeling lucky, cuz if you are, get your hands off me... ;)

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2003-08-31, 12:16 AM #4
Without a doubt one of the most comprehensive replies ever.

You da man Lucky Jackpot.

ZERO1979 (guess who)

------------------
Infamous and rented

ZERO1979
2003-08-31, 1:29 AM #5
Well shucks ... if I didn't know that phrase or the name, then I'd just have to have a guess at Major Tom - the most bearded of all bearded Jedi Knights lol [http://forums.massassi.net/html/wink.gif]

Take it easy buddy, and welcome to the Massassi Forums [http://forums.massassi.net/html/smile.gif]

-Jackpot [http://forums.massassi.net/html/biggrin.gif]

PS: You need a sig lol [http://forums.massassi.net/html/wink.gif]

------------------
Are you feeling lucky, cuz if you are, get your hands off me... ;)

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2003-08-31, 6:59 PM #6
I'm still a little confused. Where is one supposed to write the cog script? Is it just in notepad or something like that? Remember, I'm not only new to Massassi.net, but also new to JED. I just spent like a half an hour trying to figure out why my cooridor didn't adjoin to the room before I realised they were not exactly the same size.

------------------
Just call me Madame Newbie
Just call me Madame Newbie
2003-08-31, 10:49 PM #7

Ahh right - ultra n00b [http://forums.massassi.net/html/wink.gif] No probs [http://forums.massassi.net/html/smile.gif] - you can write cog scripts in any text editor (notepad is fine) and when you come to save the file, select "All Files" and name the file "yourFile.COG" - note the file extension of ".cog".

Hope this helps [http://forums.massassi.net/html/biggrin.gif] If you need more assistance, don't hesitate to ask [http://forums.massassi.net/html/smile.gif]

-Jackpot

------------------
Are you feeling lucky, cuz if you are, get your hands off me... ;)

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2003-09-01, 11:42 AM #8
Check the sig, lucky jackpot. The name's MADAME newbie, not ultra n00b. [http://forums.massassi.net/html/wink.gif]

Thanks for your help.

Now, all I have to do is figure out how to write cogs that do what I want them to. [http://forums.massassi.net/html/biggrin.gif]

------------------
Just call me Madame Newbie
Just call me Madame Newbie
2003-09-01, 1:08 PM #9
Hey no probs "MADAME newbie" [http://forums.massassi.net/html/wink.gif] - that's why us coggers are here to help the budding/aspiring editor [http://forums.massassi.net/html/wink.gif]

(and maybe, just *maybe*, persuade them that programming isn't as painful as people make it out to be... [http://forums.massassi.net/html/wink.gif] )

Hope to see you round to help you out [http://forums.massassi.net/html/biggrin.gif]

-Jackpot

------------------
Are you feeling lucky, cuz if you are, get your hands off me... ;)

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2003-09-03, 11:49 AM #10
I took a VB class in college(which I am currently attending, so don't think of me as an OLD newbie), and had a hard time understanding that language.

One thing I think I need to be able to understand the cog stuff, if I had examples of lines of Cog, and explanations of what it does. The closest thing i have found to that so far in the tutors is one on cutscenes.

------------------
Just call me Madame Newbie
Just call me Madame Newbie
2003-09-03, 12:50 PM #11
The basics of VB are pretty easy to learn (haven't programmed in it for a while though - I'm more of a Java sadist now [http://forums.massassi.net/html/wink.gif] ) and you can create GUIs for it easily enough ... but I digress [http://forums.massassi.net/html/wink.gif]

In contrast, COG is easier to learn, partly because there's less of the language than VB (but needless to say, someone's bound to object with my rather bold statement there...) [http://forums.massassi.net/html/wink.gif]

I thought that the cog script I supplied had more than enough code commenting to help you out, but if you require further assistance, then don't hesitate to call back here (or even email me - I've been known before now to take editing and cogging "master-classes for beginners" over MSN before now lol)

But if you would like me to email you some of the basic concepts then just call back here, or again, feel free to email me... It could take me a couple of days to compile a basics guide though (if you're interested), as I'm on my Industrial Year, out of uni, and getting up at 6:00am to get to work is killing me - working as an Assistant Network Manager for a school, where the kids find it amusing to rearrange the letters on the keyboard to spell expletives and then glue them into place.... (no I'm not joking - it really does happen lol) [http://forums.massassi.net/html/biggrin.gif]

-Jackpot

------------------
Are you feeling lucky, cuz if you are, get your hands off me... ;)

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2003-09-03, 7:43 PM #12
Jackpot's already covered everything (thanks, btw [http://forums.massassi.net/html/wink.gif])... I'll just put in another plug for the DataMaster and exit quietly. [http://forums.massassi.net/html/cool.gif]

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2003-09-04, 7:58 AM #13
lol SaberMaster - a truly shameless display of plugging there [http://forums.massassi.net/html/wink.gif]

But ultimately, you're right SaberMaster - if you (anyone) wants to learn COG, then download the DataMaster - that has all of the basics (and more) --- that (as coggers) is by all accounts, the BIBLE for all your cogging resources and references.

Just thought that I'd also put a mention in that at present, I'm working on "JCOG" - a Java program that (I hope in the end, if I get the the time to finish it) will benefit aspiring coggers by combining the DataMaster and Parsec, as well as providing a script builder/debugger facility and sample COG scripts (the builder/debugger is being a bit awkward at the moment, plus I don't have as much spare time, now these early mornings are getting to me...).

I'm hoping my knowledge of Java progresses, because I would really like to finish this "spare-time" project... I've got the GUI end finished, and some of the underlying data-structures, but hey - you'll have to wait and see for "JCOG"... [http://forums.massassi.net/html/biggrin.gif]

-Jackpot

PS: Oh - and no probs SaberMaster [http://forums.massassi.net/html/wink.gif] Always glad to help out [http://forums.massassi.net/html/biggrin.gif]

------------------
Are you feeling lucky, cuz if you are, get your hands off me... ;)

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2003-09-04, 5:55 PM #14
Try getting up to be at work at 3:30 am every morning.

Datamaster? WHere do I get that?

I do have to admit that I've been busy in other things and I haven't done anything with that end level cog you posted. Been working on setting up a lot of the physical aspects of my level, and GMing at the Role Play Forums at theforce.net, my home at home. [http://forums.massassi.net/html/biggrin.gif]

------------------
Just call me Madame Newbie
Just call me Madame Newbie
2003-09-05, 11:18 AM #15
Hi there (again) [http://forums.massassi.net/html/biggrin.gif]

The "DataMaster" (aka "The BIBLE") that is referred to, has the link provided in SaberMaster's sig (JK DataMaster).

It's a direct link to his "files" page where you can download lots of useful cog resources. Whilst I'm mentioning this (because I think I'm going to beat SaberMaster to it, and stop him blowing his own trumpet [http://forums.massassi.net/html/wink.gif] ), downloading Parsec would be an equally good idea, as it parses/debugs any cog scripts you write and returns useful error/debugging information. I feel it's made my cogging more efficient in general, so a big thumbs up there SaberMaster [http://forums.massassi.net/html/biggrin.gif]

Anyways - hope all this helps MarnaVeign [http://forums.massassi.net/html/biggrin.gif] Don't be a stranger if you have some/any queries (no matter how small or large) [http://forums.massassi.net/html/smile.gif]

-Jackpot

------------------
Are you feeling lucky, cuz if you are, get your hands off me... ;)

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2003-09-06, 1:47 PM #16
Thanks so much, Lucky_Jackpot, for all the help you're giving me. It is appreciated more than I can repay. Sorry to say that my level may not even be a good payback for the help you're giving me. [http://forums.massassi.net/html/biggrin.gif]

------------------
Just call me Madame Newbie
Just call me Madame Newbie
2003-09-07, 6:32 AM #17
Hey - no probs [http://forums.massassi.net/html/smile.gif]

That's what a community's for [http://forums.massassi.net/html/biggrin.gif] Just make sure you drop by now and again and throw us a question, so we stay on our toes [http://forums.massassi.net/html/wink.gif]

Best of luck with the editing and cogging [http://forums.massassi.net/html/biggrin.gif]

-Jackpot

PS: w00t - my 100th post. If only I had something memorable I could type. Oh I know - "w00t !!!" [http://forums.massassi.net/html/wink.gif] lol

------------------
Are you feeling lucky, cuz if you are, get your hands off me... ;)

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||

↑ Up to the top!