Satan wrote: ↑
Sat Nov 09, 2019 8:08 pm
Trying to 'give' a character sunglasses from the player's inventory and have them mount to that characters head. I also want it to check for glasses already mounted and remove the glasses to the player's inventory, from the characters head, before mounting the sunglasses. And Vice Versa. The best I've come up with is using the item interaction to drop it from the player inventory and then mount it, handing it off to a triggerevent if the opposite is already mounted. That triggered event drops the items from both the character and inventory and then swaps them. This doesn't work.
Using in game commands to remove sunglasses from the inventory, then mounting to NPC's head works. Any ideas how to accomplish this in CSC?
Yeah, if I am reading this right it would be (I am gonna short hand this rather aggressively, sorry). None of the criteria given are necessary, but in case you are doing a LOT with these items at once (or more than one character can affect these items) or grow the story later, it'll prevent debug log spam and ensure specificity:
Event: Item : Glasses : Mount : False
Criteria : Item : Glasses : Is Mounted: True
Event : Player : Inventory : Add : Glasses
Criteria: Player Inventory Has: Glasses : False
Event: Player : Inventory : Remove : Sunglasses
Criteria: Player Inventory Has: Sunglasses : True
Event: Item : Sunglasses : SetEnabled : True
Criteria: Item : Sunglasses : Is Active : False
Event: Item : Sunglasses : Mount : CHARACTER NAME HERE : Head : True
Criteria : Item : Sunglasses : Is Mounted : False
The console version of removing items from the player's inventory automagically does a few extra things that the game event does not. The above should work.
The above should get you started. To reverse the process, just shift the events around, optimally in a new item interaction, but you could also write this all as one item interaction that calls different swap event triggers depending on who has what glasses. I would always suggest getting the mechanic working as cleanly as you can at first, and then cleaning it up later so it's quickly readable and "modularized" later on.