TriggerGod Posted June 14, 2008 Author Share Posted June 14, 2008 Alright. I used Exile's script, and who guessed, it compiled successfully Now, how would I attach this script to a dialog? I know that the dlgeditor has that script area. do I put the ncs name there and what about parameter 1? Link to comment Share on other sites More sharing options...
Exile007 Posted June 14, 2008 Share Posted June 14, 2008 Alright. I used Exile's script, and who guessed, it compiled successfully Now, how would I attach this script to a dialog? I know that the dlgeditor has that script area. do I put the ncs name there and what about parameter 1? Yeah, put it in the script area. Save the Dialog and script into your Override folder. You cannot have accessed that dialog before though, otherwise it will not be overriden. Link to comment Share on other sites More sharing options...
TriggerGod Posted June 14, 2008 Author Share Posted June 14, 2008 Of course Link to comment Share on other sites More sharing options...
EnderWiggin Posted June 14, 2008 Share Posted June 14, 2008 I probably used too many declarations of variables but yeah. That's not really a problem Alright. I used Exile's script, and who guessed, it compiled successfully Now, how would I attach this script to a dialog? I know that the dlgeditor has that script area. do I put the ncs name there and what about parameter 1? Don't worry about the parameters, that has to do with game scripts that are already written. And make sure you put the filename into the box without the *.ncs extension. _EW_ Link to comment Share on other sites More sharing options...
TriggerGod Posted June 15, 2008 Author Share Posted June 15, 2008 of course Sorry for the double post, but since this is for questions, and that question has been answered, I would like new script halp. I'm still a noob who hasn't learned about scripting (I can't even open nwsscript) and heres my problem: My problem is that I want a script that'll spawn a new NPC on the docking module of Nar Shaddaa (Module with Ebon Hawk). And in that NPC's dialog, I want a script that'll teleport me to the base of the red eclipse (AKA reused Telos Base) Can I has halp? Link to comment Share on other sites More sharing options...
JediMaster76 Posted June 15, 2008 Share Posted June 15, 2008 For the spawn script, there are several options. Go here for the most common ways to attach spawn scripts to dialog. http://www.lucasforums.com/showthread.php?t=143536 *Edit - Actually, Ulmont, that's for items, and though they are almost the same, for NPCs, one would replace the last 3 lines with the following... { AssignCommand(oNPC,ActionMoveToObject(oPC)); AssignCommand(oNPC,ActionStartConversation(oPC,"my_dlg")); //replace my_dlg by the name of the dlg file the custom npc is supposed to use } For the warp script, simply attach this to the dialog... void main() { StartNewModule("custom_module"); } Just replace "custom_module" with your custom module (or a pre-existing module), but don't replace the " ". Link to comment Share on other sites More sharing options...
Ulmont Posted June 15, 2008 Share Posted June 15, 2008 //note this code allows for re-entry as-is, // you should only attach it to a dialog // that you know will only fire once. // To prevent re-entry in a more general sense, see tk102's notes in the next post void main() { float x=0.00f; //Here is where you add the 'whereami' cheat coordinate 1. float y=0.00f; //Here is where you add the 'whereami' cheat coordinate 2. float z=0.00f; //Here is where you add the 'whereami' cheat coordinate 3. float r=0.0f; // This is where you set the orientation of the placeable, set in degrees. vector MyVec = Vector(x,y,z); //line 1 location MyLoc = Location(MyVec, r); //line 2 object oLocker=CreateObject( OBJECT_TYPE_PLACEABLE, "footlker099", MyLoc); //line3 CreateItemOnObject("g_w_lghtsbr05", oLocker); CreateItemOnObject("g_a_mstrrobe01", oLocker); CreateItemOnObject("g_w_sbrcrstl04", oLocker, 2); } Does that help? (That's RH's code BTW) Link to comment Share on other sites More sharing options...
Exile007 Posted June 15, 2008 Share Posted June 15, 2008 Here I'll help. First off, take the Decompiled version of "k_303nar_enter" (get this from 303Nar_s.rim, decompile it via DeNCS) If you have ANY questions, please ask. void main() { if (GetLoadFromSaveGame()) { return; } object oEntering = GetEnteringObject(); if ((oEntering == GetFirstPC())) { if ((GetGlobalNumber("351NAR_G0T0_Ship") && (!GetLocalBoolean(OBJECT_SELF, 55)))) { SetLocalBoolean(OBJECT_SELF, 5, 1); YavinHackDoorClose(GetObjectByTag("TO_304NAR", 0)); if ((GetObjectByTag("Rod_Jekk", 0) != OBJECT_INVALID)) { DestroyObject(GetObjectByTag("Rod_Jekk", 0), 0.0, 0, 0.0, 0); } if ((GetObjectByTag("Tran_Jekk", 0) != OBJECT_INVALID)) { DestroyObject(GetObjectByTag("Tran_Jekk", 0), 0.0, 0, 0.0, 0); } if ((GetObjectByTag("sullustan_vogga", 0) != OBJECT_INVALID)) { DestroyObject(GetObjectByTag("sullustan_vogga", 0), 0.0, 0, 0.0, 0); } if ((GetObjectByTag("RedEclipseCrew1", 0) != OBJECT_INVALID)) { DestroyObject(GetObjectByTag("RedEclipseCrew1", 0), 0.0, 0, 0.0, 0); } if ((GetObjectByTag("RedEclipseCrew2", 0) != OBJECT_INVALID)) { DestroyObject(GetObjectByTag("RedEclipseCrew2", 0), 0.0, 0, 0.0, 0); } if ((GetObjectByTag("RedEclipseCrew3", 0) != OBJECT_INVALID)) { DestroyObject(GetObjectByTag("RedEclipseCrew3", 0), 0.0, 0, 0.0, 0); } if (GetJournalEntry("30011")) { AddJournalQuestEntry("30011", 10, 0); } } if (((GetGlobalNumber("300NAR_Bounty_Attack") > 0) && (GetGlobalNumber("351NAR_G0T0_Ship") == 0))) { SetAreaUnescapable(1); } else { if ((GetGlobalNumber("351NAR_G0T0_Ship") == 1)) { SetAreaUnescapable(0); } } if ((GetGlobalNumber("201TEL_Chano_Spawn") == 4)) { SetGlobalNumber("201TEL_Chano_Spawn", 5); CreateObject(1, "chano", GetLocation(GetObjectByTag("wp_chano_sp", 0)), 0); } if ((((((GetObjectByTag("lndspdr003", 0) == OBJECT_INVALID) && GetGlobalNumber("302NAR_Airspeeder_41")) && GetGlobalNumber("302NAR_Airspeeder_42")) && GetGlobalNumber("302NAR_Airspeeder_43")) && (GetGlobalNumber("302NAR_Airspeeder_44") == 2))) { CreateObject(64, "lndspdr003", GetLocation(GetObjectByTag("wp_airtaxi", 0)), 0); } SetGlobalNumber("303NAR_Entered", 1); if (((GetJournalEntry("InterGRU") == 30) && (GetObjectByTag("aaida", 0) == OBJECT_INVALID))) { CreateObject(1, "n_commf001", GetLocation(GetObjectByTag("WP_aaida_spawn", 0)), 0); } if (GetGlobalBoolean("303NAR_SWITCH_TO_PC")) { AurPostString("MiraAPTConv", 15, 15, 5.0); ExecuteScript("a_miraapatconv", OBJECT_SELF, 0xFFFFFFFF); } } } Yes I know it is a bit scary, but you only need a few lines of code. After the second to last bracket at the bottom add the following lines. if (!GetIsObjectValid(GetObjectByTag("npc_tag"))) CreateObject(OBJECT_TYPE_CREATURE, "creature_templateresref", Location(Vector(0.00,0.00,0.00), 0.0)); } If you've done some basic NPC spawning then you'll know to replace "creature_templateresref" with the ResRef of your creature. You'll also know to replace "npc_tag" with the tag of the NPC. Replace the Vector stuff with the coordinates gotten from GM's FindMe force power. Ok, now time to implent the new character into the module. This should be the new script, YOU DON'T HAVE TO UNDERSTAND IT! JUST LOOK AT THE LAST FEW LINES! void main() { if (GetLoadFromSaveGame()) { return; } object oEntering = GetEnteringObject(); if ((oEntering == GetFirstPC())) { if ((GetGlobalNumber("351NAR_G0T0_Ship") && (!GetLocalBoolean(OBJECT_SELF, 55)))) { SetLocalBoolean(OBJECT_SELF, 5, 1); YavinHackDoorClose(GetObjectByTag("TO_304NAR", 0)); if ((GetObjectByTag("Rod_Jekk", 0) != OBJECT_INVALID)) { DestroyObject(GetObjectByTag("Rod_Jekk", 0), 0.0, 0, 0.0, 0); } if ((GetObjectByTag("Tran_Jekk", 0) != OBJECT_INVALID)) { DestroyObject(GetObjectByTag("Tran_Jekk", 0), 0.0, 0, 0.0, 0); } if ((GetObjectByTag("sullustan_vogga", 0) != OBJECT_INVALID)) { DestroyObject(GetObjectByTag("sullustan_vogga", 0), 0.0, 0, 0.0, 0); } if ((GetObjectByTag("RedEclipseCrew1", 0) != OBJECT_INVALID)) { DestroyObject(GetObjectByTag("RedEclipseCrew1", 0), 0.0, 0, 0.0, 0); } if ((GetObjectByTag("RedEclipseCrew2", 0) != OBJECT_INVALID)) { DestroyObject(GetObjectByTag("RedEclipseCrew2", 0), 0.0, 0, 0.0, 0); } if ((GetObjectByTag("RedEclipseCrew3", 0) != OBJECT_INVALID)) { DestroyObject(GetObjectByTag("RedEclipseCrew3", 0), 0.0, 0, 0.0, 0); } if (GetJournalEntry("30011")) { AddJournalQuestEntry("30011", 10, 0); } } if (((GetGlobalNumber("300NAR_Bounty_Attack") > 0) && (GetGlobalNumber("351NAR_G0T0_Ship") == 0))) { SetAreaUnescapable(1); } else { if ((GetGlobalNumber("351NAR_G0T0_Ship") == 1)) { SetAreaUnescapable(0); } } if ((GetGlobalNumber("201TEL_Chano_Spawn") == 4)) { SetGlobalNumber("201TEL_Chano_Spawn", 5); CreateObject(1, "chano", GetLocation(GetObjectByTag("wp_chano_sp", 0)), 0); } if ((((((GetObjectByTag("lndspdr003", 0) == OBJECT_INVALID) && GetGlobalNumber("302NAR_Airspeeder_41")) && GetGlobalNumber("302NAR_Airspeeder_42")) && GetGlobalNumber("302NAR_Airspeeder_43")) && (GetGlobalNumber("302NAR_Airspeeder_44") == 2))) { CreateObject(64, "lndspdr003", GetLocation(GetObjectByTag("wp_airtaxi", 0)), 0); } SetGlobalNumber("303NAR_Entered", 1); if (((GetJournalEntry("InterGRU") == 30) && (GetObjectByTag("aaida", 0) == OBJECT_INVALID))) { CreateObject(1, "n_commf001", GetLocation(GetObjectByTag("WP_aaida_spawn", 0)), 0); } if (GetGlobalBoolean("303NAR_SWITCH_TO_PC")) { AurPostString("MiraAPTConv", 15, 15, 5.0); ExecuteScript("a_miraapatconv", OBJECT_SELF, 0xFFFFFFFF); } } //KAPOW! Here's where our code comes in! if (!GetIsObjectValid(GetObjectByTag("example_tag"))) CreateObject(OBJECT_TYPE_CREATURE, "example", Location(Vector(-29.02,11.86,8.64), 180.0)); } Change "example_tag" to the tag of the npc, and "example" to the Template of your NPC. Compile the script and chuck that and your NPC file into the Override folder. You cannot have already been to the area, otherwise the NPC won't spawn. Here's where my NPC ended up: Edit: LOL! I forgot to tell you another thing. The compiled script needs to be called k_303nar_enter. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.