Map Database  •  FAQ  •  RSS  •  Login

PlayerShareFog

<<

Strangelove

User avatar

Crossbowman

Posts: 230

Joined: 30 Jul 2013, 06:32

KaM Skill Level: Fair

Post 05 Oct 2014, 08:28

PlayerShareFog

I have problems with the PlayerShareFog-command. In my example I do have 4 AI Players and a human one. All AI Players are allied. However, after defeating AI Player 1 and 2 I want to ally AI Player 4 to the human player (player 0). However, once I break alliance of Player 4 with Player 3 and ally Player 4 to the human player I can see everything Player 3 sees.
  Code:
var iDefeatCounter: Byte; var iGameTime: Integer; procedure OnMissionStart(); var i: Byte; begin //Do not share fog Actions.PlayerShareFog(4, 1, false); Actions.PlayerShareFog(4, 2, false); Actions.PlayerShareFog(4, 3, false); end; procedure OnPlayerDefeated(aIndex: Integer); begin if iDefeatCounter < 2 then begin if (aIndex = 1) or (aIndex = 2) then iDefeatCounter := iDefeatCounter + 1; end; end; On Tick(); begin //Change Alliances if iDefeatCounter = 2 then begin Actions.PlayerAllianceChange(1, 4, true, false); //Break alliance with remaining AI Player Actions.PlayerAllianceChange(2, 4, true, false); Actions.PlayerAllianceChange(3, 4, true, false); iGameTime := States.GameTime(); iDefeatCounter := 3; end; if ((iDefeatCounter = 3) and (States.GameTime() = iGameTime + 300)) then //30sec Delay begin Actions.ShowMsgGoto(0, 136, 57, 'The small village is joining our cause!'); Actions.PlayerAllianceChange(0, 4, true, true); //Ally to HumanPlayer Actions.AIDefencePositionRemoveAll(4); //Delete defence positions //Add new defence positions Actions.AIDefencePositionAdd(4, 125, 44, 0, 0, 15, 0); //Militia Actions.AIDefencePositionAdd(4, 123, 50, 0, 0, 15, 0); Actions.AIDefencePositionAdd(4, 129, 49, 0, 0, 15, 0); Actions.AIDefencePositionAdd(4, 125, 47, 0, 2, 15, 0); //Rogue Actions.AIDefencePositionAdd(4, 119, 44, 1, 2, 15, 0); Actions.AIDefencePositionAdd(4, 119, 48, 1, 2, 15, 0); Actions.AIDefencePositionAdd(4, 120, 54, 0, 1, 15, 0); //Rebel iDefeatCounter := 4; end; end;
Any Ideas? Am I doing something wrong?
<<

Esthlos

User avatar

Knight

Posts: 676

Joined: 23 Jun 2013, 16:02

KaM Skill Level: Beginner

Post 05 Oct 2014, 10:07

Re: PlayerShareFog

Have you tried replacing "On Tick" with "procedure OnTick"? :P

Also, PlayerShareFog enables/disables the sharing of updates to Fog of War... it doesn't update them.
(That is, it won't reveal houses and idle units).

To do that, you'll need a script to reveal them... you can use parts of this or this, if you need it.
Just when you think you know something, you have to look at it in another way, even though it may seem silly or wrong. You must try! - John Keating, "Dead Poets Society"
<<

Strangelove

User avatar

Crossbowman

Posts: 230

Joined: 30 Jul 2013, 06:32

KaM Skill Level: Fair

Post 05 Oct 2014, 12:54

Re: PlayerShareFog

Have you tried replacing "On Tick" with "procedure OnTick"? :P

Also, PlayerShareFog enables/disables the sharing of updates to Fog of War... it doesn't update them.
(That is, it won't reveal houses and idle units).

To do that, you'll need a script to reveal them... you can use parts of this or this, if you need it.
Oh... that's a copy-paste error lol.

I actually thought it would work differently. But if its just about the update i know how to solve it. Thanks!

It works like this:
  Code:
procedure OnMissionStart(); var i: Byte; begin //AI village does not share fog with other AI Players Actions.PlayerShareFog(1, 4, false); Actions.PlayerShareFog(2, 4, false); Actions.PlayerShareFog(3, 4, false); Actions.FogCoverAll(4); //!!!!! end;

Return to “Dynamic Scripting”

Who is online

Users browsing this forum: No registered users and 1 guest