Player respawn hacks

Discussion in 'Empyrion API' started by Kharzette, Dec 29, 2018.

  1. Kharzette

    Kharzette Ensign

    Joined:
    Sep 20, 2018
    Messages:
    9
    Likes Received:
    0
    I'm doing a simple little multiplayer team vs team pvp scenario, and I'd like to modify the way player death and respawn is handled.

    Ideally when a player dies, I'd resurrect them at their team's starting point, which is a little POI I made with player spawn pads.

    Less ideal would be when a player respawns after choosing the usual options (nearby, medcenter etc), I'd teleport them back to the start point.

    I spent the day trying a second timer tic that checks Player_Info stuff like health and positions and the like. At the death event position is 0 0 0, and health is <= 0. Sometime during the load towards the respawn options screen, health is restored and the position is set to the "respawn nearby" position.

    I don't think the player is in the world at this point, and any teleports done don't work (and playfield teleports cause a sort of double load state).

    Nothing changes while the player sits at the respawn choices screen. If they pick something other than the nearby option, the position changes, but even that can't be acted upon as the player will be loading for a bit.

    I thought maybe I could try a ShowDialog, but nothing ever shows up. I thought it might be queued (since the respawn choices screen is probably up), but maybe it really is only for single player.

    So I guess I'd need one of:

    - A way to intercept / prevent / block the usual death and resurrection stuff.
    - A Player_Respawned_After_Dying kind of event that tells the mod the player is ingame and loaded.

    I don't think either exist so anyone have any ideas for any gross hacks? :D

    The only thing I can think of is spawn a cage around them with a lever that teleports them where I want them to go or something :D
     
    #1
  2. Exacute

    Exacute Rear Admiral

    Joined:
    Feb 17, 2017
    Messages:
    456
    Likes Received:
    307
    Yeah, afaik. there's no good way to get when they have respawned..
    My best bet would be to do something like this:

    -When player dies, start a timer, running every.. second seems reasonable..
    -Ask for player_info..
    -Ignore (Really, store), the first set that comes up, that's not 0,0,0
    -When this changes from previous value, assume they have respawned & loaded (They moved)
    -Now you can do TP event

    .. def. not pretty, but assuming what you say is true (the whole unrealiable tps in loading screens etc, which wouldn't surprise me the least bit), then that's the best I can really think of
     
    #2
  3. Exacute

    Exacute Rear Admiral

    Joined:
    Feb 17, 2017
    Messages:
    456
    Likes Received:
    307
    You can *maybe* combine this with a 'pre-death' check, so that you catch them before they actually die.. I don't think that is too viable tho..
     
    #3
  4. Kharzette

    Kharzette Ensign

    Joined:
    Sep 20, 2018
    Messages:
    9
    Likes Received:
    0
    The move detection above doesn't happen if they choose the spawn nearby option, but it does work if they pick like fresh start. It is a tricksy problem.
     
    #4
  5. Kharzette

    Kharzette Ensign

    Joined:
    Sep 20, 2018
    Messages:
    9
    Likes Received:
    0
    Hmm maybe I could detect small movements. Like check every half second or so, and if I see small movements I'll know the player is running. Then I can do the teleport?
     
    #5
  6. Exacute

    Exacute Rear Admiral

    Joined:
    Feb 17, 2017
    Messages:
    456
    Likes Received:
    307
    Well, as I mentioned, I'd start a timer, that checks every <interval> (second is prob. fine), if the player have moved.. Since the timer is started after the deathpoint, and only set when the coordinates is again valid, it should mean
    -Player have picked a respawn option
    -Player have moved/rotated <> Player should be out of loading screen

    It's not *ideal* .. but it's about the best I can think of
     
    #6
  7. Kharzette

    Kharzette Ensign

    Joined:
    Sep 20, 2018
    Messages:
    9
    Likes Received:
    0
    The short move detection works, but it is kind of ugly. I'll also eventually forego the teleport if they chose to respawn back at the rally point, when I can figure out how to get the coordinates of the player start pads.

    Doesn't look like it is possible to get the location of a device in a structure though? I can probably just hardcode some delta values from the origin of the structure.
     
    #7
  8. Furious Hellfire

    Furious Hellfire Rear Admiral

    Joined:
    May 3, 2017
    Messages:
    644
    Likes Received:
    2,402
    Can you not just set each team to use a faction and each faction has its own faction respawn point clone or medi ?

    To get coordinates of a pad go and stand on it and type di in console, you will see your coords.

    I had to do something like this when i made a scenario for a team v team sv battle.
     
    #8
  9. Kharzette

    Kharzette Ensign

    Joined:
    Sep 20, 2018
    Messages:
    9
    Likes Received:
    0
    That would work if I could disable crafting of cloners, but I still have to worry about the spawn nearby feature. Wish that was an option in a config file somewhere.

    For the pad locations, I was hoping to keep everything somewhat random friendly. The solar system has to be fixed because of how messed up the jump lanes get, but maybe someday we can randomize planets with a fixed solar system.
     
    #9
  10. Exacute

    Exacute Rear Admiral

    Joined:
    Feb 17, 2017
    Messages:
    456
    Likes Received:
    307
    Sorry, didn't see this post:
    yes, unless you go really out of your way to do blueprint reading, this is not possible. (And I really wouldn't recommend going to that massive effort)
    Rather, I'd recommend getting the structures position (by name, as you assumingly know the name(s) of the spawnpads), and take their coordinates, and then assume if the player is spawned with 'reasonable radius' from these coords, that they spawned at the spawnpad..


    Also, yeah, you could disable crafting of the clone things, but these could potentially still be found in the world as loot.. so wouldn't neccessarily solve your issue.
    (And yeah, spawn near would still be an issue)
     
    #10
  11. Xango2000

    Xango2000 Captain

    Joined:
    Jun 15, 2016
    Messages:
    385
    Likes Received:
    202
    Could set up a mod to periodically check player inventory and remove said items or check player entities for those blocks and tell the player if they don't remove those blocks their entity gets destroyed or an admin will drop by and remove the blocks for them... Along with several other blocks. Or just periodically run replaceblocks on each side entity that has forbidden blocks.
     
    #11
  12. MidareToushirou

    MidareToushirou Lieutenant

    Joined:
    Oct 5, 2017
    Messages:
    58
    Likes Received:
    40
    I've already made a scenario like this, that has the clone bay crafting disabled and doesn't have it as loot in the world but it is not up to date with this version. It's called "Conflict Arms" and was a fun little project. Unfortunately, without a centralized dedicated datacentre -- it isn't likely going to be a very stable scenario to run from a residential address and all of the paid hosts I have seen don't offer enough options via configuration to make it work (plus they cost).

    You can disable crafting in the config file by removing the associated tags (what it is built with). So, remove the "HV, CV, SV, BA" tags and you won't be able to craft the item anymore because it won't show up in those constructors. Pretty simple. The other part of the fix is creating your own playfield and planet that only features your pois for the scenario and not any other pois from the game that might have loot containers.

    My version also doesn't account for the suit constructor so you will have to figure out how to customize what is offered on that, too. It would be ideal to be able to make healing items and food, maybe even basic ammo like pistol ammo, to make the scenario more "field-friendly". It also only has one combat zone (one planet where the fighting is intended to happen) but many showed interest in there still being an entire solar system to explore, but that introduces a host of other issues associated with loose ends of the extra playfields. Every playfield has to conform to the first and that means more work, so you have to create custom pois or remove the pois of the other planets while still making it viable (more work), and you also have to make certain that the solar system and factions are set up correctly. BUT! Here in lies another issue, PVP doesn't take into account our little scenario which means that players that are to be team members can still PVP each other (which most will, as I experience, most players on pvp servers just shoot the first people they see and don't follow any code of honor which makes the game mode not work!). Also the game, last time I tried this, had issues with the Base Turrets shooting at Allied Factions and The player themself (even the admin). You couldn't leave the base without it shooting you dead, it was strange. There are some small issues like that in the game itself because it isn't setup to be a pvp FPS style game. It is not one side versus another side, it is almost like a chaotic deathmatch that has some order due to having multiple sides. Factions are also not handled the way that "teams" in an FPS are, which means that you may have some issues limiting players to one sole faction and getting them to work together when everybody generally makes their own faction with their friends.

    It's a fun idea, though. I wanted to host a 24/7 FPS MMO, but it just isn't viable as of yet. You can make the scenario and it can play, but it being viable for a LIVE server is another story.

    As for the spawning issue, I see it as a non-issue. You can spawn back at base or in the field for another go. It's not much different from some of the FPS respawn systems I have experienced. Delta Force Black Hawk Down comes to mind. I'd say don't worry about that unless you think that people really should be forced to spawn back at base, then all you really need to do is setup dedicated clone bays on the main bases and remove all of the other options of spawning, so they can only spawn there. I don't think trying to detect player movement is a good idea and is too much extra-overhead for the game as it is. It is better to *disable* something than it is to try to add something.
     
    #12
    Last edited: Jan 22, 2019
  13. Kharzette

    Kharzette Ensign

    Joined:
    Sep 20, 2018
    Messages:
    9
    Likes Received:
    0
    Thanks for all the suggestions! I've got a pretty good system going with watching for movement. I got distracted by Atlas for a month or so but I'm about ready to start testing.

    I'm not even sure anyone wants a scenario like this but it was fun to make :D
     
    #13
  14. MidareToushirou

    MidareToushirou Lieutenant

    Joined:
    Oct 5, 2017
    Messages:
    58
    Likes Received:
    40
    Yeah, it was really fun to make. Figuring out the spawns and teleports, but particularly making the POIs.
    Should check out my version of this kind of scenario just search the forums for 'Conflict Arms'.
    Maybe we could collaborate on a project server like this in the future if more interest is garnered.
    It is essentially like Planetside 2 except in Empyrion, it would be really fun to have a dedicated server to log into a persistent ranked player-character and an ever going FPS-style fire fight going on. Mine is based around infantry fire fights (since those are the most fun) but I suppose vehicles and more planets could inevitably be added for conquering. The nice thing about small scenarios with 1-3 planets is that they will load the fastest with the largest planets, while the servers that go for quantity take long enough to load that some players aren't viably able to play on them. Even worse is updating tons of playfield yaml for every update, so that was why the initial plan was to keep it to one planet of fighting in a centralized area, with the possibility of adding more later.

    I can always host the server again, but, being a residential connection (and for whatever reason any time I host a server), it is prone to power outages due to storms or latency from not being a datacentre host. Kind of irritating, actually -- any time I really wanted to host a game server 24/7 it would get hit with storms that ruin its opening/operating. The cost and lack of access to the files or other features/options of paid hosts (And the fact that it costs) is what makes paying for dedicated hosting a no-go. Why pay for something you can do yourself, for free? Yeah, I suppose it does take the burden off of your hardware and network...but the prices are ridiculous and I'm from the generation that always hosted our own server. This whole pay to host thing is nonsense to me! :)

    If there was a really decent host with decent prices that wasn't over-loaded with junk servers paying for their hardware to be utilized on 0 player servers that are way out of date, never to be played on, then maybe it would be considered a more viable option! Guess I am rambling, so ciao.
     
    #14
  15. Exacute

    Exacute Rear Admiral

    Joined:
    Feb 17, 2017
    Messages:
    456
    Likes Received:
    307
    Note the new patchnotes btw:
    Seemingly you are going to get greater control over scenarios.. I havn't looked into the feature at all, but assumingly it might allow to prevent all blocks of a type and similar..
    "- Added GameScenarioManager (Handles logic for scenario rules such as core placement/destruction)"
    Might be relevant :)
     
    #15
  16. MidareToushirou

    MidareToushirou Lieutenant

    Joined:
    Oct 5, 2017
    Messages:
    58
    Likes Received:
    40
    Yeah I noticed that line, definitely piqued my interest!
    Waiting to see more, I figure I'll mess around with it when I get to it and it can only get better in between now and then.
     
    #16
  17. Kharzette

    Kharzette Ensign

    Joined:
    Sep 20, 2018
    Messages:
    9
    Likes Received:
    0
    I got this in a decently playable state, code here if anyone's curious: https://github.com/Kharzette/ClanWars

    There's a scenario to go with it up on the workshop. I haven't had a large scale test of it yet, just me and a friend running around making sure everything works. I'm sure it will need some tweaks when (if) actual matches happen.
     
    #17

Share This Page