Suggestion - Refresh Character on Spot ModAPI
I believe it might be beneficial to refresh a character on the spot. That is, respawn them, but keep all previous values such as energy, inventory, etc. But then refresh values such as max inventory, physics body, and similar things.
I've made a speed mod that changes speed mid-game. However, the character's max speed is set on spawn, by havoc, so I can't touch it unless I respawn the character. The causes the game to YEET (forgive the informal language please) the character to max speed if they're on their jetpack, after turning it on and off.
https://gyazo.com/9625f1c645092bd41c802f83f6bfb45e
However, as I said, respawning the character seems to fix this. Anyway, how this would be helpful to people would be that it allows more than just refreshing the rigid body's max speed. It'd allow for other things are done at spawn to be handled, but would not cause the player to die, spawn, and get teleported by the mod.
I'm not sure how helpful this would be to everyone else, but it'd help me and another mod I saw on the workshop a while ago that required the character to respawn to get a certain effect. It might also just be useful to have!
Also, note: Something that seems to sorta fix the issue for my mod is setting character physic to null, the toggle thrust/jetpack for the player. Thrust Toggle seems to set the character's physic's if it is null, so it refreshes. However, this is obviously not intended as-
https://gyazo.com/f85eb85123c25b3b83ec40144218b8da
The animations and sounds stop working properly when this is done. Sounds seem to come back if I init the physics object manually (see code) but animations still won't return properly.
Also, note: Something that seems to sorta fix the issue for my mod is setting character physic to null, the toggle thrust/jetpack for the player. Thrust Toggle seems to set the character's physic's if it is null, so it refreshes. However, this is obviously not intended as-
https://gyazo.com/f85eb85123c25b3b83ec40144218b8da
The animations and sounds stop working properly when this is done. Sounds seem to come back if I init the physics object manually (see code) but animations still won't return properly.
Replies have been locked on this page!