Author Topic: Script on module start?  (Read 312 times)

Legacy_TheButterflyEffect

  • Newbie
  • *
  • Posts: 47
  • Karma: +0/-0
Script on module start?
« on: April 09, 2012, 08:09:56 am »


               God I freaking hate scripts. FF

I'm trying to put together a script with multiple parts. This script is attatched to an event trigger that surrounds the start point, so it initiates as soon as the module starts. For the purposes of my module, first I want it to strip all of the vanilla crap out of the PC's inventory and simply destroy it. Then I want it to add a certain piece of default equipment that I made myself to the PC's inventory. Then I want it to auto-equip that item to the PC's chest slot. Then I want it to start the opening dialogue that gets the module's storyline started.

However, I just can't seem to get these parts to work together, and for the life of me I don't know why they won't work. For example, if I try to put all of the above functions into the script in the order mentions, it will successfully strip all of the default equipment and place mine into the PC's inventory, but it won't auto-equip my armor and won't start the dialogue.

If I leave the stripping piece out of the script, the auto-equip piece works, but the dialogue still doesn't start.

If I put the piece to start the dialogue in the script by itself however, it does work.

What am I doing wrong here?
               
               

               
            

Legacy_ehye_khandee

  • Hero Member
  • *****
  • Posts: 1415
  • Karma: +0/-0
Script on module start?
« Reply #1 on: April 09, 2012, 12:24:16 pm »


               For starters, you are not posting the script. Without looking at the script, none of us can point at the line and say 'There it is, do this instead.'

Meanwhile, here is a script that should do what you want IF you fill in the blanks (including the resref of the object you want made in the PCs inventory and also the name of the convo you want launched)... and of course, put the script into your modules' on enter or a trigger around the location PC start point.

(Special thanks to lightfoot - i missed a parameter in the original post, this is corrected below)


void main()
{
object oPC = GetEnteringObject();
object oItem =  GetFirstItemInInventory(oPC);
while(GetIsObjectValid(oItem))
{
  DestroyObject(oItem);
  oItem =  GetNextObjectInInventory(oPC);
}
oItem = CreateItemOnObject("RESREF_OF_ITEM_TO_GIVE_PC",oPC);
AssignCommand(oItem,ActionStartConverstation(oPC,"RESREF_OF_CONVO"));
}

Best wishes on your project.

Be well. Game on!
GM_ODA
               
               

               


                     Modifié par ehye_khandee, 09 avril 2012 - 02:11 .