JediMaster76 Posted July 1, 2008 Share Posted July 1, 2008 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). Link to comment Share on other sites More sharing options...
stoffe Posted July 1, 2008 Share Posted July 1, 2008 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. Link to comment Share on other sites More sharing options...
JediMaster76 Posted July 1, 2008 Author Share Posted July 1, 2008 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? Link to comment Share on other sites More sharing options...
Thankteamgizka Posted July 2, 2008 Share Posted July 2, 2008 you would just have to figure out how to bring it back once the script removes it Link to comment Share on other sites More sharing options...
stoffe Posted July 2, 2008 Share Posted July 2, 2008 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: 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. 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. Link to comment Share on other sites More sharing options...
JediMaster76 Posted July 2, 2008 Author Share Posted July 2, 2008 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? Link to comment Share on other sites More sharing options...
tk102 Posted July 12, 2008 Share Posted July 12, 2008 I think the bOverride parameter is err... overriding. Maybe: 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); } } } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.