Bonus disappears

Modders can post their questions on scripting and more.

Moderators: Slitherine Core, BA Moderators

Post Reply
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

Bonus disappears

Post by enric »

Probably is a misunderstanding mine but, if a bonus is added dynamically:

AddBonus(0, "RALLY");
or
AddBonus(1, "STUKA");

In SP the bonus stand until you use it, but in MP it appear the turn added, but, if not used, next turn has disappeared, is this a normal behavior?

The same bonus work fine if added to the scenario using the editor.
pipfromslitherine
Site Admin
Site Admin
Posts: 9923
Joined: Wed Mar 23, 2005 10:35 pm

Re: Bonus disappears

Post by pipfromslitherine »

I will need to look at the specific implementation and see what the expected behaviour is.

Cheers

Pip
follow me on Twitter here
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

Re: Bonus disappears

Post by enric »

What do you mean?, you need more info on how is implemented?

Imagine, you want just to add a "Rally" bonus in turn X

in Startturn

if (GetTurn() == X)
{
// activate Bonus for side 0
AddBonus(0, "RALLY");
}

In SP the bonus is added, and if you don't use in X turn you may use it in next turn, then the delay of the bonus and use it again.
In MP it appear the turn added (with a delay) but next turn has disappeared.

Example
in turn 2
Screen Shot 2015-03-08 at 0.52.45.jpg
Screen Shot 2015-03-08 at 0.52.45.jpg (56.68 KiB) Viewed 3296 times
next turn
Screen Shot 2015-03-08 at 0.55.19.jpg
Screen Shot 2015-03-08 at 0.55.19.jpg (72.19 KiB) Viewed 3296 times
pipfromslitherine
Site Admin
Site Admin
Posts: 9923
Joined: Wed Mar 23, 2005 10:35 pm

Re: Bonus disappears

Post by pipfromslitherine »

No - I mean that I didn't implement the AddBonus function and so I will need to dig deeper to see what it is doing and what it is supposed to do :)

Cheers

Pip
follow me on Twitter here
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

Re: Bonus disappears

Post by enric »

ah, sorry, as not native english sometimes (too often :oops: ) I misunderstand the meaning.

I used the function with the only info available now:

//grant the named bonus to the side
AddBonus(side, bonusName);


I did not found any case of use in scenarios that come with BA2, the only place where is used is
MAPGENERATE.BSF
pipfromslitherine
Site Admin
Site Admin
Posts: 9923
Joined: Wed Mar 23, 2005 10:35 pm

Re: Bonus disappears

Post by pipfromslitherine »

It is possible that it is only intended for use pre-battle, but I will need to look at the code.

Cheers

Pip
follow me on Twitter here
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

Re: Bonus disappears

Post by enric »

pipfromslitherine wrote:It is possible that it is only intended for use pre-battle, but I will need to look at the code.

Cheers

Pip
The odd think is that in SP it works normal, and the same scenario in MP don't.
pipfromslitherine
Site Admin
Site Admin
Posts: 9923
Joined: Wed Mar 23, 2005 10:35 pm

Re: Bonus disappears

Post by pipfromslitherine »

I think that in SP it will stop working if you try and save and then reload. The command is only intended to be used in the generation scripts for skirmish games - skirmish games do a 'save' of the map into their save game and this is what stores the bonus state. Using the command during a battle adds the bonus at that point, but there is nothing to tell the game to reload it at a later point when the game is loaded from a save (as happens in MP effectively).

Sorry - but it won't do what I think you are attempting.

Cheers

Pip
follow me on Twitter here
jcb989
Colonel - Fallschirmjäger
Colonel - Fallschirmjäger
Posts: 1423
Joined: Fri Nov 05, 2010 12:02 am
Location: Bradenton, Florida

Re: Bonus disappears

Post by jcb989 »

Enric, could you not "force it to work the hard way" but toggling a bit, then assign the bonus (each turn) based on if the bit = 1 ?
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

Re: Bonus disappears

Post by enric »

jcb989 wrote:Enric, could you not "force it to work the hard way" but toggling a bit, then assign the bonus (each turn) based on if the bit = 1 ?
Could you be more explicit? :D

In fact the bonus are working fine for me, I was just looking for a more elegant implementation way.
Now I add the bonus using the editor ( even a bonus modded or new) and with code I control the status "not available", "ready", "loading" , etc. (look for example Channels).
Even so, I'm still interested on the "bit=1".
Post Reply

Return to “Battle Academy 2: Modders Corner”