Is it possible to receive a defeat in a solo player game?

Hi. I’m writing a single-player UEFN game.

To super simplify my game, let’s say it consists of:

  • 1 player
  • 1 coin
  • 1 creature

The objective is this:

  • Player tries to pickup coin
  • Creature tries to eliminate player

If the player picks up the coin: VICTORY
If the creature eliminates the player: DEFEAT

In Verse, I absolutely know 100% of the time when one of the above occurs.

In the case of Victory, I subscribe to the coin pickup event:

# subscribe to coin pickup event
CoinTrigger.TriggeredEvent.Subscribe(OnCoinPickup)

...

# coin pickup event
OnCoinPickup(Agent:?agent):void=
{
    if(ValidAgent := Agent?):
    {
        # VICTORY - player picked up coin
        EndGameDevice.Activate(ValidAgent)
    }
}

In the case of Defeat, I subscribe to the player eliminated event:

# subscribe to player eliminated event
Players := GetPlayspace().GetPlayers()
if( Player := Players[0])
{
    if (FortCharacter := Player.GetFortCharacter[]):
        FortCharacter.EliminatedEvent().Subscribe(OnPlayerEliminated)
}

# player eliminated event
OnPlayerEliminated(Result:elimination_result):void=
{
    # DEFEAT - player eliminated

    # um ... 
    # how do i indicate the player lost ???
    # so the Defeat animation is played instead of the Victory animation ???
}

I’m stuck. In the case of Defeat, how can I make the end game animation show Defeat (not Victory)?

I’m starting to think in a single-player game, there is no defeat?

Or perhaps I’m missing something. :confused:

Any ideas???

1 Like

I guess the answer is no, the Victory / Defeat concept (in regards to end-game animations) only applies when human players are playing against each other. Which obviously requires 2 or more players.

I suppose a plan of action for single-player games would to simply suppress the entire Victory / Defeat end-game animation. Which is a shame, as imo there are scenarios where being able to force a Defeat in a single-player game would be useful.

Or at least these are the conclusions I’ve come to.

Please feel free to correct me if I’m wrong.

I’ve thought about this for a bit after reading this thread. The only thing I could think of is maybe having the island settings setup for teams. Have the Solo player on team 1 and have an NPC (even if you hide it somewhere) and assign it to team two (Since the team must have at least one player or the end game device will throw a fit). Then trigger the end game device, passing the NPC agent as the agent parameter. I’m not confident that would work, but its the only thing I could think of if you wanted to use the native Victory / Defeat mechanic.

Could also just try to match the style of the messages with a HUD message device, and play the sound effect, then have the end game device activate with the original end game messages set to no show.

Great ideas. I’ll give those a shot and see if I can get one of those approaches to work. Thanks!

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