Jump to content

Recommended Posts

Posted

This Is What I have put

Scriptname __0SMF_ColdFridge3 extends ObjectReference Const
Int Property Insert Auto Const
FormList Property WarmDrinks Auto Const
FormList Property ColdDrinks Auto Const
Message Property FridgeMessage Auto Const
Container Property PristineFridge Auto Const
Event OnActivate(ObjectReference akActionRef)
int selectedOption = FridgeMessage.Show()
If (selectedOption == 1) ; Cancel
return
EndIf
If (Game.GetPlayer().GetItemCount(WarmDrinks) < Insert) ;
Debug.Notification("You need a Warm Drink")
return
EndIf
Game.GetPlayer().RemoveItem(WarmDrinks, Insert)
If (selectedOption == 0) ;
Game.GetPlayer().AddItem(ColdDrinks)
Debug.Notification("Have A cold One")
EndIf
EndEvent

The Game.GetPlayer()AddItem is the one that needs to go in a container
Posted

You want the warm drink(player has it first) to go in a container, or you want the cold drink(doesn't exist until player gives warm drink) to go in the container?

 

In any case your code is nested improperly and will always remove a warm drink from the player no matter what option they pick.

According to what you said you want the cold drink to go in the container, but you still used Game.GetPlayer() ?

You should be using PristineFridge.AddItem(ColdDrinks) if that's the right container

Posted

You need to specify the receiving container as the last parameter in RemoveItem or the stuff will either fall to the ground or simply disappear.

Function RemoveItem(Form akItemToRemove, int aiCount = 1, bool abSilent = false, ObjectReference akOtherContainer = None)

Posted

Whilst game.getplayer call is expensive, in a holotape/message menu which suspends realtime world execution its not a major problem.

 

If avoiding more properties on nasty script fragments, the best practice is to call the function ONCE per function by assigning it:

 

Actor PlayerREF = Game.GetPlayer()

...

PlayerREF.RemoveItem(WarmDrinkBaseForm, int aiCount = 1, bool abSilent = false, akOtherContainer = Fridge)

...

Fridge.RemoveItem(ColdDrinkBaseForm, int aiCount = 1, bool abSilent = false, akOtherContainer = PlayerREF)

Posted

It is , the warm drinks are being removed but cold drinks are going nowhere
I have tried it as a function but get error expectin EndEvent
PristineFridge.AddItem is get PristineFridge is not a function
damn warm and cold drinks having 39 items , I would have done it the long way if I could fit them all on 1 message lol

  • Recently Browsing   0 members

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