PDA

View Full Version : Need help with scripting *again*


JediKnight707
10-29-2005, 11:42 PM
I had the great person kdsphantom compile a script for me and I stuck it in my override (I also took out all mods that I had as well) along with the custom items that I was trying to put in. Is there something wrong with the script? Here it is:
void main() {
object oDoor = GetObjectByTag("MorgueDoor");
SetLocked(oDoor, FALSE);
DelayCommand(1.0, AssignCommand(oDoor, ActionOpenDoor(oDoor)));

object oCorpse = GetItemPossessor(GetObjectByTag("plasmatorch"));
if (GetIsObjectValid(oCorpse)) {
CreateItemOnObject("anakin_saber", oCorpse);
CreateItemOnObject("jinn_saber", oCorpse);
CreateItemOnObject("luke_saber", oCorpse);
CreateItemOnObject("maul_saber", oCorpse);
CreateItemOnObject("obiwan_saber", oCorpse);
CreateItemOnObject("palpatine_saber", oCorpse);
CreateItemOnObject("windu_saber", oCorpse);
CreateItemOnObject("yoda_saber", oCorpse);
CreateItemOnObject("vader_saber", oCorpse);
CreateItemOnObject("koon_saber", oCorpse);
CreateItemOnObject("dooku_saber", oCorpse);
}
}

kdsphantom
10-30-2005, 12:09 AM
Hiya
It compiles fine, but hopefully you set up that compilier of your own :)
but it doesnt fire is that what you mean ? and those items arent on the corpse ?
kdsphantom

Det. Bart Lasiter
10-30-2005, 01:04 AM
Perhaps it's the 'int nStackSize' parameter in 'CreateItemOnObject()'. Try using this format for it:

CreateItemOnObject("/*item*/", oCorpse, 1);

JediKnight707
10-30-2005, 01:39 AM
Yeah, it won't fire, there are no items (except the plasma tourch) on the dead dude.

Darth333
10-30-2005, 01:51 AM
It's not necessary to determine the stack size in this script unless you want to put a value greater than 1.

Are you sure you script is even fired? Make sure the script's name is a_doormor.ncs. Also, the script will only fire once when you select the following dialogue option on the computer to unlock the morgue door: MORGUE UNLOCKED
MEDICAL BAY FUNCTIONS
EMERGENCY LOCKDOWN
ENTER COMMAND

It is only at this moment that the items will be created on the corpse. Use a save game from before unlocking the door.

JediKnight707
10-31-2005, 01:30 AM
I put in the script like you said Darth, but now the door won't open, it remains locked :( any suggestions?

kdsphantom
10-31-2005, 01:53 AM
hiya Jedi
member to bring up a saved game from before you did anything with the door. And you mean the door is locked when you click it, But you went to the computer and went through those 4 conditions to open it right? and then over to the door, and its been a while since i was at the begining of TSL but does the computer open the door for you or do you still click the door? I think I membered right. the computer unlocks and you still click it right, and this is where your saying the door is still locked correct?
Kdsphantom

JediKnight707
10-31-2005, 09:34 PM
Its supposed to open for you, but it won't :( And I'm loading it from an auto-save, so does that count?

Det. Bart Lasiter
10-31-2005, 11:57 PM
Try this thread. (http://lucasforums.com/showthread.php?t=137370) It should work after that, that way you fire the original, and yours from the same trigger.

JediKnight707
11-01-2005, 01:30 AM
void main() {
object oDoor = GetObjectByTag("MorgueDoor");
SetLocked(oDoor, FALSE);
DelayCommand(1.0, AssignCommand(oDoor, ActionOpenDoor(oDoor)));

object oCorpse = GetItemPossessor(GetObjectByTag("plasmatorch"));
if (GetIsObjectValid(oCorpse)) {
CreateItemOnObject("anakin_saber", oCorpse);
CreateItemOnObject("jinn_saber", oCorpse);
CreateItemOnObject("luke_saber", oCorpse);
CreateItemOnObject("maul_saber", oCorpse);
CreateItemOnObject("obiwan_saber", oCorpse);
CreateItemOnObject("palpatine_saber", oCorpse);
CreateItemOnObject("windu_saber", oCorpse);
CreateItemOnObject("yoda_saber", oCorpse);
CreateItemOnObject("vader_saber", oCorpse);
CreateItemOnObject("koon_saber", oCorpse);
CreateItemOnObject("dooku_saber", oCorpse);

ExecuteScript("i forgot what script it was :)", OBJECT_SELF);
}

Like that jmac?

oldflash
11-01-2005, 03:20 AM
Make your own locker and put all items in inventory then use this

a_doormor.nss


void main() {
object oDoor = GetObjectByTag("MorgueDoor");
SetLocked(oDoor, FALSE);
DelayCommand(1.0, AssignCommand(oDoor, ActionOpenDoor(oDoor)));
//test
CreateObject(OBJECT_TYPE_PLACEABLE, "mylocker", Location(Vector(-19.48675, 11.91394, 9.11489), 55.0));
}

Det. Bart Lasiter
11-01-2005, 09:39 PM
@Jedi_Knight_707
Yes, minus the script name :p

***Edit***
Don't forget to re-name the original script, and name your new script whatever the name of the original one was, and execute the old one in your script. Then just compile both, and put them in your 'Override' folder :)

Basically:
Your script is named 'a_doormor' and executes the original that you re-named, perhaps 'a_doormor2'.

JediKnight707
11-02-2005, 10:26 PM
Does anybody know which script it is?

Det. Bart Lasiter
11-04-2005, 07:31 PM
I think that, as Darth333 said, it's 'a_doormor'. Therefore your script should be this:

void main() {
object oDoor = GetObjectByTag("MorgueDoor");
SetLocked(oDoor, FALSE);
DelayCommand(1.0, AssignCommand(oDoor, ActionOpenDoor(oDoor)));

object oCorpse = GetItemPossessor(GetObjectByTag("plasmatorch"));
if (GetIsObjectValid(oCorpse)) {
CreateItemOnObject("anakin_saber", oCorpse);
CreateItemOnObject("jinn_saber", oCorpse);
CreateItemOnObject("luke_saber", oCorpse);
CreateItemOnObject("maul_saber", oCorpse);
CreateItemOnObject("obiwan_saber", oCorpse);
CreateItemOnObject("palpatine_saber", oCorpse);
CreateItemOnObject("windu_saber", oCorpse);
CreateItemOnObject("yoda_saber", oCorpse);
CreateItemOnObject("vader_saber", oCorpse);
CreateItemOnObject("koon_saber", oCorpse);
CreateItemOnObject("dooku_saber", oCorpse);

ExecuteScript("a_doormor_old", OBJECT_SELF);
}

... and named 'a_doormor', with the old script (the one oldflash posted) named 'a_doormor_old'.

JediKnight707
11-04-2005, 11:09 PM
Awesome, I'll see if that works thanks jmac :)

Darth333
11-05-2005, 09:19 AM
Err...the script already contains all the a_doormor.ncs contents so there is no real point in re-executing the script at the end. The original contents of a_doormor.ncs are:
void main() {
object oDoor = GetObjectByTag("MorgueDoor");
SetLocked(oDoor, FALSE);
DelayCommand(1.0, AssignCommand(oDoor, ActionOpenDoor(oDoor)));


edit: I just tried the following script (had to change the items because I don't have yours) and it worked perfectly:

void main() {
object oDoor = GetObjectByTag("MorgueDoor");
SetLocked(oDoor, FALSE);
DelayCommand(1.0, AssignCommand(oDoor, ActionOpenDoor(oDoor)));

object oCorpse = GetItemPossessor(GetObjectByTag("plasmatorch"));
if (GetIsObjectValid(oCorpse)) {
CreateItemOnObject("a_helmet_01", oCorpse);
CreateItemOnObject("a_helmet_02", oCorpse);
CreateItemOnObject("a_helmet_03", oCorpse);
CreateItemOnObject("a_robe_08", oCorpse);
CreateItemOnObject("a_robe_09", oCorpse);

}
}
So you must be doing something wrong because it's not the script. Double check the resref of your items and make sure you can acquire them with cheats. If you can't get your items with cheats in the game, then the problem is likely there. Make sure that each time you want to test the script you start a game from before opening the morgue door.

Det. Bart Lasiter
11-05-2005, 10:10 PM
:headbump

JediKnight707
11-06-2005, 11:54 PM
Err...the script already contains all the a_doormor.ncs contents so there is no real point in re-executing the script at the end. The original contents of a_doormor.ncs are:
void main() {
object oDoor = GetObjectByTag("MorgueDoor");
SetLocked(oDoor, FALSE);
DelayCommand(1.0, AssignCommand(oDoor, ActionOpenDoor(oDoor)));


edit: I just tried the following script (had to change the items because I don't have yours) and it worked perfectly:

void main() {
object oDoor = GetObjectByTag("MorgueDoor");
SetLocked(oDoor, FALSE);
DelayCommand(1.0, AssignCommand(oDoor, ActionOpenDoor(oDoor)));

object oCorpse = GetItemPossessor(GetObjectByTag("plasmatorch"));
if (GetIsObjectValid(oCorpse)) {
CreateItemOnObject("a_helmet_01", oCorpse);
CreateItemOnObject("a_helmet_02", oCorpse);
CreateItemOnObject("a_helmet_03", oCorpse);
CreateItemOnObject("a_robe_08", oCorpse);
CreateItemOnObject("a_robe_09", oCorpse);

}
}
So you must be doing something wrong because it's not the script. Double check the resref of your items and make sure you can acquire them with cheats. If you can't get your items with cheats in the game, then the problem is likely there. Make sure that each time you want to test the script you start a game from before opening the morgue door.

Well, crap. I don't know what I'm doing wrong :(