Monitoring suicide

Discussions about Coding and Scripting
JackGriffin
Godlike
Posts: 3765
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Monitoring suicide

Post by JackGriffin » Sun Dec 10, 2017 5:20 pm

This week I've been working on a checkpoint system especially for MH servers that is completely automatic, requiring no input from the player. It's almost done but I'm stuck on how to clear a checkpoint if they get placed in certain bad situations. For instance if you survive a fall into a deep well you could get your checkpoint updated to there and be stuck.

Ideally I need to monitor for the client when they use a suicide command. The normal way of ScoreKill Killer check won't do because it clears the points if you fall into lava, etc (which is one of the things I need to help). I really wanted to make this client command-less outside of default stuff but I think I'm painted into a corner here. Would love any ideas if you can help.
So long, and thanks for all the fish

User avatar
PrinceOfFunky
Godlike
Posts: 1160
Joined: Mon Aug 31, 2015 10:31 pm

Re: Monitoring suicide

Post by PrinceOfFunky » Sun Dec 10, 2017 5:27 pm

JackGriffin wrote:This week I've been working on a checkpoint system especially for MH servers that is completely automatic, requiring no input from the player. It's almost done but I'm stuck on how to clear a checkpoint if they get placed in certain bad situations. For instance if you survive a fall into a deep well you could get your checkpoint updated to there and be stuck.

Ideally I need to monitor for the client when they use a suicide command. The normal way of ScoreKill Killer check won't do because it clears the points if you fall into lava, etc (which is one of the things I need to help). I really wanted to make this client command-less outside of default stuff but I think I'm painted into a corner here. Would love any ideas if you can help.
If you know what actor should be reached, then you could make some calculation using one of these functions from within Pawn.uc:

Code: Select all

//LineOfSightTo() returns true if any of several points of Other is visible 
// (origin, top, bottom)
native(514) final function bool LineOfSightTo(actor Other); 
// CanSee() similar to line of sight, but also takes into account Pawn's peripheral vision
native(533) final function bool CanSee(actor Other); 
native(518) final function Actor FindPathTo(vector aPoint, optional bool bSinglePath, 
												optional bool bClearPaths);
native(517) final function Actor FindPathToward(actor anActor, optional bool bSinglePath, 
												optional bool bClearPaths);

//Reachable returns what part of direct path from Actor to aPoint is traversable
//using the current locomotion method
native(521) final function bool pointReachable(vector aPoint);
native(520) final function bool actorReachable(actor anActor);
"Your stuff is known to be buggy and unfinished/not properly tested"

JackGriffin
Godlike
Posts: 3765
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Monitoring suicide

Post by JackGriffin » Sun Dec 10, 2017 5:34 pm

Those are good in many situations but I need a pretty foolproof way of clearing any points if the player wants to reset themselves. I've already accounted for being overwhelmed: you can only use a checkpoint once. You must live long enough to spawn another one or you reset to the start. That fixes most of the bad scenarios but with the crazy health that some MH maps give you it's easy to get to the bottom of places like MH-Cliffs and still be alive. In that case the player ends up suiciding to continue as they don't really have another choice. That's really the event I need to catch but I just don't know how without a player subclass. Suicide messages can be personalized so that's out. Grrr, I hate being so close yet so far.
So long, and thanks for all the fish

User avatar
Chamberly
Godlike
Posts: 1963
Joined: Sat Sep 17, 2011 4:32 pm
Personal rank: Dame. Vandora
Location: TN, USA

Re: Monitoring suicide

Post by Chamberly » Sun Dec 10, 2017 5:37 pm

Try a !undoCheckPoint which should take you back to the previous location set? Just an idea.
Image
Image
Image Edit: Why does my sig not work anymore?

JackGriffin
Godlike
Posts: 3765
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Monitoring suicide

Post by JackGriffin » Sun Dec 10, 2017 5:52 pm

JackGriffin wrote:completely automatic, requiring no input from the player
Commands are the downfall of a checkpoint system. If the admin wants it implemented it should be silent and just 'work'. I have Bob's version of SamSpawn on my Unreal server and I love it. You don't do anything, it just silently monitors you and respawns if you need it. It's hugely helpful and requires no new knowledge. This version is very much in line with that thinking. It will have a small marker placed at your last saved checkpoint but it's only visible by you to keep map clutter to a minimum. This is really nice to have for maps that are heavy with BT and you suck at that (:raises hand:).

As it is now I'm removing checkpoints when you respawn so you could suicide twice in a row and reset yourself but I'd like it to be cleaner than that.
So long, and thanks for all the fish

User avatar
PrinceOfFunky
Godlike
Posts: 1160
Joined: Mon Aug 31, 2015 10:31 pm

Re: Monitoring suicide

Post by PrinceOfFunky » Sun Dec 10, 2017 5:58 pm

JackGriffin wrote:Ideally I need to monitor for the client when they use a suicide command. The normal way of ScoreKill Killer check won't do because it clears the points if you fall into lava
You could use the PrevetDeath() callback in Mutator and check if the damage type is 'suicide'.
"Your stuff is known to be buggy and unfinished/not properly tested"

User avatar
Chamberly
Godlike
Posts: 1963
Joined: Sat Sep 17, 2011 4:32 pm
Personal rank: Dame. Vandora
Location: TN, USA

Re: Monitoring suicide

Post by Chamberly » Sun Dec 10, 2017 7:32 pm

I see. Maybe a detector like it notice the player is in a falling physic, if last longer than 5 seconds, movement keys were pressed but no moves were detected from that location, it could set you back some? Another thought.
Image
Image
Image Edit: Why does my sig not work anymore?

User avatar
sektor2111
Godlike
Posts: 5336
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Monitoring suicide

Post by sektor2111 » Sun Dec 10, 2017 10:15 pm

Are you done ? Okay, My turn.
Do this actor normally and owned by player. Player dies, R.I.P. player...
Spawning in bad spot and dying again ? So what "mutate nocheck" to remove that thing for the moment and then allow player to spawn in a normal spot. DONE !
Useful ? Killed by a strong Bad-Ass monster and spawning again nearby for being killed again ? Why do you need this ?

Solution 2 - The clock
Player spawned but died after 5 seconds - this is not a good thing - spot is not safe - remove checker, let player to spawn normally and assign a new checker again or the same checker going disabled for 15 seconds or X time, or configurable time, or... eh, this wine is too good.

Ok, next, carry on...

JackGriffin
Godlike
Posts: 3765
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Monitoring suicide

Post by JackGriffin » Sun Dec 10, 2017 11:29 pm

I think I've settled on number two. It lays down a checkpoint every fifteen seconds but deletes it when you use it. This way if you die within 15 seconds of spawning it will take you back to the playerstart. Checkpoints will not spawn in any sort of damage zone, if you are not in contact with the ground, swimming, ghosting, on a mover, or in or near a teleporter/warpzone. I think I've covered all the bases.

I'm going to server test this over a couple of days. If it's all good I'll post a formal release. This is the first part of the MHBasic gametype I'm working on but there's no reason anyone else can't use this now.
So long, and thanks for all the fish