Spawn on checkpoint or freeze/unfreeze player

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

Post Reply
Alexey85
Posts: 466
Joined: 14 Jul 2012, 10:54

Spawn on checkpoint or freeze/unfreeze player

Post by Alexey85 » 10 Feb 2020, 17:22

I need a short duration of inactivity before or after a player is respawned at a checkpoint. A normal spawn procedure would be good but is it possible to spawn a player at the checkpoint? If not, is it possible to freeze player after a respawn at a checkpoint, then unfreeze?

User avatar
BigBang1112
Posts: 365
Joined: 20 Jul 2015, 12:44
Location: Český Krumlov, Czech Republic
Contact:

Re: Spawn on checkpoint or freeze/unfreeze player

Post by BigBang1112 » 18 Feb 2020, 16:46

Script-defined spawning outside the Start waypoint isn't currently possible.

There's only one solution to this I can think of.
I haven't tested, but you might be able to disable player movement by applying a UI sequence UIInteraction to the player when Respawn event is detected:

Here is my idea:

Code: Select all

foreach(Event in PendingEvents) {
	switch(Event.Type) {
		case CTmModeEvent::EType::Respawn: { // On event respawn to checkpoint (not to start)
			declare Integer Frozen for Event.Player; // Variable will be held by the player
			Frozen = Now; // Frozen variable is basically timestamp when player froze
			UIManager.GetUI(Event.Player).UISequence = CUIConfig::EUISequence::UIInteraction;
		}
	}
}

foreach(Player in Players) {
	declare Integer Frozen for Event.Player;
	if(Frozen != 0) { // If the player is actually frozen, 0 means not being frozen
		if(Now - Frozen >= 5000) { // If the player is frozen for 5 seconds
			Frozen = 0; // Set the player to not be frozen
			UIManager.GetUI(Event.Player).UISequence = CUIConfig::EUISequence::Playing; // Unfreezes the player
		}
	}
}
Hope my a bit late answer helps! :D
Creator and competent racer. YouTube Discord
- Nadeo Envimix (remake coming 2020)
- Videomaker (coming 2020)
- Challenge (OUT NOW)
- Leaderboards (OUT NOW)
- Compute Shadows

Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 0 guests