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 → Force Field Cog
Force Field Cog
2004-03-20, 4:53 PM #1
I need a Force field cog where the FF is deactivated by hitting a switch. I also need to be told how to work it. Thanks a lot!

------------------
Just b/c you're paranoid, don't mean that they're not after you!
<SalvadorChicka> i wasn't all "omg canadians have sex with each other!"
2004-03-21, 12:28 AM #2
You might want to have a look at the Narshaddaa MP Level, there's a cog in there that does exactly what you want. I also think there are some tutorials on the main site explaining the setup of such a cog.

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2004-03-21, 12:58 PM #3
I tried the tutorials, and that cog didn't work for me.

------------------
Just b/c you're paranoid, don't mean that they're not after you!
<SalvadorChicka> i wasn't all "omg canadians have sex with each other!"
2004-03-21, 11:44 PM #4
Hi there [http://forums.massassi.net/html/smile.gif]

I believe the final post I made in this thread may provide the illusive effect you're after [http://forums.massassi.net/html/smile.gif]:

http://forums.massassi.net/html/Forum4/HTML/003961.html

Be warned though - it won't work with solid-colour mats, as I found out... [http://forums.massassi.net/html/wink.gif] Other than that, the final version is "good to go" [http://forums.massassi.net/html/biggrin.gif]

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

-Jackpot

------------------
"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" - 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 ||
2004-03-22, 9:30 AM #5
HEY! I remember that thread! [http://forums.massassi.net/html/biggrin.gif]

------------------
I am Darth Slaw.
The Dark Lord of the Sith,
And part of the Nightfire mod team
May the mass times acceleration be with you.
2004-03-23, 12:46 AM #6
Yes ... so do I... [http://forums.massassi.net/html/rolleyes.gif]

Some people are just never pleased [http://forums.massassi.net/html/wink.gif]

-Jackpot

------------------
"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" - 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 ||
2004-03-23, 8:34 PM #7
Quote:
<font face="Verdana, Arial" size="2">Originally posted by lucky_jackpot:

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

I believe the final post I made in this thread may provide the illusive effect you're after [http://forums.massassi.net/html/smile.gif]:

http://forums.massassi.net/html/Forum4/HTML/003961.html

Be warned though - it won't work with solid-colour mats, as I found out... [http://forums.massassi.net/html/wink.gif] Other than that, the final version is "good to go" [http://forums.massassi.net/html/biggrin.gif]

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

-Jackpot

</font>


Hmm it probably shouldnt be too hard to fix to get it working with solid color mats... its just a flagging issue.

------------------
And everything under the sun is in tune, but the sun is eclipsed by the moon...
DSettahr's Homepage | Cantina Cloud | Rally NY
2004-03-23, 10:40 PM #8
I rest my case - some people are never contented, DSetthar [http://forums.massassi.net/html/wink.gif] [http://forums.massassi.net/html/tongue.gif]

I normally use one of the 00warn[xx] mats for forcefields anyway and never had any trouble with the cog script, so it was never an issue until I started a new MP map (using solid colour mats - [00red.mat if I recall...]) and found that it bombed me back to the desktop...

Took me a while to work out what the problem was [http://forums.massassi.net/html/rolleyes.gif] - cue handslap to head and a "D'OH" exclamation [http://forums.massassi.net/html/biggrin.gif]

-Jackpot

PS: w00t - 400th post (one more hundred to go before I can leave the starting blocks and qualify for the "post count snail-race" [http://forums.massassi.net/html/biggrin.gif] [http://forums.massassi.net/html/biggrin.gif]

------------------
"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" - by Adam Lindsay Gordon)

[This message has been edited by lucky_jackpot (edited March 24, 2004).]
"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 ||
2004-03-24, 11:25 AM #9
Well, if anyone does want to use a solid color mat, they can use this slightly modified version (it's lucky_jackpot's cog with the geo mode for the surfaces stored in a variable instead; can be initialized to 3 or 4 in jed's cog editor dialog, depending on whether the user wants to use a solid or non-solid mat; this makes the cog slightly more flexible). Hope you don't mind that I'm posting this, LJ.

Code:
##
# MOTS Cog Script
#
# 00_multiplayerForceField.COG
#
# Force-field effect on two adjoined surfaces (ff_front and ff_back)
# Will damage player if touched while force-field status is ON.
# May be switch0ed off by either a console (thing) or switch0 (surface).
# Force-field starts being ON (default: status=1).
# Change status=0 if you want the force-field to be OFF at start.
#
# In JED (or something similiar in JK Edit, if you're so inclined...) :
# NB-01: Set +ADJOIN FLAGS to 5
# NB-02: Set +SURFACE FLAGS to 14007
# NB-03: Set +FACE FLAGS to 2
# NB-04: Set +GEO to 4
#
# 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.
#
# version 1 : 12-August-2003
# version 2 : 14-August-2003
# version 3 : 04-December-2003 --> Optimised for multi-player!
#
#
# E-mail: lucky_jackpot@hotmail.com
# [RJS]
#
##


symbols

message startup
message activated
message touched
message damaged
message timer

surface ff_front    linkid=2, mask=0x400
surface ff_back    linkid=2, mask=0x400

surface switch0     linkid=1
thing    console     linkid=1

template    sparks=+heavysmoke                  local

thing   playerReference     local
thing   victim      local

flex    damage      local
flex    damageInterval=0.25     local
flex    minDamage=2.0
flex    maxDamage=10.0

int     status=1                    # 1 is ON ; 0 is OFF
int     damaging=1   local

sound   ff_on=forcefieldon01.wav
sound   ff_off=forcefieldoff01.wav
sound   ff_hum=forcefieldhum01.wav
sound   ff_hit=forcefieldhit01.wav

int     tempSound1  local
int     tempSound2  local
int     tempSound3  local
int     tempSound4  local

int     surfaceGeoMode=4            # use 3 for solid mats; 4 for non-solid mats

int     verbose=0                   # Used as a test variable.  Set to 0 to not print messages...

end

#==============================================================
#==============================================================
#==============================================================


code

startup:

    if (verbose)
        Sleep (1.0);    // Allow dust to settle for a bit...
        Print ("Force Field Status COG EXECUTING !!!");

    if (status == 0) {
        if (verbose)
            Print ("startup: OFF");
        SetWallCel (switch0, 0);
        call forceField_OFF;
    }
    else
    if (status == 1) {
        if (verbose)
            Print ("startup: ON");
        SetWallCel (switch0, 1);
        call forceField_ON;
    }

    return;

#------------------------------------------------------

activated:

    playerReference = GetLocalPlayerThing();

        // Eliminate any possibility that something other than
        // the on-off switch0 OR console could send the
        // "activated" message...
    if (GetSenderID() != 1)
        return;

    if (GetSenderID() == 1) {
        if (status == 0) {
            if (verbose)
            Print ("FF IS OFF");
            PlaySoundPos (ff_off, GetSurfaceCenter (switch0), 0.5, 1, 10, 0); // Play Off sound - switch0
            PlaySoundPos (ff_off, GetThingPos (console), 0.5, 1, 10, 0);  // Play Off sound - console
            SetWallCel (switch0, 0);
            call forceField_OFF;
        }
        else
        if (status == 1) {
            if (verbose)
            Print ("FF IS ON");
            PlaySoundPos (ff_on, GetSurfaceCenter (switch0), 0.5, 1, 10, 0); // Play On sound - switch0
            PlaySoundPos (ff_on, GetThingPos (console), 0.5, 1, 10, 0);  // Play On sound - console
            SetWallCel (switch0, 1);
            call forceField_ON;
        }
    }

    return;

#------------------------------------------------------
touched:

    if (GetSenderID() != 2)
        return;

    if (GetSenderID() == 2) {
        if (verbose)
            Print ("SURFACE TOUCHED !!!!");

        if (status == 1) {
            if (verbose)
                // Strange - you would have thought status would
                // have to be 1 to be ON and damage player, but nevermind
                // - the script works... ;p
                Print ("SAFE TO PASS - OK");
                Print ("FF is off so dont damage...");
        }
        else
        if (status == 0) {
            if (verbose)
                Print ("OUCH !!!");

            damage = (Rand() * (maxDamage - minDamage)) + minDamage;
                // Allow for self-inflicted damage (0x2)
                // Change to 0x1 flag to cut straight through shields and do DIRECT health damage....
            DamageThing (GetSourceRef(), damage, 0x2, GetSenderRef() );

                // Sounds stuff
            tempSound3 = PlaySoundPos (ff_hit, GetSurfaceCenter (ff_front), 0.5, 1, 10, 0);
            tempSound4 = PlaySoundPos (ff_hit, GetSurfaceCenter (ff_back), 0.5, 1, 10, 0);

            if (!IsMulti() )
                CreateThing (sparks, GetSourceRef());
            damaging = 0;
            SetTimer (damageInterval);
        }
    }

    return;

#------------------------------------------------------

damaged:

    if (GetParam (1) == 1) {

        if (GetThingType (GetSourceRef() ) != 10)
            return;

        damage = (Rand() * (maxDamage - minDamage) ) + minDamage;
        DamageThing (GetSourceRef(), damage, 0x01, GetSenderRef() );
    }

    return;

#------------------------------------------------------

timer:

    damaging = 1;
    return;

#------------------------------------------------------

forceField_ON:

        // Floor; Used in COG; Impassable; Magsealed
    SetSurfaceFlags (ff_front, 0x14007);
    SetSurfaceFlags (ff_back, 0x14007);
        // Not passable
    ClearAdjoinFlags (ff_front, 0x2);
    ClearAdjoinFlags (ff_back, 0x2);  // ALT: SetAdjoinFlags (ff_back, 0x5);
        // Geo-mode
    SetFaceGeoMode (ff_front, surfaceGeoMode);   // Surface face
    SetFaceGeoMode (ff_back, surfaceGeoMode);   // is drawn...
        // Surface Face Type Info
    SetFaceType (ff_front, 0x2);  // Translucent
    SetFaceType (ff_back, 0x2);
        // Sounds stuff
    tempSound1 = PlaySoundPos (ff_hum, GetSurfaceCenter (ff_front), 1.5, 2.0, 10.0, 0x1);
    tempSound2 = PlaySoundPos (ff_hum, GetSurfaceCenter (ff_back), 1.5, 2.0, 10.0, 0x1);
        // Set wall cell mat info
    SetWallCel (switch0, 1);
        // Reset status to 0 - OFF
        // (think that status should be 1 ?? Try it and see what happens...
    status = 0;

    return;

#------------------------------------------------------

forceField_OFF:

        // Surface flags
    ClearSurfaceFlags (ff_front, 0x14007);
    ClearSurfaceFlags (ff_back, 0x14007);
        // Adjoins info
    SetAdjoinFlags (ff_front, 0x2);
    SetAdjoinFlags (ff_back, 0x2);    // ALT: SetAdjoinFlags (ff_back, 0x7);
        // Geo-mode
    SetFaceGeoMode (ff_front, 0);   // Don't draw surface
    SetFaceGeoMode (ff_back, 0);
        // Surface Face Type Info
    ClearFaceType (ff_front, 0x2);    // Clears translucency
    ClearFaceType (ff_back, 0x2);     //SetFaceType (ff_back, 0x0);
        // Sounds stuff
    StopSound (tempSound1, 0.5);  // Stop hum sound
    StopSound (tempSound2, 0.5);
    StopSound (tempSound3, 0.2);
    StopSound (tempSound4, 0.2);
        // Set wall cell mat info
    SetWallCel (switch0, 0);
        // Reset status to 1 - ACTIVE
        // (think that status should be 0 ?? Try it and see what happens...
    status = 1;

    return;

#------------------------------------------------------

end
May the mass times acceleration be with you.
2004-03-24, 1:49 PM #10
now i just need to know how to implement it inot my level, i know that the surfaces will have to be flagged a certain way and i dont know it. And also it's a SP level. [http://forums.massassi.net/html/smile.gif]

------------------
Just b/c you're paranoid, don't mean that they're not after you!
<SalvadorChicka> i wasn't all "omg canadians have sex with each other!"
2004-03-24, 3:46 PM #11
Actually, I don't think you have to flag the surfaces any special way for this cog; it appears to do it automatically, depending on the value of the symbol "status", where 1=on and 0=off.

To set it up, you need only (i think) to set the surfaces you want to be ff, the geo mode the surfaces should be set to when the ff is on/hit, and to set status to 0 or 1.

------------------
I am Darth Slaw.
The Dark Lord of the Sith,
And part of the Nightfire mod team
May the mass times acceleration be with you.
2004-03-24, 10:32 PM #12
Dear, oh dear people... [http://forums.massassi.net/html/rolleyes.gif]. All the script's instructions in the file header [http://forums.massassi.net/html/wink.gif] - you'll find exactly what surfaces you'll need to flag with the various flag-types [http://forums.massassi.net/html/smile.gif]

Other than that, Slaw's right - status is the only real "key" variable and that sets it up as either on/off [http://forums.massassi.net/html/smile.gif]

COTF_Dude: This cog works in both SP and MP - heck it does, especially after having written and re-written the blooming cog 3 times... [http://forums.massassi.net/html/wink.gif]

If you need any more help, I've got demo levels of every cog I design for, to test my cogs work (hey - so I'm thorough... [http://forums.massassi.net/html/wink.gif]), so drop me an e-mail and I'll send you the demo [http://forums.massassi.net/html/biggrin.gif]

-Jackpot

PS: Of course I don't mind Slaw - we're all coggers together - any way that makes cogging/editing JK easier for none-coggers is alright by me [http://forums.massassi.net/html/biggrin.gif]

------------------
"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" - 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!