a question about gravity coef : another one ;)

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

Post Reply
BusardCendre
Posts: 174
Joined: 30 May 2013, 09:40

a question about gravity coef : another one ;)

Post by BusardCendre »

Hi all,

as we really have a lot of time to spend actually, I've decided to write some code !

I've understood how to play with gravity, control and accel coefs, and it works fine.
but I'm stucked at a point :

I can't change these coefs once the round has started,
well, in fact, I can change the values, and if I read them, they have changed, but it seems that these modifications doesn't work ...

As I'm not sure to be understandable, :oops: , here's an exemple :
Let's say that, at the start of the map, gravity is 0.1 and accel is 1.
If I trry to make to invert these values (gravity 1. and accel 0.1) at a checkpoint, then the car will still accelerate a lot and fly too much ...

First, I thought that once the round has started, I can't change these coefs, but as some block can now do the same thing, I don't think that the problem is there.
Here's a piece of code, am I doing something wrong ?

Code: Select all

#S_GraviyCoef = 0.1
#S_AccelCoef = 1.

***Match_InitRound***
***
foreach (Player in Players) {
	SetDefaultCoefs(Player);
}
***


***Match_PlayLoop***
***
foreach (Event in PendingEvents) {
	if (Event.Type == CTmModeEvent::EType::WayPoint) {
		SetNewCoefs(Event.Player);
		// this won't work either :
		// Event.Player.Gravity = 1.;
		// Event.Player.Accel = 0.1;
	}
}
***

// --------------- //
//  Functions
// --------------- //

Void SetDefaultCoefs (CTmPlayer _Player) {
	_Player.GravityCoef = S_GravityCoef;
	_Player.AccelCoef = S_AccelCoef ;	
	
	UIManager.UIAll.SendChat(TextLib::Compose("Default coefs set : Gravity: %1, Accel: %2", TextLib::ToText(_Player.GravityCoef), TextLib::ToText(Player.AccelCoef)));
}

Void SetNewCoefs(CTmPlayer _Player) {
	_Player.Gravity = 1.;
	_Player.Accel= 0.1;
	
	UIManager.UIAll.SendChat(TextLib::Compose("New coefs set for player %1 : Gravity: %2, Accel: %3",_Player.User.Login TextLib::ToText(_Player.GravityCoef), TextLib::ToText(Player.AccelCoef)));
}
This will give me two message ingame :
At the begining of the round : Default coefs set : Gravity: 0.1, Accel: 1
When I reach a checkpoint : New coefs set for player viok_buse : Gravity: 1, Accel: 0.1

My prob is that even if the values changed, the car still have the same behaviour before and after the first checkpoint ...

So, can't I change the values during the round ? or Have I made a mistake in my code ?
Any other ideas ?

Thanks a lot for your responses =)
Image

CPU : AMD FX-4170 (4 CPUs, ~4.2 GHz)
GPU : Sapphire Radeon HD 7850, 2 Go , DX 11
RAM : 8 Go DDR3
Win 7 Ultimate x64
benj9029
Posts: 39
Joined: 17 Jul 2018, 10:31

Re: a question about gravity coef : another one ;)

Post by benj9029 »

Yeah that's a thing, coef gotta have a respawn I guess which is really really sad.
Discord: MosKi#4531
Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 0 guests