Jump to content

Home

Script: Transition From Game to Custom Mod (TSL)


gsusfrk

Recommended Posts

Hey everyone,

 

I've just finished my attempt at a script which will load my custom module, which is the start of my mod (for now). Here is my script:

 

void main()
{
   SetGlobalFadeOut(0.0, 5.0);
   SendMessageToPC(GetFirstPC(), "Faded out");
   object oClothesItem = CreateItemOnObject("a_robe_01", GetFirstPC());
   SendMessageToPC(GetFirstPC(), "Created item in inventory");
   AssignCommand(GetFirstPC(), ActionEquipItem(oClothesItem, INVENTORY_SLOT_BODY));
   SendMessageToPC(GetFirstPC(), "Equipped Item");
   object oInventItem = GetFirstItemInInventory(GetFirstPC());
   while(oInventItem != OBJECT_INVALID)
   {
       AssignCommand(GetFirstPC(), ActionTakeItem(oInventItem, GetFirstPC()));
       SendMessageToPC(GetFirstPC(), "Removed Item from inventory");
       oInventItem = GetNextItemInInventory(GetFirstPC());
   }
   DeleteJournalWorldAllEntries();
   SendMessageToPC(GetFirstPC(), "Nuked the journal");
   DelayCommand(1.0, SetGlobalFadeIn(0.0, 0.0));
   SendMessageToPC(GetFirstPC(), "Faded in");
   StartNewModule("JonathanFightModule");
} 

 

What this does is fade the camera to black, give the "Clothes" item to the PC (I don't want him/her starting in my mod in their underwear!), force an equip of the item (so the player doesn't have to), and systematically remove everything from the player's inventory (stuff gathered from the prologue). All journal entries are deleted, the module is started, and the camera fades in from black. How'd I do? Possibly the only probable error I can find is perhaps i should move the while loop that removes everything from the inventory up before the clothes item is given and equipped. However, if, when an item is equipped, it is no longer counted as "in the inventory", this code should run fine.

 

My questions: Will this work? Is there a way to delete all messages, dialogue, feedback, etc. from the journal, or will the DeleteJournalWorldAllEntries command take care of that? Any improvements I can make to this script? Thanks for all input!

Link to comment
Share on other sites

Update: I seem to be having trouble with the "remove items from inventory" part of the script. Everything else works fine, except the items are not being removed from the inventory, and the journal is not being cleared. Could someone tell me what I'm doing wrong and possibly how to fix it? Thanks!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...