OBJECTS.BSF file

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

OBJECTS.BSF file

Post by enric »

I'm trying the object reaction and I always getting the "else" result.
Who/what changes the "check" parameter?
When a unit walk over the tile the Log returns: else: 0.

And the <ret> value who receives this?

FUNCTION EnterMine( tilex, tiley, unit, objectid, objectx, objecty, check, user)
{

int ret ;

// is the object on our tile?
if( tilex == objectx && tiley == objecty )
{
if( check == 1 )
{
// return a high score - we always react
ret = 1000 ;
Log ("if", ret);
}
else
{
Log ("else", ret);
}
}

return ret ;
}
pipfromslitherine
Site Admin
Site Admin
Posts: 9928
Joined: Wed Mar 23, 2005 10:35 pm

Re: OBJECTS.BSF file

Post by pipfromslitherine »

It's all in the documentation at http://www.slitherinebravo.net/GameWiki ... user_value or are you saying that that isn't clear?

Cheers

Pip
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: OBJECTS.BSF file

Post by enric »

are you saying that that isn't clear?
Sure.
pipfromslitherine
Site Admin
Site Admin
Posts: 9928
Joined: Wed Mar 23, 2005 10:35 pm

Re: OBJECTS.BSF file

Post by pipfromslitherine »

I'm not sure which part isn't clear, but I have added some more text to make it clear that the check parameter is set by the game (although ALL the parameters are set by the game).

If check is 1 then the function is being called to discover whether the object should react to the moving unit (returning > -1 if it wants to). If the function returns > -1 then it is placed in the reaction queue based on its returned score, and if the object is required to react, then the function is called a second time, this time with a check value of 0.

Hmmm - in terms of this situation, it looks like it should work, and so in checking through the code I spotted a typo bug, which means when the function is actually called, check will be some non-zero value (it will actually be the y tile of the object, but that will change).

So switch the check to check > 0 and it should work fine. I will update the docs to reflect the change in values.

Cheers

Pip
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: OBJECTS.BSF file

Post by enric »

Now, using != 0 it's seem to work.

One of the things it also confuse me is that BA don't seem to reload the script OBJECTS easily, even after closing the scenario, and the campaign.
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: OBJECTS.BSF file

Post by enric »

Now I'm sure, you must quit BA to force the reload of any change made in the OBJECT.BSF file.
So for any change you need to make you must quit BA and reload BA, Campaign, Scenario.....
pipfromslitherine
Site Admin
Site Admin
Posts: 9928
Joined: Wed Mar 23, 2005 10:35 pm

Re: OBJECTS.BSF file

Post by pipfromslitherine »

Hmmm. I will take a look. It is definitely simpler to iterate (esp with the new continue on error) if you can just restart the mission, though I will have to check as the objects are loaded at the campaign level.

Just to note - this check issue won't be fixed in 2.0.7 (as this is already in with Apple and I don't want different behaviours for the iPad and desktop versions) but will be in the update after that.

Cheers

Pip
Post Reply

Return to “Battle Academy : Modders Corner ”