Jump to content

Home

[K1] More Scripting Help


JediMaster76

Recommended Posts

>_> Yup.... well, I have two scripting questions pertaining to K1 (as if you didn't figure that out from the title :p)

 

First, I have a script that fires if you talk to T3 after the Ebon Hawk that changes your PC to another NPC and warps them to a new module. At a certain point in said module, I want to be able to block off a path (ala the Eastern Dune Sea in K1) until the main PC returns to the planet later and explores the entire module. How would I go about doing this?

 

Also, after a while of exploring the custom area I created, the NPC that is your PC runs into some trouble, gets Force "Drained", and goes unconscious. At that point, I have trouble with the following script.

 

void SwitchPC(int iSlot) {
   SwitchPlayerCharacter(iSlot);
}

void main() {
       AddAvailableNPCByTemplate(7, "t3m4");
       SetGlobalFadeOut(0.0, 2.0);
       SwitchPlayerCharacter(NPC_PLAYER);
       SetGlobalFadeIn(2.0, 2.0);
       StartNewModule("ebo_m12aa");


}

 

What it's supposed to do, in theory, is re-add T3 to the party (he was removed so the custom NPC could become the party leader), fade out, switch the main PC back to the party leader, then warp back to the Ebon Hawk. However, I believe it "skips" the first couple steps, b/c I warp back to the Ebon Hawk, but my custom PC is still the party leader, and T3 isn't there! :headbump Any help would be appreciated. :)

Link to comment
Share on other sites

The script you want fixing you might want to try this one which will post messages to your feedback log if steps are working correctly. When the script is executed check your log for the lines starting with "DEBUG:".

void main() {
if( AddAvailableNPCByTemplate(7, "t3m4") ) {
	SendMessageToPC(GetFirstPC(), "DEBUG: T3M4 Added in slot 7");
	if( SwitchPlayerCharacter(NPC_PLAYER) ) {
		SendMessageToPC(GetFirstPC(), "DEBUG: Player character switched");
		SetGlobalFadeOut(0.0, 2.0);
		DelayCommand(3.0, StartNewModule("ebo_m12aa"));
	}
}
}

Link to comment
Share on other sites

What it's supposed to do, in theory, is re-add T3 to the party (he was removed so the custom NPC could become the party leader), fade out, switch the main PC back to the party leader, then warp back to the Ebon Hawk. However, I believe it "skips" the first couple steps, b/c I warp back to the Ebon Hawk, but my custom PC is still the party leader, and T3 isn't there! :headbump Any help would be appreciated. :)

 

Try this variant and see if it makes any difference. But do keep in mind that if you re-add T3M4 from its template it will be reverted back to its default state and any gamestate variables, levelups and items the player may have equipped it with earlier will be lost.

 

void SwitchCharacters() {
   SwitchPlayerCharacter(NPC_PLAYER);
   RemoveAvailableNPC(NPC_T3_M4);
   AddAvailableNPCByTemplate(NPC_T3_M4, "p_t3m4");
}

void main() {
   SetGlobalFadeOut(0.0, 2.0);
   DelayCommand(2.0, SwitchCharacters());
   SetGlobalFadeIn(2.0, 2.0);
   DelayCommand(4.0, StartNewModule("ebo_m12aa"));
}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...