PDA

View Full Version : [K1] More Scripting Help


JediMaster76
06-27-2008, 09:08 PM
>_> 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. :)

glovemaster
06-28-2008, 04:51 AM
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"));
}
}
}

JediMaster76
06-28-2008, 04:04 PM
Well, it compiled successfully, but there was no feedback log, and after the dialog ended, the script didn't "fire", and nothing happened. :\

glovemaster
06-29-2008, 05:27 AM
That means that AddAvailableNPCByTemplate(7, "t3m4") failed, or the script didn't fire at all. Is the UTC "t3m4" in the modules .MOD file, or the override?

stoffe
06-29-2008, 06:42 AM
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"));
}