[ZSCRIPT]Ideas for containers
Posted: Sat Sep 09, 2023 11:46 am
I want to create containers - you know, crates, boxes, barrels, chests, whatever - that when used or destroyed they spew out their contents. That part of the coding I can handle.
What I want to know is how to assign contents to a container. I could hard-code the contents, then have a subclass of the container for each item it might contain. That seems kinda excessive.
I'm thinking one way could be to put the content items outside the map, give them all a specific TID, and the container has that TID as an arg and when it's opened/destroyed it teleports all items with that TID to itself and spews them out.
Another way could be to set the string arg with a CSV of classes of items to be spawned on the container open/destruction event.
So obviously my goal here is to be able to set the container's content from a map editor.
Any ideas on the best way to do that?
I guess this might be similar to how you would give a baddie a key or some other quest item to drop when they die?
What I want to know is how to assign contents to a container. I could hard-code the contents, then have a subclass of the container for each item it might contain. That seems kinda excessive.
I'm thinking one way could be to put the content items outside the map, give them all a specific TID, and the container has that TID as an arg and when it's opened/destroyed it teleports all items with that TID to itself and spews them out.
Another way could be to set the string arg with a CSV of classes of items to be spawned on the container open/destruction event.
So obviously my goal here is to be able to set the container's content from a map editor.
Any ideas on the best way to do that?
I guess this might be similar to how you would give a baddie a key or some other quest item to drop when they die?