Jump to content

Menu button condition issue


Minuos

Recommended Posts

Hi all,

 

I'm trying to make some options in a messagebox menu only appear under certain conditions. I can get this to work if the player is the target of the condition, but not the actor whose script brings up the message. For example, I want one option to appear if the player OR the actor has > 0 Stimpaks in their inventory. I've tried running the condition on Subject, Target, QuestAlias (on an alias filled by the actor)... It just doesn't work.

 

I can work around it by setting values on the player in the script like:

If Self.GetItemCount(Stimpak) > 0
    Game.GetPlayer().SetValue(ActorHasStimpak, 1)
Else
    Game.GetPlayer().SetValue(ActorHasStimpak, 0)
EndIf

And then the conditions on the message button will be based on the player's Stimpak count and AV set by the script. There could potentially be a dozen of these, though, which could slow down how quickly the menu appears. I'd really prefer to keep it simple.

 

Any ideas for getting message button conditions to run on the actor?

Link to comment
Share on other sites

I've tried running the condition on Subject, Target, QuestAlias (on an alias filled by the actor)... It just doesn't work.

 

Run on Quest Alias, GetItemCount Stimpak > 0 should work. Are you sure the alias is filled by the time the messagebox opens?

 

There could potentially be a dozen of these, though, which could slow down how quickly the menu appears. I'd really prefer to keep it simple.

 

You might want to use conditional script variables instead of global variables then, they're slightly faster and global variables that are script properties add new script instances to save games.

Link to comment
Share on other sites

Run on Quest Alias, GetItemCount Stimpak > 0 should work. Are you sure the alias is filled by the time the messagebox opens?

 

The message displays the actor's name, which is what the alias is for, so it must be filled in time. I removed the Alias.Clear() line from the script to be certain, but no luck. It just seems like it doesn't work.

Edited by Minuos
Link to comment
Share on other sites

 

Run on Quest Alias, GetItemCount Stimpak > 0 should work. Are you sure the alias is filled by the time the messagebox opens?

 

The message displays the actor's name, which is what the alias is for, so it must be filled in time. I removed the Alias.Clear() line from the script to be certain, but no luck. It just seems like it doesn't work.

 

I see. By the way, if you're concerned about the speed, you can also use a handler script that counts how many Stimpaks your reference alias has even before the messagebox opens.

Scriptname YOURSCRIPTNAME extends Quest Conditional

Potion Property Stimpak Auto Const
ReferenceAlias Property myAlias Auto Const

Int iStimpakCount Conditional         ;Use the condition "GetVMQuestVariable" (Run on Subject).

Event OnQuestInit()
	RegisterForRemoteEvent(myAlias.GetReference(), "OnContainerChanged")
EndEvent

Event ObjectReference.OnContainerChanged(ObjectReference akSender, ObjectReference akNewContainer, ObjectReference akOldContainer)
	iStimpakCount = myAlias.GetReference().GetItemCount(Stimpak)
EndEvent
Edited by LarannKiar
Link to comment
Share on other sites

  • Recently Browsing   0 members

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