bakkesmodorg / BakkesModSDK

The current BakkesModSDK (Unofficial SDK for Rocket League)
http://bakkesmod.com
223 stars 49 forks source link

Changing boost amounth #3

Closed casper2002casper closed 3 years ago

casper2002casper commented 7 years ago

Is there a way to change the amounth of boost a player has? I'm trying to write a plugin to determine the fastest way to kickoff using a evolutionary genetic algorithm. But I can't find a way to reset the boost to 34 after a kickoff.

Bakkes commented 7 years ago

Yes, this is possible. First you have to make sure the game event has unlimited boost disabled. Then you have to disable unlimited boost on the local car. After this you can set the boost amount.

Something like this should work:

TutorialWrapper tutorial = gwi->GetGameEventAsTutorial();
BoostWrapper boost = tutorial.GetGameCar().GetBoost();

tutorial.SetUnlimitedBoost(false);
boost.SetUnlimitedBoost(false);

boost.SetBoostAmount(34);
casper2002casper commented 7 years ago

Ah thank you, I didn't realise there was a boostwrapper. EDIT: It seems like when you set unlimitedboost to false more than once it becomes enabled again.

casper2002casper commented 7 years ago

Is there any documentation on how to use SetInput? Like does it only use that input for one frame or untill there is given a new one?

Bakkes commented 7 years ago

The setinput in the wrapper is currently not working, because it requires a very specific timing for it to be set in order for it to work.

If you want to take control of the input of the car you should create a botplugin. I've created a simple one for you to check out here. Make sure your class extends bakkesmod::plugin::BotPlugin and your declaration contains PLUGINTYPE_BOTAI, like so BAKKESMOD_PLUGIN(SimpleAI, "SimpleAI", "0.1", PLUGINTYPE_BOTAI)

Now implement the on_tick method and within this method you can modify the input like you want it to be. Just change the values in ControllerInput * input and it should automatically be applied to the car every frame.

Hope this helps.

casper2002casper commented 7 years ago

Thank you for all your help. I now only have the problem that PLUGINTYPE_BOTAI isn't defined, I had the same problem when I used PLUGINTYPE_FREEPLAY so I used to just set it to 0, but I don't know the interger value for PLUGINTYPE_BOTAI.

Bakkes commented 7 years ago

Ah my bad, I forgot to update the bakkesmodplugin.h file. The values are


const unsigned char PLUGINTYPE_FREEPLAY = 0x01;
const unsigned char PLUGINTYPE_CUSTOM_TRAINING = 0x02;
const unsigned char PLUGINTYPE_SPECTATOR = 0x04;
const unsigned char PLUGINTYPE_BOTAI = 0x08;
const unsigned char PLUGINTYPE_REPLAY = 0x10;
const unsigned char PLUGINTYPE_THREADED = 0x20;

So you have to use 0x08. They should be included in the next update.

Bakkes commented 7 years ago

I've pushed the new bakkesmodplugin.h file, please replace this one with the one you're using now and it should all be working. See 19b4bb6ecb876b629c71befdbbe89db88321d564