GiveUp as reset to spawn (TM2)

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

Post Reply
User avatar
BigBang1112
Posts: 388
Joined: 20 Jul 2015, 12:44
Location: Czech Republic
Contact:

GiveUp as reset to spawn (TM2)

Post by BigBang1112 »

Hello :shock:
I'm asking again a very simple thing, but I just can't find it ANYWHERE.
Which functions should I use to get GiveUp event work as in TM solo or TimeAttack in custom gamemode?
I looked at Platform mode, TimeAttack mode which got these working, there's almost nothing seen about it.

Can ya help me? Thanks for any answers.
Creator and competent racer. YouTube Discord
- ENVIMIX (out in open-source)
- Challenge (OUT NOW)
- Leaderboards (OUT NOW)
- Compute Shadows
User avatar
Dommy
Translator
Translator
Posts: 1866
Joined: 25 Aug 2011, 21:45
Location: Poland
Contact:

Re: GiveUp as reset to spawn (TM2)

Post by Dommy »

This enumerator defines all kinds of respawn events handling possible:

Code: Select all

CTmMode::ETMRespawnBehaviour {
    Normal,
    DoNothing,
    GiveUpBeforeFirstCheckPoint,
    AlwaysGiveUp
}
To get it working you need to change this variable:

Code: Select all

ETMRespawnBehaviour CTmMode::RespawnBehaviour
Quick summary of all respawn buttons behaviours:
  • Normal - Backspace always fires "Respawn" and Delete always fires "GiveUp" (Rounds mode behaviour, also used for Pursuit)
  • DoNothing - Nothing is fired
  • GiveUpBeforeFirstCheckPoint - Both buttons fire "GiveUp", except that Backspace fires "Respawn" if player crossed at least one checkpoint (TimeAttack mode behaviour)
  • AlwaysGiveUp - Both buttons always fire "GiveUp"
Ryzen 7 2700X, GTX 1070 Ti, 16 GB RAM, Windows 10 Insider Build
FORUM MODERATOR • CREATOR OF SHOOTMANIA GALAXY & TRACKMANIA² PURSUIT

Contact me via GALAXY & PURSUIT DISCORD
User avatar
BigBang1112
Posts: 388
Joined: 20 Jul 2015, 12:44
Location: Czech Republic
Contact:

Re: GiveUp as reset to spawn (TM2)

Post by BigBang1112 »

Well, I didnt mean that exactly,
I already set this variable to AlwaysGiveUp, but how do I get the player to spawn again and not became spectator? :?
Creator and competent racer. YouTube Discord
- ENVIMIX (out in open-source)
- Challenge (OUT NOW)
- Leaderboards (OUT NOW)
- Compute Shadows
User avatar
Dommy
Translator
Translator
Posts: 1866
Joined: 25 Aug 2011, 21:45
Location: Poland
Contact:

Re: GiveUp as reset to spawn (TM2)

Post by Dommy »

Code: Select all

foreach (Player in Players) if (TM2::IsWaiting(Player)) TM2::StartRace(Player);
This will spawn all players that are not spawned yet.
Ryzen 7 2700X, GTX 1070 Ti, 16 GB RAM, Windows 10 Insider Build
FORUM MODERATOR • CREATOR OF SHOOTMANIA GALAXY & TRACKMANIA² PURSUIT

Contact me via GALAXY & PURSUIT DISCORD
User avatar
BigBang1112
Posts: 388
Joined: 20 Jul 2015, 12:44
Location: Czech Republic
Contact:

Re: GiveUp as reset to spawn (TM2)

Post by BigBang1112 »

It kind of works, but the player is frozen with ??? time.
I bet it's some simple function again, but I can't find it anywhere xD
Creator and competent racer. YouTube Discord
- ENVIMIX (out in open-source)
- Challenge (OUT NOW)
- Leaderboards (OUT NOW)
- Compute Shadows
User avatar
Dommy
Translator
Translator
Posts: 1866
Joined: 25 Aug 2011, 21:45
Location: Poland
Contact:

Re: GiveUp as reset to spawn (TM2)

Post by Dommy »

Make sure that you have set this after starting map:

Code: Select all

UIManager.UIAll.UISequence = CUIConfig::EUISequence::Playing;
It might also be a problem in this case:

Code: Select all

Now > CutOffTimeLimit
There shouldn't be problem when you set it to:

Code: Select all

CutOffTimeLimit = -1
Ryzen 7 2700X, GTX 1070 Ti, 16 GB RAM, Windows 10 Insider Build
FORUM MODERATOR • CREATOR OF SHOOTMANIA GALAXY & TRACKMANIA² PURSUIT

Contact me via GALAXY & PURSUIT DISCORD
User avatar
BigBang1112
Posts: 388
Joined: 20 Jul 2015, 12:44
Location: Czech Republic
Contact:

Re: GiveUp as reset to spawn (TM2)

Post by BigBang1112 »

I'm here from the future.
I found the best way to do the respawn technique.

Code: Select all

while(!ServerShutdownRequested) {
  foreach (Player in Players)
    if(PlayersWaiting.exists(Player))
      SpawnPlayer(Player,0,Now + 3000);
}
No need to include any library with this way.
Creator and competent racer. YouTube Discord
- ENVIMIX (out in open-source)
- Challenge (OUT NOW)
- Leaderboards (OUT NOW)
- Compute Shadows
Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 1 guest