Mounting object given to NPC?

General discussion of the House Party CSC, or get help making your own story.
Forum rules
Please follow all Eek! Forum rules.
Post Reply
Satan
Posts: 3
Joined: Sat Nov 09, 2019 7:06 pm

Mounting object given to NPC?

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?
eekdon
Posts: 1546
Joined: Tue Feb 13, 2018 4:29 pm

Re: Mounting object given to NPC?

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.
Image
Satan
Posts: 3
Joined: Sat Nov 09, 2019 7:06 pm

Re: Mounting object given to NPC?

Thanks, that's got me sorted out. I think what I was missing was the explicit setenabled. Really all I needed to add to what you gave me here was a check for player having picked up both pair before adding the not-given item to player inventory. Easy enough with player values. Thanks alot.
eekdon
Posts: 1546
Joined: Tue Feb 13, 2018 4:29 pm

Re: Mounting object given to NPC?

No problem!
Image
Post Reply