I have decided to create a tennis mod.
My plan is to create a tennis racket melee item that has a collision event modhook that,
(1) Checks that the collision was caused by a thrown throwable object, - if the collision is not a throwable object, ignore it. (2) Checks that the throwable object is not sticky. (3) Delete the throwables' GameObject. - Disable any OnDestroy mod hooks on the throwable object before deleting. - No explosion when deleted - if that's how explosions are triggered. (4) Respawns the throwable object as a newly thrown object - Basically throw the throwable object back the way it came from. - If the throwable is a grenade then it doesn't really matter if the timer is reset when the throwable is rethrown - that's a feature not a bug
My goal is to turn grenades into hot potatoes and have them fly around like tennis balls because that would be fun for PvP and useful for tennis games on RP servers.
In theory this is possible but there are no guides on explaining the limitations of mod hook or how they are used so I am unsure if my plan is viable.
Another mod hook I intend to use is the OnDestroy mod hook.
In this case I want to create a tennis ball throwable that after it despawns/explodes, it spawns a new tennis ball ITEM at the location it was destroyed/exploded at
(this is why I mentioned previously that OnCollide with the tennis racket the OnDestroy mod hook gets disabled).
In theory this is also doable however due to a lack of guides - I am unsure whether this is viable.
The things I need help with are:
- Spawning an item when an OnDestroy mod hook event occurs.
- Deleting an active(thrown) throwable type item OnCollide and respawning the thrown throwable as if the player had thrown it with their hands.
I figure these are all pretty simple things but after attaching the mod hooks to the game object, I don’t know what to do from there.
I don’t know if there is a specific way that the scripts need to be setup and I don’t know how to instantiate or spawn a new object. My understanding is that the mod hooks can trigger scripts but the lack of any kind of guide or example scripts has brought my research to a halt.
If anyone can help me code this up or better yet, create a guide that shows new modders (like me) how to start utilizing these mod hooks by providing some basic examples of what can be achieved using mod hooks it would be greatly appreciated.