GetTileObject

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

GetTileObject

Post by enric »

With the 206, I found that a scenario we are testing do not work anymore.

I'm not sure, but I think it could be a issue in the objects index , or in the object data.

In a tile there are several objects, a loop try to find the target object.
For (i = 0; i < 99; i+)
{
id = GetTileObject…
if (id != -1)
then check if it's the searched object:

IsObjectName(id, "object")==1)

and keep the index (i) of the object

SetGlobal ("trap_index", i);

Later in another function…

id = GetTileObject(tilex, tiley, GetGlobal("trap_index")

The routine adds a value to the data object, etc., … this was working, but beginning with 206 the data was reset every turn. As I don't know a way to see values debugging in MP ( Log() don't work? ), I could not test efficiency. Probably the object (i) was not the same???.

I'm not sure of which is the problem. But if the tile has only a object, the target one, then it always works.

For the scenario I found a turnaround: I don't use the Global that keep the object index, and I search for the object again in the other functions, and now seems to work, so probably is not a object data issue.

Some adds to the debugger will be welcome :) .
pipfromslitherine
Site Admin
Site Admin
Posts: 9928
Joined: Wed Mar 23, 2005 10:35 pm

Re: GetTileObject

Post by pipfromslitherine »

Hmmm. I will take a look at it. I can't think what would have changed to affect it. Are you sure you are looking at the correct tile both times? And also, that you are not removing any objects from the tile?

For debugging, you could try running the campaign in single player mode (just make a copy in your CAMPAIGNS folder, rather than the MP folder) and get more info, or add some output to the screen via DrawScenarioUI.

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: GetTileObject

Post by enric »

pipfromslitherine wrote:
For debugging, you could try running the campaign in single player mode (just make a copy in your CAMPAIGNS folder, rather than the MP folder) and get more info, or add some output to the screen via DrawScenarioUI.

Cheers

Pip
Yes, I always work in single mode before, and when it works there I copy to MP.
Post Reply

Return to “Battle Academy : Modders Corner ”