Page 1 of 1
FUNCTION Tick(side)
Posted: Wed Oct 24, 2012 2:53 am
by buffpilot
I'm trying to set up a system that will check to see if a unit is on a particular square and if so attack it. Unfortunately I can't seem to get the attack to work. I know the Function Tick works because I put an artillery strike in it and watched the Germans pound a field into ashes...so what am I missing here? This code does not result in an attack.
FUNCTION Tick(side)
{
int zUnitID;
int zBoom;
If(GetUnitOnTile(28,24) >= 0)
{
zBoom = 70;
zUnitID = GetUnitOnTile(28,24);
BonusHEAttack(zUnitID,zBoom,28,24);
}
}
The following DOES result in an attack at the start of each sides turn:
FUNCTION StartTurn(side)
{
int zUnitID;
int zBoom;
int zCheck;
zCheck = GetUnitOnTile(24,24);
If (zCheck >=0)
{
zBoom = Rand(50,200);
zUnitID = GetUnitOnTile(24,24);
BonusHEAttack(zUnitID,zBoom,24,24);
DamageTile(24,24,zBoom);
}
}
Re: FUNCTION Tick(side)
Posted: Wed Oct 24, 2012 2:58 pm
by pipfromslitherine
Try adding a flag to prevent the attack happening every single tick - as it is once a unit ends up on the tile, it will attempt the bombardment every tick, which might be queuing up too many effects.
Cheers
Pip
Re: FUNCTION Tick(side)
Posted: Wed Oct 24, 2012 11:06 pm
by buffpilot
I'll try that, but right now it just doesn't do anything and we cycle to the next turn.
Re: FUNCTION Tick(side)
Posted: Thu Oct 25, 2012 2:44 pm
by pipfromslitherine
I'm getting confused. When do you want the attack to happen - any time during a turn, or just at the start of a new turn?
I would initially suggest adding some Log(... calls to check what is going on. Remember you need to have DEBUGMODE 1 set in your user.txt file to be able to bring up the log window in battle with F6.
Cheers
Pip
Re: FUNCTION Tick(side)
Posted: Fri Oct 26, 2012 4:02 am
by buffpilot
Pip,
I don't know how to use the Debugmode 1 - so I will add it. I would make a change and watch the game - see what happened. Only way I could debug.
What I want to happen is for it to check every tick if a unit is on the square. if so attack it, and then stop any more attacks (with a flag) during that turn. Not a perfect minefield, but it will do. For booby traps it would attack once per game....
Can you build normal arrays in BA script using C++ conventions?
Re: FUNCTION Tick(side)
Posted: Fri Oct 26, 2012 5:06 am
by pipfromslitherine
You can't use arrays in a C style, but there are some scratchpads you can use via the ClearArray and related functions (check the autodocs).
If minefields are what you are after, I would recommend the new object scripting - allows you to set up the object and then use it wherever you like. See the docs here:
http://www.slitherinebravo.net/GameWiki ... user_value
Hope that helps!
Cheers
Pip
Re: FUNCTION Tick(side)
Posted: Sat Oct 27, 2012 4:54 pm
by buffpilot
pip,
Now for dumb question of the day - Where is the DeBugMode1? Where is the user.txt file?
Re: FUNCTION Tick(side)
Posted: Sat Oct 27, 2012 5:43 pm
by pipfromslitherine
In the My Documents/My Games/BBCBA folder. Open the USER.TXT file and just add the line
DEBUGMODE 1
and then save and restart the game.
Cheers
Pip
Re: FUNCTION Tick(side)
Posted: Sat Oct 27, 2012 6:44 pm
by buffpilot
Thanks!