mrdefender Posted January 9, 2006 Share Posted January 9, 2006 I'm working on some options for my wrist console that would/should only to show up if the player is on a specific planet.... I want to check all of the rooms on that planet, if the player is in any of them, the option would show up.... Would this script work properly for the entire onderon planet? I did a search for "*ond*.rim" , I found some ###ond.rim and some ###_s.rim but I used the names without the _s .... (used the "c_area_ebonhawk" script as a point of reference...) int StartingConditional() { if ((GetModuleName() == "501OND") || (GetModuleName() == "502OND") || (GetModuleName() == "503OND") || (GetModuleName() == "504OND") || (GetModuleName() == "505OND") || (GetModuleName() == "506OND") || (GetModuleName() == "510OND") || (GetModuleName() == "511OND") || (GetModuleName() == "512OND") ) { return TRUE; } return FALSE; } Link to comment Share on other sites More sharing options...
Prime Posted January 9, 2006 Share Posted January 9, 2006 Yeah, I think that should work, and it looks like you have all the Onderon ones. Note that if you want to find all the areas for a planet, you can just got to KOTOR II -> RIMs -> Modules and you can see them all. Link to comment Share on other sites More sharing options...
Darth333 Posted January 9, 2006 Share Posted January 9, 2006 Instead of listing all the modules on one planet, this is what I used in the USM random loot script: string sModule = GetModuleName(); string sSub = GetSubString(sModule,3,3); if (sSub=="OND") { blabla } It will apply to all the modules on Onderon. Here is how it works: I first get the module name with the GetModuleName() function. Then, if you look at how the modules are named in TSL, you will notice that they all start with xxxABC (3 numbers followed by 3 letters). For a given planet, the numbers change but not the letters. Per example for Onderon,each module is named xxxOND . This is where the GetSubString function comes in: you want to make your script applcable to all the modules that have OND as the 4th,5th and 6th characters in their name. GetSubString(string sString, int nStart, int nCount); nStart is after how many characters you want the check to begin and nCount how many characters you want to check. If you use only GetModuleName you have to list all the modules on a planet. Btw, for use with a dialogue, there is a script ready to use: c_mand_planet.nss It says it's for Mandalore but you can use it for whatever you want. You only need to specify the planet in the .dlg file. Link to comment Share on other sites More sharing options...
mrdefender Posted January 9, 2006 Author Share Posted January 9, 2006 Cool! Thanks alot!! Just another quick question, I took a look at that mand_planet script... If I'm not mistaken, "nPlanet" is associated with the "case #" ? So If I were to check if we're on telos, then nPlanet would have to be 2... ? right? :| I've run into alot of these "case" scripts and never got to figguring out exactly how they work (though this is the first script that makes sense to me as far as cases go ) int StartingConditional() { int nPlanet = GetScriptParameter(1); int nResult = FALSE; string sCurModule = GetModuleName(); string sSubString = GetSubString(sCurModule,3,3); AurPostString("Current Module = " + sCurModule + " Substring = " + sSubString,10,5,5.0); switch(nPlanet) { case 2: { if(sSubString == "TEL") nResult = TRUE; } break; Link to comment Share on other sites More sharing options...
Darth333 Posted January 9, 2006 Share Posted January 9, 2006 For the switch and case statements, check this: http://library.thinkquest.org/C0111571/manual.php?tid=13 In the .dlg file, you should see small boxes named P1, p2, P3, P4 , P5. If you look at c_mand_planet.nss you should see the following line: int nPlanet = GetScriptParameter(1); It refers to the first box (P1) . So just attach the script as you would normally do in the conditioanl script field and type the number for the planet you want in the P1 box of your .dlg branch (Telos would be 2). Look at mandalores .dlg file if you want to see it in use (Entries 60, 63, 67, 69, 71, 73, 76) The explanation is a bit messy but it's pass midnight here Link to comment Share on other sites More sharing options...
stoffe Posted January 9, 2006 Share Posted January 9, 2006 Instead of listing all the modules on one planet, this is what I used in the USM random loot script: (snip) string sSub = GetSubString(sModule,3,3); If you do this and you really want to be on the safe side you might want to check that the module name is in the default format first. Like... string sModule = GetModuleName(); if (GetStringLength(sModule) == 6) { int iNum = StringToInt(GetStringLeft(sModule, 3)); string sPlanet = GetStringRight(sModule, 3); if ((iNum >= 501) && (iNum <= 520) && (sPlanet == "OND")) { // We are probably on Onderon... } } Otherwise this could potentially return a "false positive" if the player is in a non-standard module created by a modder that happen to contain "OND" at that place in the module name. Granted, the risk of that happening is fairly small. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.