Jump to content

[LE] Script on a trigger that activate a Display Case


Recommended Posts

Hi everybody!
I'm trying to activate a Display Case using a Menu inside a trigger by script:
[0] Insert the weapon in the Display Case
[1] Pick up the Weapon from the Display Case
[2] Activate a Portal (with FastTravel) if the Quest that give that random Weapon to the Player has Done
The weapon to be inserted in the Display Case is a random weapon that does not have a specific ID.
I managed to activate the WaponRackDisplayACTIVATORplayerHouse, and when activated it places my equipped weapon in the Display Case.
I was able to get the Portal activated without any problems.
What I can't do is the menu point [1], that is to remove the Weapon from the Display Case, because is not a weapon with a specific ID, I don't know how to get it picked up.
Anyone can help?

Edited by Tiziano74
Link to comment
Share on other sites

When you display the weapon in the display case, do you have access to the object reference at that time? If you do, store that value in a variable and use the variable when retrieving the weapon from the display case.

 

Hi

1st ofall thanks for the answer!

I also thought about it.

I'm not quite familiar with scripting yet, but the values given to a script variable, don't they "erase from game memory" once the script is solved?

Let me explain, if I can give to EquippedWeapon variable the value of the equipped weapon before it's displayed in the Display Case, I place the weapon in the Display Case by the script, then I go to another place with my player, I go back to the armory, the game remembers what value had it taken the EquippedWeapon variable when I put the weapon in the Display Case?

Link to comment
Share on other sites

If it is the same instance of the object holding the script, the data stored in the variable should remain despite having left the area for some time.

If for some reason the object holding the script has a new instance spawned, then the data stored in the variable would be lost.

 

If you are concerned about losing the data, you can always use a quest script and store the data in a hidden property variable. This of course would require remote access to the quest script. Which isn't that hard to do once you've done it a time or two.

Link to comment
Share on other sites

If it is the same instance of the object holding the script, the data stored in the variable should remain despite having left the area for some time.

If for some reason the object holding the script has a new instance spawned, then the data stored in the variable would be lost.

Before to lose my mind in quest scripts i give it a try . . . i hope it works and i'll let you know!

Thanks

Link to comment
Share on other sites

If it is the same instance of the object holding the script, the data stored in the variable should remain despite having left the area for some time.

If for some reason the object holding the script has a new instance spawned, then the data stored in the variable would be lost.

 

OK!

Now I have the reference of the weapon that is on the display case. . . I did a test through Debug.MessageBox and it shows me the ID of the weapon when I tell it from the menu that I want to remove it from the Display Case.

But now I have the problem of how to remove the weapon from the Display Case through a script command . . . I tried with the RemoveItem command both from the WaponRackDisplayACTIVATORplayerHouse and from the WeaponRackDisplayPlayerHouse, but nothing. . . I usually do this with containers, but apparently the Display Case is not a Container. . . any ideas?

Link to comment
Share on other sites

How about posting your code? Might help to see what is actually going on in the script.

 

OK

This is the script (obviously in my case the messages and references are in Italian):

 

 

 

Scriptname QLH_Teca_Arma_Thane_script_01 extends ObjectReference

 

Quest Property QuestThane Auto ;is FreeformRiftenThane

Int Property Stage Auto ;is the last quest stage set to 200

Int Property CheckArmaEsposta Auto ;this is set to 0

String Property NomeCitta Auto ;in this case is set to Riften

Actor Property PlayerRef Auto

ObjectReference Property Espositore Auto ;is the WaponRackDisplayACTIVATORplayerHouse

ObjectReference Property Teca Auto ;is the DisplayCase

ObjectReference Property XMarkerHeadingPortale Auto ;is the RiftenMapMarkerStart

Message Property MenuTeca Auto

 

Weapon ArmaSinistra

Weapon ArmaDestra

Weapon ArmaEsposta

 

Event OnActivate(ObjectReference akActionRef)

If (QuestThane.GetStageDone(Stage))

Menu()

Else

Debug.MessageBox("In questa teca potrai esporre l'arma che ti sarà donata dallo Jarl di " + NomeCitta + " quando ti nominerà Thane, ed attivare il Portale per " + NomeCitta + ", ma non sei ancora stato nominato Thane di " + NomeCitta)

EndIf

EndEvent

 

Function Menu(int aiButton = 0)

aiButton = MenuTeca.show()

If aiButton == 0

ArmaSinistra = Game.GetPlayer().GetEquippedWeapon(True) as Weapon

ArmaDestra = Game.GetPlayer().GetEquippedWeapon() as Weapon

If (ArmaSinistra == "None") && (ArmaDestra == "None")

Debug.MessageBox("Devi avere l'arma equipaggiata per poterla esporre")

ElseIf (ArmaSinistra != "None") && (ArmaDestra != "None")

Debug.MessageBox("Hai 2 armi diverse equipaggiate, puoi equipaggiarne solo una da esporre")

ElseIf (ArmaSinistra != "None") && (ArmaDestra == "None") && (CheckArmaEsposta == 0)

ArmaEsposta = ArmaSinistra as Weapon

CheckArmaEsposta = 1

Teca.Activate(Game.GetPlayer())

Utility.Wait(1)

Espositore.Activate(Game.GetPlayer())

Utility.Wait(1)

Teca.Activate(Game.GetPlayer())

ElseIf (ArmaSinistra == "None") && (ArmaDestra != "None") && (CheckArmaEsposta == 0)

ArmaEsposta = ArmaDestra as Weapon

CheckArmaEsposta = 1

Teca.Activate(Game.GetPlayer())

Utility.Wait(1)

Espositore.Activate(Game.GetPlayer())

Utility.Wait(1)

Teca.Activate(Game.GetPlayer())

EndIf

EndIf

If aiButton == 1

If CheckArmaEsposta == 1

Teca.Activate(Game.GetPlayer())

Utility.Wait(1)

PlayerRef.AddItem(ArmaEsposta)

Utility.Wait(1)

Teca.Activate(Game.GetPlayer())

CheckArmaEsposta = 0

Else

Debug.MessageBox("La teca è vuota")

EndIf

EndIf

If aiButton == 2

Game.FadeOutGame(False, True, 2.0, 1.0)

Game.GetPlayer().MoveTo(XMarkerHeadingPortale)

Game.EnableFastTravel()

Game.FastTravel(XMarkerHeadingPortale)

EndIf

EndFunction

 

 

 

The PlayerRef.AddItem (ArmaEsposta) unfortunately does not remove the weapon from the DisplayCase, but generates a duplicate that is inserted in the Player's inventory.

I think I will work around the problem at point [1] of the menu by only opening the door of the DisplayCase, with a Disable on the Trigger that activates the menu and a Disable on the CollisionMarker that I have put to cover the DisplayCase, so the weapon can be picked up manually by the player and, when the player will closes the Display Case, through a second script inserted on the Display Case with an Event OnClose, I will activate again both the Trigger with the menu and the CollisionMarker with an Enable

Edited by Tiziano74
Link to comment
Share on other sites

  • Recently Browsing   0 members

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