Jump to content

Help with Scripting


gaubanss

Recommended Posts

OK so new to scripting but I'm trying to make a custom weapon wall display for myself that works like the Underwater Hideout's custom weapon wall in the bedroom. And to say like it Im pretty much basing my script off that one heavily. Heres what I have so far.

 

ScriptName 00DisplayWeaponScript

INT DoOnce

REF ContainerREF
REF FormListName
REF WeaponREF
REF WeaponType

begin onactivate player

Set ContainerREF to GetLinkedREF
Set WeaponREF to ContainerREF.GetLinkedREF


If GetISID 00USPACT00
Set WeaponType to WeapMHKUSPDUPLICATE000
Set FormListName to 00HKUSP10

else
showmessage 00Fail
Return
endif

;========IF the Weapon is in the Container
if ContainerREF.GetItemCount WeaponType >= 1
;Disable Static
WeaponREF.Disable
ContainerREF.RemoveAllItems Player 1
Return

;========If the weapon is in the player inventory and staic is disabled
elseIf Player.GetItemCount WeaponType >= 1 && WeaponREF.GetDisabled

;Adds it to Container
player.RemoveAllTypedItems CustWeapContRef 1 0 40 00AllWeap00
player.RemoveAllTypedItems ContainerREF 1 0 40 FormListName
CustWeapContRef.RemoveAllItems Player 1 1

;EnableStatic
WeaponREF.Enable
Return

;========If the weapon is not in the player inventory and staic is disabled/enabled
else

;Adds one weapon to its container to start
If DoOnce == 0
Player.Additem WeaponType 1
WeaponREF.Disable
Set DoOnce to 1
;If its already added but "lost"
else
showmessage 00Fail
endif
Return

endif
End

 

I've linked the activator to a container and the container to a static for display purposes but for the life of me I cannot get this to actually work.

 

 

Ok so I've scraped that particular script but what I'm trying to do is create a wall where you can activate a set location that will display a particular weapon, kinda like putting a gun onto a rack then being able to pick it back up without having to slog through an inventory screen. If anyone is familiar with the underground hideout mod then it would be like the hidden weapons in the bedroom like I previously mentioned.

Edited by gaubanss
Link to comment
Share on other sites

DO NOT prefix the EditorIDs of your forms with numerical values. This causes the script compiler to parse the ID as a hex value, and it will confuse the hell out of itself.

 

I don't know why people do this, but my best guess is so that they can easily find their mod's forms since the GECK sorts forms alphabetically by EditorID by default. Expand the FormID field (just to the right of the EditorID field) and click it to sort by FormID instead. That way all of your mod's forms are at the top of the listing no matter what you've named them.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...