Message Box issues (or package issues)

Post » Sat Feb 27, 2010 11:40 pm

I have this script that will be put on an npc to give the commands that are listed.

scn aaFollowerScriptref targetref containershort buttonshort pressedshort activatedshort inventoryopenbegin OnHit playermoddisposition player 100stopcombat playerendbegin OnActivateif getdead == 1activateendifif IsActionRef player == 1MessageBox "What do you want?" "Follow Me." "Wait Here." "Patrol This Area." "Scout This Area." "Dismiss." "Access Inventory."set activated to 1endifendbegin gamemodeif inventoryopen == 1 && menumode == 0set inventoryopen to 0   container.removeallitems target   container.disable   target.additem aaEquip 1   target.equipitem aaEquip   target.removeitem aaEquip 1endifif activated == 1 set target to getself set button to getbuttonpressed   if button == 0	  addscriptpackage zzFollow	  removescriptpackage zzWait	  removescriptpackage zzPatrol	  removescriptpackage zzScout	  set activated to 0   elseif button == 1	  removescriptpackage zzFollow	  addscriptpackage zzWait	  removescriptpackage zzPatrol	  removescriptpackage zzScout	  set activated to 0   elseif button == 2	  removescriptpackage zzFollow	  removescriptpackage zzWait	  addscriptpackage zzPatrol	  removescriptpackage zzScout	  set activated to 0   elseif button == 3	  removescriptpackage zzFollow	  removescriptpackage zzWait	  removescriptpackage zzPatrol	  addscriptpackage zzScout	  set activated to 0   elseif button == 4	  target.kill	  set activated to 0   elseif button == 5	  set container to target.placeatme aaContainer 1 0 0	  container.setownership	  target.removeallitems container	  container.activate player 	  set inventoryopen to 1	  set activated to 0   endifendifend


For some reason, the follow and patrol commands don't work, but the scout and wait do. Is there any reason why this might be happening?
User avatar
Sarah Knight
 
Posts: 3416
Joined: Mon Jun 19, 2006 5:02 am

Post » Sun Feb 28, 2010 10:20 am

Just at a glance you need to clean this up a bit. An actor can only have 1 scriptpackage at any given time. If you use addscriptpackage there is no need to remove one as adding one removes the one that proceeded it. Calling remove like you are after adding is probably causing the script to stop processing as you are trying to remove something that isn't there.
User avatar
Joe Bonney
 
Posts: 3466
Joined: Tue Jul 17, 2007 12:00 pm

Post » Sun Feb 28, 2010 8:50 am

Just at a glance you need to clean this up a bit. An actor can only have 1 scriptpackage at any given time. If you use addscriptpackage there is no need to remove one as adding one removes the one that proceeded it. Calling remove like you are after adding is probably causing the script to stop processing as you are trying to remove something that isn't there.


Ah, I see. I thought if you kept adding then the packages would add up.
User avatar
JaNnatul Naimah
 
Posts: 3455
Joined: Fri Jun 23, 2006 8:33 am

Post » Sun Feb 28, 2010 9:16 am

Removing the "RemoveScriptPackage" commands has sorted the problem out. Thanks! :)
User avatar
The Time Car
 
Posts: 3435
Joined: Sat Oct 27, 2007 7:13 pm


Return to IV - Oblivion