Custom respawn UT4
- Exposure: public
- UE Version: 4.15
ctrl + v
1 comment
-
This is a custom respawn for UT4 gamemodes for weapons and shield picked up before the round ends and lets you respawn with that inventory picked up. You can make your own spawning with weapons, health shield and delay it as you want. This way you can make rounds as you want
How it works: It saves all weapons, ammo health and shield in an arrray. Then it destroy the player character and respawns a new character, which gets all weapons ammo shield and health back. A lot of arrays
All code in gamemode
Restart All Players - multicast Reset playerstate you don't need Get UTplayerConroller Weapon ArrayofGame - Define the Weapons you want in your gamemode (UTInventory Array) for example BP_RocketLauncher Weapon ArrayofPlayer - If that weapon is valid at the character, then add it to Weapon arrayofplayer Ammo Aray - then save the ammo for this weapon Armor Amount - if armor is more than 0, then save it to armor amount array Health Array - If the helath is more than 100, save the health On completed the second! loop, destroy the UT Character and restart player
On restart player erase states - you dont need new round - you dont need use weapon array of player and create an inventoryfor the utcharacter, then give him the ammo fromt he array. The array numbers are the same, so you can use the index of the loop on completed you can give health and shield to the character. Very important - at the very end clear all arrays, or you add infinite arrays and crash the game. Always clear arrays
You can trigger the Restart all Players from any actor that is on the server. I'm doing it like this: Player scores > Goal trigger a reset with UTresetinterface of the BombingRunMutator BombingRunMutator on Reset > triggers restart all players in gamemode
You can simply do Score > Goal > triggers gamemode restart all players.
Many ways to do it, as long as the actor has server acess. This is for players only, i didn't paste the code for the bots. But i can if someone needs
n0niz
January 24, 2020, 11:48 am