PDA

View Full Version : Weird script happenings...


harIII
12-01-2009, 10:53 AM
When you spawn in this module there are a few things happening:

The first if is just seeing if the PC has been to this module before and if not, it plays a movie - works perfectly and there isn't an else statement to follow.

The second if opens a door as long as the quest tantive is greater than 1 - which also works fine.

My problem comes in here. In the else statement, it equips the pc with armor and a lightsaber and sometimes works fine. It's pretty weird, it might start the game off with not equipping the PC, the PC might be invisible, or it might work perfectly. If it does it once, shouldn't it do it every time? Any ideas anyone.

Here is the script I'm using:

void main() {

if (GetLoadFromSaveGame()) {
return;
}
object oEntering = GetEnteringObject();
if ((!GetIsPC(oEntering))) {
return;
}
if ((!GetLocalBoolean(OBJECT_SELF, 40))) {
SetLocalBoolean(OBJECT_SELF, 40, 1);
PlayMovie("intro");
}


if ( GetJournalEntry ( "tantive" ) >= 1 ) {
object oDoor=GetObjectByTag("to_exe");
ActionDoCommand(SetCommandable(TRUE,oDoor));
AssignCommand(oDoor, ActionOpenDoor(oDoor));
}
else {

object oPC=GetFirstPC();

object oHelmet = CreateItemOnObject("storm_helmet",oPC);
object oArmour = CreateItemOnObject("storm_armour",oPC);
object oSaber = CreateItemOnObject("g_w_lghtsbr02",oPC);

AssignCommand (oPC, ActionEquipItem(oHelmet, INVENTORY_SLOT_HEAD));
AssignCommand (oPC, ActionEquipItem(oArmour, INVENTORY_SLOT_BODY));
AssignCommand (oPC, ActionEquipItem(oSaber, INVENTORY_SLOT_RIGHTWEAPON));

ExecuteScript("start_zorin", OBJECT_SELF);
}
}