lfnetwork.com mark read register faq members calendar

Thread: [K1] Opening/Closing a Prison Cell
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 06-30-2008, 10:29 PM   #1
JediMaster76
Rookie
 
JediMaster76's Avatar
 
Join Date: Jan 2007
Location: Twilight Zone
Posts: 106
Current Game: Mass Effect 3, Majora's Mask
[K1] Opening/Closing a Prison Cell

How would you go about opening/closing one of the prison cells in K1? For example, I have a character inside the cage, and once you go to a nearby terminal and shut it off, how would you go about shutting down the cage and letting the character go free (the Taris Sith base area w/ the Duro is a good example).


A tale of souls and swords, eternally retold.
JediMaster76 is offline   you may: quote & reply,
Old 07-01-2008, 07:04 AM   #2
stoffe
Network Caretaker
 
stoffe's Avatar
 
Status: Administrator
Join Date: Apr 2002
Posts: 5,833
Helpful! 10 year veteran! Notable contributor 
Quote:
Originally Posted by JediMaster76 View Post
How would you go about opening/closing one of the prison cells in K1? For example, I have a character inside the cage, and once you go to a nearby terminal and shut it off, how would you go about shutting down the cage and letting the character go free (the Taris Sith base area w/ the Duro is a good example).
I don't remember if this is how it works in KOTOR1 as well, but in TSL the force cage force field is made impassable by spawning an invisible placeable (at the same coordinates as the cage placeable) that has a ring-shaped walkmesh roughly the size of the force cage field visual effect. This placeable uses the "ForceCageBlocker" appearance. Then, when the cage field is deactivated a script destroys this placeable to let the player move out of it.

stoffe is offline   you may: quote & reply,
Old 07-01-2008, 07:36 PM   #3
JediMaster76
Rookie
 
JediMaster76's Avatar
 
Join Date: Jan 2007
Location: Twilight Zone
Posts: 106
Current Game: Mass Effect 3, Majora's Mask
I think I get it. So, you need to make a placeable that has an appearance like the "force field" does, and that gets destroyed on a script?


A tale of souls and swords, eternally retold.
JediMaster76 is offline   you may: quote & reply,
Old 07-02-2008, 12:53 AM   #4
Thankteamgizka
Rookie
 
Thankteamgizka's Avatar
 
Join Date: Apr 2008
Posts: 148
you would just have to figure out how to bring it back once the script removes it
Thankteamgizka is offline   you may: quote & reply,
Old 07-02-2008, 07:00 AM   #5
stoffe
Network Caretaker
 
stoffe's Avatar
 
Status: Administrator
Join Date: Apr 2002
Posts: 5,833
Helpful! 10 year veteran! Notable contributor 
Quote:
Originally Posted by Thankteamgizka View Post
you would just have to figure out how to bring it back once the script removes it
That part isn't very hard, you can just spawn and destroy it as necessary when the force cage is toggled. A generic example script of how you can do that:

Code:
void ST_ToggleForceCage(object oCage, int bOverride=-1);


// ST: Main function
void main() {
    ST_ToggleForceCage( GetObjectByTag("st_fcage01") );
}


// ST: Toggle the specificed force cage on and off. This function assumes that
//     the corresponding force field blocker placeable has the same Tag and
//     template (UTP) name as the force cage with a B added at the end. I.e.:
//     Filename: st_fcage01.utp    Tag: st_fcage01
//     Filename: st_fcage01b.utp   Tag: st_fcage01b
void ST_ToggleForceCage(object oCage, int bOverride=-1) {
    if (GetIsObjectValid(oCage)) {
        string sBlocker = GetTag(oCage) + "b";
        
        // Cage is active - turn it off
        if (GetLocalBoolean(oCage, 40) || (bOverride == FALSE)) {
            AssignCommand(oCage, ActionPlayAnimation( ANIMATION_PLACEABLE_OPEN ));
            DestroyObject(GetObjectByTag(sBlocker), 0.0, TRUE);
            SetLocalBoolean(oCage, 40, FALSE);
        }
        else if (!GetLocalBoolean(oCage, 40) || (bOverride == TRUE)) {
            AssignCommand(oCage, ActionPlayAnimation( ANIMATION_PLACEABLE_CLOSE ));
            CreateObject(OBJECT_TYPE_PLACEABLE, sBlocker, GetLocation(oCage));
            SetLocalBoolean(oCage, 40, TRUE);
        }
    }   
}
(That script would toggle a (properly set up) force cage on/off every time it was run.)

The hardest part of doing this for KOTOR1 is probably to create an invisible placeable with no model but a ring-shaped walkmesh with the same radius as the force cage placeable, similar to the plc_forcecageblk placeable in TSL.

Quote:
Originally Posted by JediMaster76 View Post
I think I get it. So, you need to make a placeable that has an appearance like the "force field" does, and that gets destroyed on a script?
The force cage placeable has the visual force field effect built in already, which you can toggle on/off as a placeable animation. But it's just a visual effect, so the player could walk right through it. Thus you need an invisible placeable that can't be walked through to block characters from walking through the field when active.

stoffe is offline   you may: quote & reply,
Old 07-02-2008, 03:31 PM   #6
JediMaster76
Rookie
 
JediMaster76's Avatar
 
Join Date: Jan 2007
Location: Twilight Zone
Posts: 106
Current Game: Mass Effect 3, Majora's Mask
Alright, thanks Thankteamgizka and stoffe! Your help is appreciated.

Edit: Hmm, I run the script posted above in a dialog, but the force field doesn't turn off. It stays the same. I'm assuming the "ANIMATION_PLACEABLE_OPEN" and "ANIMATION_PLACEABLE_CLOSE" are responsible for making the cage's visual effect?


A tale of souls and swords, eternally retold.

Last edited by JediMaster76; 07-02-2008 at 07:08 PM.
JediMaster76 is offline   you may: quote & reply,
Old 07-12-2008, 11:27 AM   #7
tk102
Well past expiration date
 
tk102's Avatar
 
Join Date: Jan 2004
Posts: 5,766
Current Game: Dragon Age: Origins
Forum Veteran Helpful! Notable contributor 
I think the bOverride parameter is err... overriding. Maybe:
Code:
void ST_ToggleForceCage(object oCage, int nOverride=0);


// ST: Main function
void main() {
    ST_ToggleForceCage( GetObjectByTag("st_fcage01") );
}


// ST: Toggle the specificed force cage on and off. This function assumes that
//     the corresponding force field blocker placeable has the same Tag and
//     template (UTP) name as the force cage with a B added at the end. I.e.:
//     Filename: st_fcage01.utp    Tag: st_fcage01
//     Filename: st_fcage01b.utp   Tag: st_fcage01b
//   
//     optional parameter nOverride can be set to 1=force OFF, 2=force ON

void ST_ToggleForceCage(object oCage, int nOverride=0) {
    if (GetIsObjectValid(oCage)) {
        string sBlocker = GetTag(oCage) + "b";
        
        // Cage is active - turn it off
        if (GetLocalBoolean(oCage, 40) || (nOverride == 1)) {
            AssignCommand(oCage, ActionPlayAnimation( ANIMATION_PLACEABLE_OPEN ));
            DestroyObject(GetObjectByTag(sBlocker), 0.0, TRUE);
            SetLocalBoolean(oCage, 40, FALSE);
        }
        else if (!GetLocalBoolean(oCage, 40) || (nOverride == 2)) {
            AssignCommand(oCage, ActionPlayAnimation( ANIMATION_PLACEABLE_CLOSE ));
            CreateObject(OBJECT_TYPE_PLACEABLE, sBlocker, GetLocation(oCage));
            SetLocalBoolean(oCage, 40, TRUE);
        }
    }   
}


tk102 is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > Knights of the Old Republic > Editing / Modding > Holowan Laboratories > [K1] Opening/Closing a Prison Cell

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:23 AM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.