I have a placeable container (chest) that has items in it (randomly created) and I have the OnOpen event firing to check the PC's inventory for the same items and to count them. If the count is over 5 I have a FloatString to say "You have too many" and then I want to close the chest so that it can't be accessed until the PC drops one or more items.
What is the function to close the chest?
I don't want to lock it and I don't want to make it inaccessible, I just want the PC not to be able to access the items until he has dropped one or two others.
Cheers
Close a placeable function?
Débuté par
El Condoro
, nov. 05 2010 02:46
#1
Posté 05 novembre 2010 - 02:46
#2
Posté 05 novembre 2010 - 08:57
It might be to have the chest run ActionPlayAnimation with an ANIMATION_PLACEABLE_* value. But that's just a guess.
#3
Posté 07 novembre 2010 - 09:55
Yes - I suspect ActionPlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE) might do the trick. That's what you would use to return a lever to the 'deactivated' state. Unless chest animations operate differently to levers?
#4
Posté 07 novembre 2010 - 10:23
I think the issue will be more of closing the opened inventory window than animating the chest closing animation. This might not be right, but I suspect that the relevant GUI would be SCREEN_CONTAINER_CHEST. Ingamegui.ini sets this as defined by container.xml, which doesn't seem to include ScriptLoadable=true, so you may or may not be able to close it.
Anyway, if this does work, you'd probably want to animate the closing as people have said, but also use CloseGUIScreen(oPlayer, sContainerGUI). Maybe someone who knows more about GUIs than I do can help you more.
Anyway, if this does work, you'd probably want to animate the closing as people have said, but also use CloseGUIScreen(oPlayer, sContainerGUI). Maybe someone who knows more about GUIs than I do can help you more.
#5
Posté 09 novembre 2010 - 11:34
There has been a big problem in persistent worlds with chest lids getting stuck open.
As far as I know nobody has figured out how to force a chest closed via scripting.
I don't think it can be done.
But if you happen to have any luck, please let us know.
As far as I know nobody has figured out how to force a chest closed via scripting.
I don't think it can be done.
But if you happen to have any luck, please let us know.
#6
Posté 10 novembre 2010 - 01:03
I suppose you could always try using an OnInventoryDisturbed script that counts how many of a certain item is in the player's inventory, and if it excedes a given amount then immediately giving the difference back. If there is only one special item type per chest then you could store the item tag and the amount to check for as local variables on the chest, so different chests could use the same script.
#7
Posté 10 novembre 2010 - 01:31
El Condoro wrote...
What is the function to close the chest?
Cheers
ActionPlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE);
However you need to keep track of it. Look at x2_plc_used_act for an example script (it sets the variable X2_L_PLC_ACTIVATED_STATE).
It works perfectly just place this line in a script OnOpen for a chest. You can add a DelayCommand() if you want a smoother effect.luna_hawke wrote...
There has been a big problem in persistent worlds with chest lids getting stuck open.
As far as I know nobody has figured out how to force a chest closed via scripting.
I don't think it can be done.
But if you happen to have any luck, please let us know.
However that will effectively close the chest but not the trade window. One way to achieve that is to make the player move away from the chest.
Modifié par Olblach, 10 novembre 2010 - 01:39 .





Retour en haut






