Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Quick Question(s)

Page: 1 of 1
 goldberry
04-27-2008, 8:42 PM
#1
Hey everyone; it's been a while since I've been around (much less posted something significant), so I wanted to get back on the modding scene shortly after the Team Gizka release (obviously so that anything I make is fully compatible). I have a (semi) secret project in the works that I've been tinkering with for a while, but I've hit a snag with the old scripting, something I've never been that great with.

So here it is; basically I'm having a computer dialogue option warp the party to a new module, but as a result of what the module is, it can be coming from three different modules. My question is how I would set it so that the dialogue on the other end will point back to the corresponding module that the player came from (setting a flag or something?). On the other hand, maybe I should only enable the travel option on one of the three modules (it's pretty obvious what place I'm talking about), in which case would I be better of sticking to 003EBO and just not modify the others at all?

Also can I make a script delay? I.e. I want the player to select the travel option, walk to a certain place, and then upon reaching that place, travel. Essentially the walk sequence could either be within a dialogue (and thus inescapable), or the remote control style walking that the user could break away from if they changed their minds. I suppose if I can't do this I could stick a door in some inappropriate place on the 'Hawk or something...

As always any help is appreciated. Oh, and for those of you that have asked (it's quite sweet to know that one or two people missed me :P), my Grey Jedi mod was deleted when I formatted my pc about a year ago, but I'm starting it from scratch after the Team Gizka release, and the Hollowan Academy thing was scrapped completely but someone has convinced me to take it back up again ^_^
 HdVaderII
04-27-2008, 9:37 PM
#2
Welcome back!
I suppose if I can't do this I could stick a door in some inappropriate place on the 'Hawk or something..
Hmm...I don't know how well that would fit in...:)
 Robespierre
04-28-2008, 4:07 AM
#3
My question is how I would set it so that the dialogue on the other end will point back to the corresponding module that the player came from (setting a flag or something?)

You need to use global variables. The basic principle being that when you use the computer panel from a certain module the variable will be set as TRUE. Then your computer panel on the other end will run through the variables, find which one is TRUE (and hence which module you came from) and then warp you do that specific module.

That's the basics of it. And checking the global variable is easy, use this code:

void main() {
if (GetGlobalBoolean("Module1") {
*Insert code here*);
}
if (GetGlobalBoolean("Module2") {
*Insert code here*);
}
if (GetGlobalBoolean("Module3") {
*Insert code here*);
}
}

I'm not expert but that might work.

Setting it is another matter entirely. The easiest way to do this, IMO, is this:

Have an individual computer panel and .dlg file for each of the different computer terminals. That way you simply attach this script:

void main() {
SetGlobalBoolean("Module'x'", 1);
}

my Grey Jedi mod

As in a mod that allowed you to be a Grey Jedi? I would have so loved to do that.

To the dialog entry where you decide to warp to another module. I believe KotOR 2 has a way of setting booleans without scripting, but I have no idea how that works.
 stoffe
04-28-2008, 5:20 AM
#4
My question is how I would set it so that the dialogue on the other end will point back to the corresponding module that the player came from (setting a flag or something?).

You can add a global string variable and store the module name in it before warping. Then you can check that variable in your other module to get what module you last warped from.

void main() {
SetGlobalString("LASTMODULE", GetModuleFileName());
StartNewModule("SomeOtherModule");
}

...and...

void main() {
if (GetGlobalString("LASTMODULE") == "003EBO") {
SpeakString("I came from the Ebon Hawk!");
}
}



Also can I make a script delay? I.e. I want the player to select the travel option, walk to a certain place, and then upon reaching that place, travel.

You should be able to use the action queue of the character for that. Something like:

void ST_MoveAndWarp(string sWPtag, string sModule) {
ClearAllActions();
ActionMoveToObject( GetObjectByTag(sWPtag) );
ActionDoCommand( StartNewModule(sModule) );
}

void main() {
object oPC = GetFirstPC();
AssignCommand(oPC, ST_MoveAndWarp("SW_EXIT", "003EBO"));
}
 Robespierre
04-28-2008, 5:25 AM
#5
^^^ That's a much better way of doing it. Pay no attention to my way.
 goldberry
04-30-2008, 4:52 AM
#6
Haha thanks for the attempt, loony.

Ah Stoffe, gotta love that you're still around and helping out. Thanks alot for that, I'm going to give that a go later on and see how it turns out. Will post once I have the results, but it all looks like it should work.
Page: 1 of 1