Help creating a tennis mod utilizing mod hooks

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.

I don’t think what you are trying to do would be possible with modhooks as far as I know. Might be worth it to try something with making a module or plugin but I doubt that would work either.

In short unturned modhooks cannot introduce new code, or apply existing code to new things. You can do a lot with this, such as letting players place down water, or making barricades behave as grenades and explode after a set time, but the stuff you’re looking to do doesn’t seem possible. Somebody might have a way to make modhooks able to spawn things and do that type of stuff but nothing I’ve heard of.

I believe the functionality is there - It just hasn’t been harnessed.
Placeable Assets — Unturned 0.1 documentation (
^ this won’t work on a Throwable object but it’s just to show the functionality is available.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.