ascottk on 13/10/2005 at 02:57
I want to get rid of inventory items & I want the player to choose which item to delete. So the player selects the item in inventory & uses it on a trash can in order to delete it.
Here's my buggy scripts (attached to inventory readables) and they delete similar classes so future readables are deleted as well:
Script 1 "NoteDeletionTrigger" on readable-
CONDITIONS:
When I am used in a way from inventory
ACTIONS:
Send trigger message [DeleteNote]
Reset script conditions and actions
Script 2 "NoteDeletionReceive" on trash can-
CONDITIONS:
Received trigger message [DeleteNote]
Query if linked object(s) [PLAYER] are within [128.00] unreal units from linked object(s) [MYSELF]
ACTIONS:
Send trigger message [DeleteMe]
Reset script conditions and actions
Script 3 "NoteDeletionReceive" on readable-
CONDITIONS:
Received trigger message [DeleteMe]
ACTIONS:
Set [bDeleteOnUse] to [TRUE] on linked object(s) [MYSELF]
Delay [0.25] GAME seconds
Destroy linked object(s) [MYSELF]
Reset script conditions and actions
I know script 3 doesn't discriminate which item it wants to delete so it looks like it destroys the rest of the readables on the level but I'm not sure how to get around that. Maybe a triggerscript link from the readables to the trash cans & use:
Query if linked object(s) [PLAYER] are within [128.00] unreal units from linked object(s) [triggerscript]
but I'm even less sure that'll work :p
Crispy on 13/10/2005 at 05:32
How about creating a TriggerScript link from the readable to the trash can, then doing:
Script "Deleteable" on readable-
CONDITIONS:
When I am used in a way from inventory
Query if linked object(s) [TriggerScript] are within [128.00] unreal units from linked object(s) [PLAYER]
ACTIONS:
Destroy linked object(s) [MYSELF]
The only catch is that you may need to create the link from the readable's archetype, in case the readable is destroyed and recreated when it's picked up.
ascottk on 13/10/2005 at 17:20
Quote Posted by Crispy
How about creating a TriggerScript link from the readable to the trash can, then doing:
Script "Deleteable" on readable-
CONDITIONS:
When I am used in a way from inventory
Query if linked object(s) [TriggerScript] are within [128.00] unreal units from linked object(s) [PLAYER]
ACTIONS:
Destroy linked object(s) [MYSELF]
The only catch is that you may need to create the link from the readable's archetype, in case the readable is destroyed and recreated when it's picked up.
I already thought of a single script solution and it doesn't work. The readable remains in inventory.
EDIT: If only there was a script action:
Delete myself from inventory
ascottk on 14/10/2005 at 02:30
Okay I figured it out ;)
I ended up reversing the scripts & added a flag "PlayerNearTrash":
Scripts "NoteDeleteNearTrash" & "NoteDeleteFalse" on trash can:
CONDITIONS:
While linked object(s) [PLAYER] is within [128.00] unreal units from linked object(s) [MYSELF]
ACTIONS:
Set flag [PlayerNearTrash] to [TRUE] expires on map change [FALSE] . . .
Reset script conditions and actions
CONDITIONS:
When [PlayerNearTrash] is set to [TRUE]
ACTIONS:
Delay [10.00] GAME seconds
Set flag [PlayerNearTrash] to [FALSE] expires on map change [FALSE] . . .
Reset script conditions and actions
Script "NoteDeletion" on inventory readable:
CONDITIONS:
When I am used in a way from the inventory
Query if flag [PlayerNearTrash] is set to [TRUE]
ACTIONS:
Set [bDeleteOnUse] to [TRUE] on linked object(s) [MYSELF]
Delay [0.25] GAME seconds
Delete linked object(s) [MYSELF]
Reset script conditions and actions