Difference between revisions of "ShowBarterMenu - Actor"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>VampireMonkey
imported>DavidJCobb
(→‎Notes: Faction conditions need to be met; you'd expect the menu to not even show up if they weren't met, but it comes up empty)
 
(4 intermediate revisions by 2 users not shown)
Line 18: Line 18:


== Examples ==
== Examples ==
*Standard use.
<source lang="papyrus">
<source lang="papyrus">
; Shows the barter menu for Bob
BobREF.ShowBarterMenu() ; Shows BobREF's barter menu
Bob.ShowBarterMenu()
</source>
</source>
 
*Prompt a barter menu via an activator.
 
== Usage Example ==
Remember the Commissary terminals from Fallout New Vegas: Lonesome Road
well i manage to figure out how to implement this into skyrim.
 
Here's the script:
 
<source lang="papyrus">
<source lang="papyrus">
Scriptname YourScriptName extends ObjectReference   
ScriptName YourActivatorScript Extends ObjectReference   
 
Actor property ThisActor Auto
Actor Property kSomeActor Auto ; Filled with desired merchant Actor
;this is where you point it to the merchant actor you have already made.
 
Event OnActivate(ObjectReference akActionRef)
Function ShowBarterMenu() native
If akActionRef == Game.GetPlayer() ; Only if activated by the player
 
kSomeActor.ShowBarterMenu() ; Show this actor's barter menu
 
EndIf
event onActivate(objectReference activateRef)
if activateRef == game.getPlayer()
;if the activator is activated by the player.
 
            Thisactor.ShowBarterMenu()
;then show this actors barter menu.
 
  EndIf
EndEvent
EndEvent
</source>
</source>


This script has to be placed on an activator for it to work.
== Notes ==
i recommend to add in the "DweButtonScript" script along this one and then pick a sound,
* This function will fail if the actor isn't actually loaded. The barter menu will appear, but it will be empty even if the actor's merchant chest has items in it.
so when you activate it you get a sound along, like a beep or a evil laughter for example.
* The function will also fail and show an empty barter menu if the conditions aren't met for the actor's merchant faction to sell, e.g. she's not near the reference she needs to be.
VampireMonkey out.
 
== See Also ==
== See Also ==
*[[Actor Script]]
*[[Actor Script]]

Latest revision as of 00:48, 20 May 2017

Member of: Actor Script

Shows the barter menu for this actor.


Syntax[edit | edit source]

Function ShowBarterMenu() native

Parameters[edit | edit source]

None.

Return Value[edit | edit source]

None.

Examples[edit | edit source]

  • Standard use.
BobREF.ShowBarterMenu() ; Shows BobREF's barter menu
  • Prompt a barter menu via an activator.
ScriptName YourActivatorScript Extends ObjectReference  
 
Actor Property kSomeActor Auto ; Filled with desired merchant Actor
 
Event OnActivate(ObjectReference akActionRef)
	If akActionRef == Game.GetPlayer() ; Only if activated by the player
		kSomeActor.ShowBarterMenu() ; Show this actor's barter menu
	EndIf
EndEvent

Notes[edit | edit source]

  • This function will fail if the actor isn't actually loaded. The barter menu will appear, but it will be empty even if the actor's merchant chest has items in it.
  • The function will also fail and show an empty barter menu if the conditions aren't met for the actor's merchant faction to sell, e.g. she's not near the reference she needs to be.

See Also[edit | edit source]