A loot script to generate one item with additional scripts,
to support the destruction and wobbling of entities,
interact message prompt, and a modified pickupSpawner.
Templates
- Loot Chest
- Requires “Open Close with Events” package dependencies
- Loot Crate
- uses all attached scripts
- Inspired from Andy’s Smash Crate
- Resource Gems
- a default loot item for the Loot templates
Scripts
-
lootScript
- generate loot OnInteract or OnHit or OnDestroyed, etc.
- listen for pickup and/or manage destroying of spawned loot
-
hitableScript
- modified from AdamO adventure elements package
- requires crayta inventory
-
wobbleScript
- copied from AdamO adventure elements package
- no modifications
-
pickupSpawnerScript
- modified from inventory package
- OnInteract and OnCollision are both able to be selected or not
- Equip on Pickup option added to not equip Apples, etc. on pickup
-
triggerInteractableScript (included with interact prompt)
- used to toggle trigger interactable
- chests need this to open and close
- trees do not
Spawned Loot
Loot Template | Property | Setting |
---|---|---|
pickupSpawnerScript | Respawning | False |
Show on Init | True |
Chest
Trigger Box is optional to allow easier accessibility for interaction
Series of Events
- On Interact (on trigger box)
- Opens the chest
- Generates the loot
- Loot script
- listens for pickup
- closes the chest
- hides the chest
- destroys spawned loot
- on pickup from the world
- waits until time to live has expired to destroy
- multiple templates can be added to loot template
- each template has an equal chance to drop
- dropChance is for crates that may sometimes be empty, etc.
- use script folders for additional loot configurations
- listens for pickup
Chest | Property | Setting |
---|---|---|
pickupSpawnerScript | Use on Collision | False |
Use on Interact | False | |
Use Self as Template | False | |
Pickup Template | leave blank | |
Show on Init | True | |
openCloseScript | Start State | Closed |
lootScript | Loot Template | Resource Gems |
Drop Chance | 100 | |
Begin Events | Loot Chest / openCloseScript / setOpening | |
Pickup Events | Loot Chest / openCloseScript / SetClosed | |
Loot Chest / pickupSpawnerScript / Pickup | ||
Interactable Box / triggerInteractableScript / SetTrue |
Trigger | Setting |
---|---|
On Interact | Loot Chest / lootScript / GenerateLoot |
Loot Chest / triggerInteractableScript / SetFalse |
Crate
Crate has a wobble, play sound, and play effect scripts.
Crate | Property | Setting |
---|---|---|
hitableScript | On Destroyed | Loot Crate / pickupSpawnerScript / HidePickup |
On Destroyed | Loot Crate / hitableScript / ResetHealth | |
On Destroyed | Loot Crate / lootScript / Generate Loot | |
Health | 600 | |
Hitable Template | (leave blank for any template to cause damage | |
On Hit | Loot Crate / playSoundScript / PlaySound | |
On Hit | Loot Crate / playEffectScript / PlayEffect | |
On Hit | Loot Crate / wobbleScript / DoWobble |
Interact Msg
- used for chest and crate prompt
- no script has the required function GetInteractPrompt(promppts)