Running scripts when equipping item

Post » Fri May 04, 2012 3:00 pm

hi
ran into a problem with scripts and was wondering if anyone could help

the situation is i hav a armor item which runs a script when equipped, it shows a message with options etc
it works if i use hotkey's or inventory to equip it

in another script i present myself with items i want to equip
the item is equipped with the command player.equipItem a 0 1
i was expecting the message to popup as when equipping said item the onequip block of my script should run
anyone have ideas on why this is happening or is it a limitation in the game

to summarise
item a has a script to display a message box with options when equipped
item a is equipped normally via hotkey or pipboy - menu shows
item a is equipped via a script - menu no show
User avatar
Emma Pennington
 
Posts: 3346
Joined: Tue Oct 17, 2006 8:41 am

Post » Fri May 04, 2012 1:21 am

I'm trying to understand here, but your wording is a little akward, and I don't think I understand your problem here. Why don't you post the scripts themselves (use the code tags) and reword your post so its easier to understand? What does "present myself with items" mean?
User avatar
Nienna garcia
 
Posts: 3407
Joined: Wed Apr 25, 2007 3:23 am

Post » Fri May 04, 2012 9:27 am

yea my english is really bad sorry
a menu is displayed using a message box within the menu has options like hat, mask, armor
if i click on hat it will equip my hat item which has a script attatched
however the script does not run if i equip it using the menu but runs it i equip through normal means eg pipboy or hotkey

script below is used to equip a item using menu

scn StaticEMScriptshort Equippedshort menushort buttonBegin onEquip playershowMessage StaticEMMessageEquipset Equipped to 1EndBegin onUnEquip playershowMessage StaticEMMessageUnequipset Equipped to 0EndBegin onDrop playershowMessage StaticEMMessageUnequipset Equipped to 0EndBegin GameModeIf IsKeyPressed 76 && Equipped == 1  set menu to 1  showMessage  StaticEMMessageMainMenuendIfif menu == 1Set button to getButtonPressed  If Button == 0  ElseIf Button == 1   if player.getItemCount StaticBackpack == 1	 player.equipItem StaticBackpack 0 1   endIf  ElseIf Button == 2   if player.getItemCount StaticShieldRemote == 1    player.equipItem StaticShieldRemote 0 1   endIf  ElseIf Button == 3   if player.getItemCount StaticDroneComLink == 1    player.equipItem StaticDroneComLink 0 1   endIf  ElseIf Button == 4   if player.getItemCount StaticBatteryCharger == 1    activate    player.equipItem StaticBatteryCharger 0 1   endIf   EndIfendIfEnd

in menu i choose button 3 which will equip the drone com link

scn StaticDroneComScriptShort ButtonShort ActiveShort WeaponsRef DroneComBegin onEquip playerset Active to 1showMessage StaticDroneComActiveEndBegin onUnEquip playerset Active to 0showMessage StaticDroneComDeactiveEndBegin GameMode if Active == 1  If IsKeyPressed 71   showMessage StaticDroneComMessage  endIfendifEndBegin GameModeSet Button to GetButtonPressedIf Button == 0elseif Button == 1  if StaticDroneDialogue.TDC1Activated && StaticDroneDialogue.TDC1Leave==0   StaticDroneCompanionCRef.MoveTo Player  endif  if StaticDroneDialogue.TDC2Activated && StaticDroneDialogue.TDC2Leave==0   StaticDroneCompanionC2Ref.MoveTo Player  endif  if StaticDroneShieldOnRef.getdisabled   if StaticDroneDialogue.TDSActivated && StaticDroneDialogue.TDSLeave==0    StaticDroneShieldOffRef.MoveTo Player   endif  else   if StaticDroneDialogue.TDSActivated && StaticDroneDialogue.TDSLeave==0    StaticDroneShieldOnRef.MoveTo Player   endif  endif  if StaticDroneDialogue.TDRActivated && StaticDroneDialogue.TDRLeave==0   StaticDroneRailRef.MoveTo Player  endif  if StaticDroneDialogue.TDCLActivated && StaticDroneDialogue.TDCLLeave==0   StaticDroneCLinkRef.MoveTo Player  endifelseif Button == 2   StaticDroneCompanionCRef.MoveTo Player  StaticDroneCompanionC2Ref.MoveTo Player  StaticDroneShieldOffRef.MoveTo Player  StaticDroneShieldOnRef.MoveTo Player  StaticDroneRailRef.MoveTo Player  StaticDroneCLinkRef.MoveTo Playerelseif Button == 3  StaticDroneCLinkRef.MoveTo Playerelseif Button == 4  if StaticDroneDialogue.shieldOn == 1   set StaticDroneDialogue.shieldOn to 0   showmessage StaticDroneComShieldsOff  else   set StaticDroneDialogue.shieldOn to 1   showmessage StaticDroneComShieldsOn  endifelseif Button == 5   if StaticDroneDialogue.stealthOn == 1   set StaticDroneDialogue.stealthOn to 0   showmessage StaticDroneComStealthOff  else   set StaticDroneDialogue.stealthOn to 1   showmessage StaticDroneComStealthOn  endifelseif Button == 6  StaticDroneCLinkRef.ResetHealth  StaticDroneRailRef.ResetHealth  StaticDroneCompanionCRef.ResetHealth  StaticDroneCompanionC2Ref.ResetHealth  StaticDroneShieldOnRef.ResetHealth  StaticDroneShieldOffRef.ResetHealth  showMessage StaticDroneSelfRepairelseif Button == 7  if StaticDroneDialogue.TDC1Follow == 1 && StaticDroneDialogue.TDC1Leave == 1   set StaticDroneDialogue.TDC1Follow to 1   set StaticDroneDialogue.TDC1Leave to 0  endIf  if StaticDroneDialogue.TDC2Follow == 1 && StaticDroneDialogue.TDC2Leave == 1   set StaticDroneDialogue.TDC2Follow to 1   set StaticDroneDialogue.TDC2Leave to 0  endIf  if StaticDroneDialogue.TDSFollow == 1 && StaticDroneDialogue.TDSLeave == 1   set StaticDroneDialogue.TDSFollow to 1   set StaticDroneDialogue.TDSLeave to 0  endIf  if StaticDroneDialogue.TDRFollow == 1 && StaticDroneDialogue.TDRLeave == 1   set StaticDroneDialogue.TDRFollow to 1   set StaticDroneDialogue.TDRLeave to 0  endIf  if StaticDroneDialogue.TDCLFollow == 1 && StaticDroneDialogue.TDCLLeave == 1   set StaticDroneDialogue.TDCLFollow to 1   set StaticDroneDialogue.TDCLLeave to 0  endIf  showMessage StaticDroneActiveFollowelseif Button == 8  set StaticDroneDialogue.TDC1Leave to 1  set StaticDroneDialogue.TDC2Leave to 1  set StaticDroneDialogue.TDRLeave to 1  set StaticDroneDialogue.TDSLeave to 1  set StaticDroneDialogue.TDCLLeave to 1   StaticDroneRailRef.evp  StaticDroneCompanionCRef.evp  StaticDroneCompanionC2Ref.evp  StaticDroneShieldOffRef.evp  StaticDroneShieldOnRef.evp  showMessage StaticDroneWaitelseif Button == 9  set StaticDroneDialogue.TDC1Follow to 0  set StaticDroneDialogue.TDC1Leave to 1  set StaticDroneDialogue.TDC2Follow to 0  set StaticDroneDialogue.TDC2Leave to 1  set StaticDroneDialogue.TDSFollow to 0  set StaticDroneDialogue.TDSLeave to 1  set StaticDroneDialogue.TDRFollow to 0  set StaticDroneDialogue.TDRLeave to 1   StaticDroneRailRef.evp  StaticDroneCompanionCRef.evp  StaticDroneCompanionC2Ref.evp  StaticDroneShieldOffRef.evp  StaticDroneShieldOnRef.evp  showMessage StaticDroneRtbendifEnd
User avatar
Sophh
 
Posts: 3381
Joined: Tue Aug 08, 2006 11:58 pm

Post » Fri May 04, 2012 2:25 am

The wiki is your friend, always check it as they address that very issue. Basically onequip won't run when an item is equipped from a script command. FOSE should have one that does.

http://cs.elderscrolls.com/index.php/OnEquip
User avatar
Nikki Hype
 
Posts: 3429
Joined: Mon Jan 01, 2007 12:38 pm

Post » Fri May 04, 2012 8:52 am

so theres no way i can get it to work?
too bad there's no equipitem2 in fo3 as said in the tes wiki you linked

i tried with a indigestible item and it worked, however i am unable to recreate this with my other items hmm...
User avatar
Gill Mackin
 
Posts: 3384
Joined: Sat Dec 16, 2006 9:58 pm

Post » Fri May 04, 2012 1:22 pm

I figured they brought that over to FOSE but don't see it in the documentation so maybe not. You could try asking about it in the FOSE thread in the mods forum, maybe someone knows a simple way.

If you are calling equipitem from another script anyway just do showmessage from that script right after.
User avatar
Alisha Clarke
 
Posts: 3461
Joined: Tue Jan 16, 2007 2:53 am

Post » Fri May 04, 2012 6:18 am

yea tried that it doesnt work the buttons will be messed up if i do
but anyways i found changing the items to aid items which calls the script with a effect works so im going with that :smile:
User avatar
Matthew Warren
 
Posts: 3463
Joined: Fri Oct 19, 2007 11:37 pm


Return to Fallout 3