A few general design questions

Download scenarios and talk about scenario design.

Moderators: Slitherine Core, BA Moderators

insidius
Sergeant - Panzer IIC
Sergeant - Panzer IIC
Posts: 195
Joined: Sun Aug 08, 2010 9:49 pm

Post by insidius »

Some more questions I can't seem to find the answer to on my own:

I'm testing in hotseat right now, and when I win with the US (and assuming its the same way for Axis), it says Objective complete, then when I take the axis turn it says Objective complete as well, instead of saying something like 'you lose' or whatever.

What lines of script do I need to plug in to get the scenario to recognize that the Germans lost the game, not won it?

Also, my game freezes when I try to surrender my custom scenario. Do I need a script to allow for that, too?

And in my MP scenario, I've noticed that when playing as the Germans (once again, in hotseat mode), I can't see any of the objective flags onscreen. Any idea why?

Thanks!
pipfromslitherine
Site Admin
Site Admin
Posts: 9925
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

- the hotseat mode at the moment always says you win, as you're playing yourself. I'm trying to work out a fix.

- I'll have the check out the logic - in theory it should be fine, but obviously not. We've not done any testing of scripted MP missions, esp in hotseat.

- Depends where you copied the code from. The 6th parameter (if set) denotes that only that side can see it.

Hope that helps

Pip
insidius
Sergeant - Panzer IIC
Sergeant - Panzer IIC
Posts: 195
Joined: Sun Aug 08, 2010 9:49 pm

Post by insidius »

pipfromslitherine wrote:- the hotseat mode at the moment always says you win, as you're playing yourself. I'm trying to work out a fix.

- I'll have the check out the logic - in theory it should be fine, but obviously not. We've not done any testing of scripted MP missions, esp in hotseat.

- Depends where you copied the code from. The 6th parameter (if set) denotes that only that side can see it.

Hope that helps

Pip
You mean the 6th parameter in the template.BSF?

This?

Code: Select all

// do we want a victory point?
		// set the the target coordinates if we do, leave as -1 if not
		SetGlobal("gVPX", -1) ;
		SetGlobal("gVPY", -1) ;
		
		// show a flag?
		if( GetGlobal("gVPX") != -1 )
		{
			ShowEffectMarker( -1, GetGlobal("gVPX"), GetGlobal("gVPY"), "us_victory_marker", 0) ;
		}
pipfromslitherine
Site Admin
Site Admin
Posts: 9925
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

Correct - simply omit that parameter and both sides will see it.

Hmmm - I guess we don't reference the autodocs in the engine text. In My Documents\My Games\BBCBA\Autodocs you'll find battlescript.txt, which has details on all the available script commands. I'll try and update the docs - so much to do!

Cheers

Pip
insidius
Sergeant - Panzer IIC
Sergeant - Panzer IIC
Posts: 195
Joined: Sun Aug 08, 2010 9:49 pm

Post by insidius »

Here's what I've got before any omissions:

Code: Select all

include "Functions.BSF"
// called at the start of every turn.
// You would tend to use this for events
FUNCTION StartTurn(side)
{
int i ;
int x ;
int y ;
int id ;
int playerCount ;

if (GetTurn() == -1 )
{
// Setup VPs, damaged tiled, ...
PreBattleSetup() ;
}
else
{
// Check if any victory conditions are met
VictoryConditions() ;
}

if(side == 1)
{
}

if(side == 0)
{
}

}


FUNCTION PreBattleSetup()
{

//For instance, play with the us (1) and german (4) sides
SetGlobal("gNation0", 1) ;
SetGlobal("gNation1", 4) ;


//You can add as many vp you want, max 9;vp2 and vp3 held by enemy(side 1), vp1 by you (side 0)
SetGlobal("vp1", 0) ;
SetGlobal("vp2", 1) ;
SetGlobal("vp3", 1) ;
SetGlobal("vp4", 1) ;

//Here we place the flags and the text in the vp
//x1,x2,x3 are the coordinates
//you must add to the text1 file these lines:
//IDS_LOC_German_Base, "GERMAN BASE",
//IDS_LOC_US_Base, "US BASE",
//changing the names and the content at will
ShowTextMarker(1, 40, 33, "IDS_LOC_SOUTH_FARM", 8, "FFFFFF", 1);
ShowTextMarker(2, 31, 37, "IDS_LOC_CATHEDRAL", 8, "FFFFFF", 1);
ShowTextMarker(3, 32, 25, "IDS_LOC_BRIDGE", 8, "FFFFFF", 1);
ShowTextMarker(4, 21, 38, "IDS_LOC_NORTH_FARM", 8, "FFFFFF", 1);



// Amount of VPs held by player:
SetGlobal("vps", 1) ;
}


FUNCTION VictoryConditions()
{
int i ;
int j ;
int id ;
int counter ;

if (GetGlobal("vps") == 4)
{
EndBattle(0) ;
}


if (GetGlobal("vps") == 0)
{
EndBattle(1) ;
}


}


// called every game tick.
// You would tend to use this for reactive logic and
// win situations etc
// x1,x2,x3 are the coordinates of vp
FUNCTION Tick(side)
{
CheckVP(-1, GetGlobal("vp1"), 40, 33) ;
CheckVP(-2, GetGlobal("vp2"), 31, 37) ;
CheckVP(-3, GetGlobal("vp3"), 32, 25) ;
CheckVP(-4, GetGlobal("vp4"), 21, 38) ;

} 


What are you saying I've got to omit? Sorry, I'm confused.
adherbal
The Artistocrats
The Artistocrats
Posts: 3900
Joined: Fri Jun 24, 2005 6:42 pm
Location: Belgium

Post by adherbal »

looks like you'll have to make a local copy of Functions.BSF for that and edit all the effect marker commands in the CheckVP function

[edited because of nonsense]

I wasn't aware of this either, so we (I) will probably edit the base Functions script in a future update if we're ever fully supporting scripted MP games.
Last edited by adherbal on Wed Aug 18, 2010 7:56 pm, edited 1 time in total.
insidius
Sergeant - Panzer IIC
Sergeant - Panzer IIC
Posts: 195
Joined: Sun Aug 08, 2010 9:49 pm

Post by insidius »

Editing the local copy of Functions.BSF didn't work either; it just made it so the US side can't see the US flag either and the Germans can't see their own flag, the US side's flags, OR any text displayed on the map.

Oi, maybe I should just give up and stop pestering you guys with questions. I'm sure you have better things to do.
adherbal
The Artistocrats
The Artistocrats
Posts: 3900
Joined: Fri Jun 24, 2005 6:42 pm
Location: Belgium

Post by adherbal »

Hm wait, I pasted an example from an old version of the Functions script. Ignore what I said entirely.

Battlescript auto doc says:

//show anim at center of tile xy. id is a user handle to allow for turning off etc-must NOT be zero. Use a negative id to loop the effect. sidemask=optional [0,1] only that side can see. Set MinimapColourString to non-zero to show
ShowEffectMarker(id, x, y, animFile, effect, [showside], [MinimapColourString])

So a question to Pip: If you want to use the MinimapColourString but not the showside - what to do?

EDIT: I guess using double effect markers should work, one for each side.
pipfromslitherine
Site Admin
Site Admin
Posts: 9925
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

I think there is some cross-communication happening. The Template version (which seems to be what Ins posted) actually omits the side value already, so it should show up for both sides already. I will test it out to make sure it does so.

Cheers

Pip
insidius
Sergeant - Panzer IIC
Sergeant - Panzer IIC
Posts: 195
Joined: Sun Aug 08, 2010 9:49 pm

Post by insidius »

Is it possible that I can't see things from the Axis side because I'm testing this in hotseat mode?
pipfromslitherine
Site Admin
Site Admin
Posts: 9925
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

I just tested a hotseat battle I built from the template and it showed the marker fine for both side's turns.

If you're using the stuff from the Functions.BSF file (which a lot of the campaigns use) then you'll need to copy that file into the scenarios directory, and then remove the showside parameter from ShowEffectMarker, which I would imagine is set to 0.

Again, the marker code in the Template doesn't set a side, as there are only 5 parameters in the function call.

Let me know how you get on.

Cheers

Pip
insidius
Sergeant - Panzer IIC
Sergeant - Panzer IIC
Posts: 195
Joined: Sun Aug 08, 2010 9:49 pm

Post by insidius »

What I posted above is the entirety of my Scenario's .BSF file. I have the whole Functions.BSF file in my scenarios directory as well, though I'm not sure where I pulled the Functions.BSF file from - probably the campaign somewhere.

I'll look at what you suggested again. Thank you.
Last edited by insidius on Wed Aug 18, 2010 9:14 pm, edited 1 time in total.
insidius
Sergeant - Panzer IIC
Sergeant - Panzer IIC
Posts: 195
Joined: Sun Aug 08, 2010 9:49 pm

Post by insidius »

Where can I find out what things like "gVPX" and "gVPY" are and what they are defined as? Are they documented somewhere? It seems like they're coordinates, but I'm not entirely sure how I'm supposed to be using them.

EDIT: If you could post an example of what you had as your ShowEffectMarker when you got it to work, it would help immensely.
pipfromslitherine
Site Admin
Site Admin
Posts: 9925
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

They are just globals I define in the Template script. They are indeed the X and Y ordinates for the flag to show at. The comments in the Template BSF should explain how they are used.

But you are using the Functions.BSF functions to deal with VPs? In which case you need to:

+ copy functions.BSF from DATA\SCRIPTS to your scenarios directory
+ open your copy and search for ShowEffectMarker
+ change the second 0 in each call to be -1

That should show the markers for both sides.

Cheers

Pip
insidius
Sergeant - Panzer IIC
Sergeant - Panzer IIC
Posts: 195
Joined: Sun Aug 08, 2010 9:49 pm

Post by insidius »

Alright, I think that finally did the trick. Thank you once again. I just changed the 2nd 0's to -1's.

Is it the same with ShowTextMarker? It seems to work differently. I can see text on the map as Allies, but not Axis.

Code: Select all

ShowTextMarker(1, 40, 33, "IDS_LOC_SOUTH_FARM", 8, "FFFFFF", 1);
ShowTextMarker(2, 31, 37, "IDS_LOC_CATHEDRAL", 8, "FFFFFF", 1);
ShowTextMarker(3, 32, 25, "IDS_LOC_BRIDGE", 8, "FFFFFF", 1);
ShowTextMarker(4, 21, 38, "IDS_LOC_NORTH_FARM", 8, "FFFFFF", 1);
pipfromslitherine
Site Admin
Site Admin
Posts: 9925
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

ShowTextMarker doesn't have the same functionality. But it does have a control to show whether it is hidden by FOW or not. That might be what is happening?

Check out the battlescript.txt doc for how to tweak the flag value.

Cheers

Pip
insidius
Sergeant - Panzer IIC
Sergeant - Panzer IIC
Posts: 195
Joined: Sun Aug 08, 2010 9:49 pm

Post by insidius »

pipfromslitherine wrote:ShowTextMarker doesn't have the same functionality. But it does have a control to show whether it is hidden by FOW or not. That might be what is happening?

Check out the battlescript.txt doc for how to tweak the flag value.

Cheers

Pip
I've checked and double checked. I have the flag set to 1 so it's supposed to display all the time, but it only shows in hotseat for the Allied side (presumably side 0), but not for the Axis side (side 1).
pipfromslitherine
Site Admin
Site Admin
Posts: 9925
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

I think we may have found a bug. I don't think that text markers get saved out, and so when you get to a turn other than the first one, the marker doesn't get shown. So unlike the markers, you can't fire and forget them in the first turn. I assume that either the campaign scripts replace them each turn, or else they vanish if you try and load a savegame...

So the solution is that you should just remove and replace them pretty much all the time - removing them before they are set up won't cause any issues. I will need to look at making them get saved out nicely.

Cheers

Pip
insidius
Sergeant - Panzer IIC
Sergeant - Panzer IIC
Posts: 195
Joined: Sun Aug 08, 2010 9:49 pm

Post by insidius »

Ooh, a bug. Well at least something good came from my interrogation of you and the staff.

Is it somehow possible to put the ShowEffectMarker command under the 'each tick' section to get it to display every turn?

I'm not even sure what you mean by removing and replacing them all the time; I'm hoping to create this scenario as a Multiplayer game that others can enjoy, but if they can't see the objectives, it's a no go! :( lol
pipfromslitherine
Site Admin
Site Admin
Posts: 9925
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

Putting it per tick is fine. Just call RemoveTextMarker and then call ShowTextMarker. This will prevent all the markers building up as you add them. It's not a problem to remove the marker before you add it. Just remember to use the same IDs for the remove/show pairs.

Cheers

Pip
Post Reply

Return to “Battle Academy : Scenario Design”