Next issue - hiding units

Moderator: rbodleyscott

stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Next issue - hiding units

Post by stockwellpete »

I want to hide the mounted unit in the woods from the player moving second in the game . . .
Screen_00000000.jpg
Screen_00000000.jpg (626.24 KiB) Viewed 1552 times
I know that I have to add this text to the BSF file . . .

FUNCTION PostLOSActions()
{
if(GetTurn()==0)
{
SetAreaLOS(x,y,x2,y2,0,0);
}
}

What is the correct way of doing this? Do I screen off the last 3 rows of squares of the map from the Lancastrian player? Or should I just exclude a smaller area?

For the larger area the co-ordinates are 47,47 and 45,47 at the top of the map and 47,16 and 45,16 at the bottom. So I think the x,y,x2,y2 part should read 45,16,47,47. Is that correct? I cannot remember exactly how the two zeroes after the x,y,x2,y2 sequence work, but I think you have to put a 1 in place one of one of the zeroes to make it work. I have tried all permutations without success. Does the fact that the Lancastrian units are on elevated terrain prevent me from hiding the Yorkist cavalry? Thanks.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28429
Joined: Sun Dec 04, 2005 6:25 pm

Re: Next issue - hiding units

Post by rbodleyscott »

stockwellpete wrote: Sun Jul 10, 2022 9:27 am I want to hide the mounted unit in the woods from the player moving second in the game . . .

Screen_00000000.jpg

I know that I have to add this text to the BSF file . . .

FUNCTION PostLOSActions()
{
if(GetTurn()==0)
{
SetAreaLOS(x,y,x2,y2,0,0);
}
}

What is the correct way of doing this? Do I screen off the last 3 rows of squares of the map from the Lancastrian player? Or should I just exclude a smaller area?

For the larger area the co-ordinates are 47,47 and 45,47 at the top of the map and 47,16 and 45,16 at the bottom. So I think the x,y,x2,y2 part should read 45,16,47,47. Is that correct?
Yes
I cannot remember exactly how the two zeroes after the x,y,x2,y2 sequence work, but I think you have to put a 1 in place one of one of the zeroes to make it work. I have tried all permutations without success.
The parameters are SetAreaLOS(x, y, x2, y2, side, visible)

You want side to be 1 if the Lancastrians are side 1. You want visible to be 0.
Does the fact that the Lancastrian units are on elevated terrain prevent me from hiding the Yorkist cavalry?
It shouldn't.

But I may be missing something, so if you are still stuck, Paul may be able to enlighten you, as he has used this technique in several scenarios.
Richard Bodley Scott

Image
Paul59
General - King Tiger
General - King Tiger
Posts: 3864
Joined: Tue Jul 21, 2015 11:26 pm

Re: Next issue - hiding units

Post by Paul59 »

The script merely turns on the normal LOS rules for the area chosen. So if the unit would be visible in turn 2 onwards, it will still be visible in turn 1.

Probably the unit is not far enough into the woods to be hidden. So try adding some more woods tiles, or move the unit back.
Field of Glory II Scenario Designer - Age of Belisarius, Rise of Persia, Wolves at the Gate and Swifter than Eagles.

Field of Glory II Medieval Scenario Designer.

FOGII TT Mod Creator

Warhammer 40,000: Sanctus Reach Tournament Scenario Designer.
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: Next issue - hiding units

Post by stockwellpete »

Paul59 wrote: Mon Jul 11, 2022 8:17 am The script merely turns on the normal LOS rules for the area chosen. So if the unit would be visible in turn 2 onwards, it will still be visible in turn 1.

Probably the unit is not far enough into the woods to be hidden. So try adding some more woods tiles, or move the unit back.
OK thanks. I'll have a look in a minute. The other issue might be the way I have constructed the woods. I have used the "Woods" terrain for the base, but instead of using the "Forest" option I have constructed the woods by using individual "Trees" from the Editor. Just for aesthetic reasons really. I am not sure if that is an issue or not.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28429
Joined: Sun Dec 04, 2005 6:25 pm

Re: Next issue - hiding units

Post by rbodleyscott »

stockwellpete wrote: Mon Jul 11, 2022 9:39 am
Paul59 wrote: Mon Jul 11, 2022 8:17 am The script merely turns on the normal LOS rules for the area chosen. So if the unit would be visible in turn 2 onwards, it will still be visible in turn 1.

Probably the unit is not far enough into the woods to be hidden. So try adding some more woods tiles, or move the unit back.
OK thanks. I'll have a look in a minute. The other issue might be the way I have constructed the woods. I have used the "Woods" terrain for the base, but instead of using the "Forest" option I have constructed the woods by using individual "Trees" from the Editor. Just for aesthetic reasons really. I am not sure if that is an issue or not.
Yes it is. It is the Forest object that blocks line of sight, not the Woods base tile, and not individual trees.
Richard Bodley Scott

Image
Paul59
General - King Tiger
General - King Tiger
Posts: 3864
Joined: Tue Jul 21, 2015 11:26 pm

Re: Next issue - hiding units

Post by Paul59 »

If you want to preserve the look of your map, you could try placing forest objects on your forest terrain tiles, but reduce them in size so that they are invisible.

You can easily change the size of objects in the Editor by using 2 keyboard keys. It might be the the Page Up and Page Down keys, but I can't check that from the middle of Dartmoor! I know it is definitely 2 keys in that general area of the keyboard, and it might be mentioned in the manual.
Field of Glory II Scenario Designer - Age of Belisarius, Rise of Persia, Wolves at the Gate and Swifter than Eagles.

Field of Glory II Medieval Scenario Designer.

FOGII TT Mod Creator

Warhammer 40,000: Sanctus Reach Tournament Scenario Designer.
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: Next issue - hiding units

Post by stockwellpete »

rbodleyscott wrote: Mon Jul 11, 2022 9:41 am Yes it is. It is the Forest object that blocks line of sight, not the Woods base tile, and not individual trees.
OK thanks. Unit is successfully obscured now.
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: Next issue - hiding units

Post by stockwellpete »

Paul59 wrote: Mon Jul 11, 2022 9:49 am If you want to preserve the look of your map, you could try placing forest objects on your forest terrain tiles, but reduce them in size so that they are invisible.

You can easily change the size of objects in the Editor by using 2 keyboard keys. It might be the the Page Up and Page Down keys, but I can't check that from the middle of Dartmoor! I know it is definitely 2 keys in that general area of the keyboard, and it might be mentioned in the manual.
I cannot see that in the Manual. I have made a note of it and I'll ask again when you are back at home. :wink:
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28429
Joined: Sun Dec 04, 2005 6:25 pm

Re: Next issue - hiding units

Post by rbodleyscott »

stockwellpete wrote: Mon Jul 11, 2022 10:57 am
Paul59 wrote: Mon Jul 11, 2022 9:49 am If you want to preserve the look of your map, you could try placing forest objects on your forest terrain tiles, but reduce them in size so that they are invisible.

You can easily change the size of objects in the Editor by using 2 keyboard keys. It might be the the Page Up and Page Down keys, but I can't check that from the middle of Dartmoor! I know it is definitely 2 keys in that general area of the keyboard, and it might be mentioned in the manual.
I cannot see that in the Manual. I have made a note of it and I'll ask again when you are back at home. :wink:
Probably best not to fiddle about with microscopic objects. It might affect game performance. And if the trees are so sparsely scattered, how is the ambush hiding?
Richard Bodley Scott

Image
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: Next issue - hiding units

Post by stockwellpete »

rbodleyscott wrote: Mon Jul 11, 2022 11:26 am Probably best not to fiddle about with microscopic objects. It might affect game performance. And if the trees are so sparsely scattered, how is the ambush hiding?
OK then. I have used a combination of "Forest" squares and "Trees" squares to quite good effect now, I feel. Also, I have discovered that I can use use "Impassable" and "Trees" to block off potential unwanted flank attacks (as at Blore Heath) in conjunction with "Forest" squares. Makes things a bit more interesting.
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: Next issue - hiding units

Post by stockwellpete »

Another odd thing happening. This is the provisional set-up for Wakefield 1460 . . .

Screen_00000002.jpg
Screen_00000002.jpg (626.51 KiB) Viewed 1454 times

You can see the two flanking, ambushing forces of the Lancastrians in the woods - when I go to Hot Seat I can see these ambushers as the Yorkist player on the first turn. But they disappear on the second Yorkist turn. Do I need to do anything? Or will this be resolved once it becomes an official scenario? Btw Sandal castle is sitting on elevated terrain, but I don't think this is the issue here.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28429
Joined: Sun Dec 04, 2005 6:25 pm

Re: Next issue - hiding units

Post by rbodleyscott »

stockwellpete wrote: Tue Jul 12, 2022 9:16 am Another odd thing happening. This is the provisional set-up for Wakefield 1460 . . .


Screen_00000002.jpg


You can see the two flanking, ambushing forces of the Lancastrians in the woods - when I go to Hot Seat I can see these ambushers as the Yorkist player on the first turn. But they disappear on the second Yorkist turn. Do I need to do anything? Or will this be resolved once it becomes an official scenario? Btw Sandal castle is sitting on elevated terrain, but I don't think this is the issue here.
This is the same issue as we originally thought was the problem with the other one. You need to use the SetAreaLOS() code to make them invisible on the first turn.

In this case I think the visible parameter needs to be 0.

Code: Select all

FUNCTION PostLOSActions()
{
if(GetTurn()==0)
{
SetAreaLOS(x,y,x2,y2,0,0);
}
}
Richard Bodley Scott

Image
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: Next issue - hiding units

Post by stockwellpete »

rbodleyscott wrote: Tue Jul 12, 2022 9:45 am
This is the same issue as we originally thought was the problem with the other one. You need to use the SetAreaLOS() code to make them invisible on the first turn.
Can I hide both groups of ambushers though without hiding the main body of Lancastrian soldiers? I can adjust the scenario if only one group can be hidden.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28429
Joined: Sun Dec 04, 2005 6:25 pm

Re: Next issue - hiding units

Post by rbodleyscott »

stockwellpete wrote: Tue Jul 12, 2022 9:53 am
rbodleyscott wrote: Tue Jul 12, 2022 9:45 am
This is the same issue as we originally thought was the problem with the other one. You need to use the SetAreaLOS() code to make them invisible on the first turn.
Can I hide both groups of ambushers though without hiding the main body of Lancastrian soldiers?
You should be able to. Just call the SetAreaLOS(x,y,x2,y2,0,0) function twice, with different x,y, x2,y2 ranges for each rectangle you want to block out.

Code: Select all

FUNCTION PostLOSActions()
{
if(GetTurn()==0)
{
SetAreaLOS(x,y,x2,y2,0,0);
SetAreaLOS(x,y,x2,y2,0,0);
}
}
Richard Bodley Scott

Image
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: Next issue - hiding units

Post by stockwellpete »

OK thanks. I didn't realise it would read it twice.

Still working on my archery parameters for that script. A couple of questions. Is it possible to prevent units moving and shooting in the same turn? And is it possible to set different maximum ammo limits for "teams" within the same army?
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: Next issue - hiding units

Post by stockwellpete »

It doesn't seem to like me having 2x LOS Functions. The BSF file looks like this now . . .

}

FUNCTION PostLOSActions()
{
if(GetTurn()==0)
{
SetAreaLOS(41,24,47,33,0,0);
}

FUNCTION PostLOSActions()
{
if(GetTurn()==0)
{
SetAreaLOS(16,29,19,37,0,0);
}
}

And I get a Script error relating to the BSF file . . .

Duplicate Function body for FUNCTION Post LOS Actions
Context:FUNCTION<Unknown>
<preprocess>

I took out one of the } after the first FUNCTION Post LOS Actions as I thought 2 of them together, one under the other means "The End". Is that right? With one or two { there, the error message is the same.

The first FUNCTION Post LOS Actions on its own works OK.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28429
Joined: Sun Dec 04, 2005 6:25 pm

Re: Next issue - hiding units

Post by rbodleyscott »

stockwellpete wrote: Tue Jul 12, 2022 12:06 pm It doesn't seem to like me having 2x LOS Functions.


It wouldn't. You only need one PostLOSActions() function, with two calls to the SetAreaLOS() function, as I showed above.

Code: Select all

FUNCTION PostLOSActions()
{
if(GetTurn()==0)
{
SetAreaLOS(41,24,47,33,0,0);
SetAreaLOS(16,29,19,37,0,0);
}
}
I took out one of the } after the first FUNCTION Post LOS Actions as I thought 2 of them together, one under the other means "The End". Is that right?
No.
Richard Bodley Scott

Image
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28429
Joined: Sun Dec 04, 2005 6:25 pm

Re: Next issue - hiding units

Post by rbodleyscott »

stockwellpete wrote: Tue Jul 12, 2022 11:07 am Still working on my archery parameters for that script. A couple of questions. Is it possible to prevent units moving and shooting in the same turn?
Only by modding game scripts. (i.e. Not the scenario script)

The risk of doing so is that your scenario may suddenly stop working at all after a game update affecting the vanilla version of that script. (Until you redo the modded script - which isn't a service that I can offer).

So I recommend against it.
And is it possible to set different maximum ammo limits for "teams" within the same army?
Yes. This can be done in the scenario script - Paul has done it in several scenarios.
Richard Bodley Scott

Image
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: Next issue - hiding units

Post by stockwellpete »

rbodleyscott wrote: Tue Jul 12, 2022 12:25 pm
It wouldn't. You only need one PostLOSActions() function, with two calls to the SetAreaLOS() function, as I showed above.
Ah, silly me. I see what you mean. I have corrected it now and it's fine. Thanks.
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14501
Joined: Fri Oct 01, 2010 2:50 pm

Re: Next issue - hiding units

Post by stockwellpete »

rbodleyscott wrote: Tue Jul 12, 2022 12:33 pm
The risk of doing so is that your scenario may suddenly stop working at all after a game update affecting the vanilla version of that script. (Until you redo the modded script - which isn't a service that I can offer).

So I recommend against it.
OK, I suppose the best time to try something like this is when all the DLC's are out and the code is more or less "final".

The other way of approaching this then might be to reduce the lethality of archery fire when a unit has moved or turned. I am not sure what the precise % penalty for shooting when moving or turning is at the moment. I'll set something up in my Training Ground in a minute, but perhaps I could make it almost pointless to move and shoot without actually altering the code itself?
Post Reply

Return to “Field of Glory II: Medieval - Scenario Design”