Page 2 of 2

Posted: Sat Aug 21, 2010 10:24 pm
by adherbal
I've uploaded a slightly simplified/extended version of the script in the first post in DOC format, using colours to make it easier to read and manipulate.

It allows you to place up to 9 victory points, and send AI teams to specific points at specific turns. The Victory condition is set to: "capture X victory points"

WARNING: I did some changes to this original script but didn't test them. So there's no 100% guarantee this is bug free at the moment. I'll test it asap, unless someone else beats me to it.

All comments are in green
All values that you should be editing are in bold blue

I suggest everyone to read through the entire script (only 2 pages) but if you are really lazy you can stick to reading only the paragraphs that have blue values :wink: These are the values you must edit to alter things like VP coordinates, the turns at which the AI teams attack etc.

So to use it in your scenario, edit the blue values according to your needs, select the entire script and paste it in a simple empty TXT file. Rename that TXT file to (whatever-the-filename-of-your-scenario-is).BSF and place that in the same folder as your scenario, than restart your scenario to use the script.

download here

Posted: Sun Aug 22, 2010 12:01 am
by Merr
thanks adherbal!

A quick glance at it and I already have ideas about ai behavior .... adding randomness to the routes.

Posted: Sun Aug 22, 2010 12:21 am
by adherbal
Yep, that should be quite easy to do with "point = Rand(x, y)". note that x, y is a whole range. So Rand(1, 3) may return 1, 2 or 3, not just 1 or 3.

A little tip: AI points (placed in the editor) and VPs are not related. But it is easiest if you place AI point 1 on the same coordinates you use to define "vp1" in the script, AI point 2 on "vp2" coordinates, etc. Generally you won't use more than 3-4 VPs so you can use the other AI points (and don't forget point 0) on routes the Ai teams can take to get to a VP, or to gather for an outflank attack, or a defensive position in front of a VP etc.

Posted: Sun Aug 22, 2010 2:16 am
by ostwind
pipfromslitherine wrote:Gah - well done! You found a bug. A missing ! means that you could never correctly over-ride animations.

A solution for now would be to just rename the file to something that isn't used, and then it should show up. It doesn't have to be named the same as some existing one.

Cheers

Pip
Well, I've been testing renaming the sf4 as "cone", and calling it with ShowEffectMarker(-1, 17, 16, "cone", 0)...with no luck.
If I delete the anim folder, the scenario runs with the original flags, and the only issue is that asks for the "cone" anim (doesn't find the anim folder). If I paste the anim folder, with a sf4 file, the problems begin, even if the new animation is not called in the bsf file.

Working in new scenarios and textures...If we can find a fix for this issue, I promise some fun :wink:

Posted: Sun Aug 22, 2010 8:03 am
by Jugger
:D Love your work adherbal much easier to understand with the colour coding. This may have been asked before, but how do you create a script for the player that results in defeat if the victory points are not captured within say 20 turns? Thanks for your help much appreciated. :?

Posted: Sun Aug 22, 2010 10:43 am
by adherbal
how do you create a script for the player that results in defeat if the victory points are not captured within say 20 turns?
Change the VictoryConditions function to:

Code: Select all

FUNCTION VictoryConditions()
{
	// check if 20 turns have past. Both AI and player turns count as 1 full turn, 
	// so the 20th player turn is actualy turn 40. Always multiply it by 2.
	if ( GetTurn() == 40 )
	{
		// Declare victory when player has captured 2 or more VPs
		if ( GetGlobal("vps") >= 2 )
		{
			// Declare victory for side 0
			EndBattle(0);
		}
		else // if not:
		{
			// Declare victory for side 1 = defeat for player
			EndBattle(1);
		}
	}
}

Posted: Fri Oct 01, 2010 4:24 am
by junk2drive
adherbal wrote:
Someone should write a script that awards points for holding a VP each turn and when a certain number of points has been awarded, that side wins the scenario.
That should be something like:

Code: Select all

FUNCTION VictoryConditions()
{
   // Give points to side 0 and 1
   // Note: change the "2" to the amount of VPs you have placed
   SetGlobal("points0", GetGlobal("points0") + GetGlobal("vps") ) ;
   SetGlobal("points1", GetGlobal("points1") + 2 - GetGlobal("vps") )

   // Declare victory when certain amount of points reached (10 in this example)
   if ( GetGlobal("points0") >= 10 )
   {
      // Declare victory for side 0
      EndBattle(0);
   }
   if ( GetGlobal("points1") >= 10 )
   {
      // Declare victory for side 1
      EndBattle(1);
   }
}
What are the points?

Edit
I made a scen with 10 points and 2 flags. I took the 2 flags and killed a few enemy and won. I changed to 20 points and won after 2 flags, 9 enemy and 1 friendly killed.

Posted: Fri Oct 01, 2010 11:58 am
by adherbal
Did you read the initial quote in that post?

"a script that awards points for holding a VP each turn and when a certain number of points has been awarded, that side wins the scenario."

So for each turn each side gets 1 point per flag it holds. In this example the side that gets to 10 points first wins. Once you hold them both that's only 5 or less turns so a pretty short limit.

Obviously you should display these "points" globals in the Draw_UI function or it'll be very hard to track how much points each side currently has.

Posted: Fri Oct 01, 2010 12:29 pm
by junk2drive
Of course I must have read it with my eyes and not my brain. Like hearing without listening. Forest and the trees...

A script that awards points had me looking for something with points.

Thanks