Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > IL-2 Sturmovik: Cliffs of Dover > FMB, Mission & Campaign builder Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 01-10-2012, 07:30 AM
Smokeynz Smokeynz is offline
Approved Member
 
Join Date: Apr 2011
Posts: 106
Default Help with triggers please

Hi, we have a trigger setup that functions in player hosted servers, but will not function when run on "server" host

The basic operation is trigger "name" covers region which operates a timer switch which intern operates a triggered random mission set.

The timer halts reactivation of trigger until time runs out then resets trigger.
(random timer and defined timer period).

As noted this works well in player hosted server.
However in "server" hosted setup it fails.

I note that I tried defining as per action.do trying triggers etc, but cannot find syntax or work around to force the trigger to work.

hoping the advanced codies can help, thanks.

heres the trigger operation code

Code:
//example of side specific overflight trigger response, message indicator    
    public override void OnTrigger(int missionNumber, string shortName, bool active)
    {
        base.OnTrigger(missionNumber, shortName,  active);
        int Chkarmy;
        /*===================de triggered mis=====================*/

        if ("de1".Equals(shortName) && active)
        {
            /*
            //GamePlay.gpGetTrigger(shortName).Enable = true; 
            OnTrigger trigger = GamePlay.gpGetTrigger("de1");
            if (trigger != null)
                 trigger.Do();
            */
            ScreenMsg(-1, shortName + " trigger stage 1");// rem out once checks complete

            Chkarmy = 1;
            if (GamePlay.gpPlayer() != null && GamePlay.gpPlayer().Army() == Chkarmy)
            {
                switch (de1S)
                {
                    case 1:
                        ScreenMsg(-1, shortName + " trigger switch stage 2");// rem out once checks complete
                        de1M();//trigger for map load
                        break;
                    case 2:
                        ScreenMsg(-1, shortName + " trigger already in action");// rem out once checks complete
                        break;
                }
            }
        }


        if ("de2".Equals(shortName) && active)
        {            
            Chkarmy = 1;
            if (GamePlay.gpPlayer() != null && GamePlay.gpPlayer().Army() == Chkarmy)
            {
                switch (de2S)
                {
                    case 1:
                        ScreenMsg(-1, shortName + " trigger switch stage 2");// rem out once checks complete
                        de2M();//trigger for map load
                        break;
                    case 2:
                        ScreenMsg(-1, shortName + " trigger already in action");// rem out once checks complete
                        break;
                }
            }            
        }

              
        /*===================uk triggered mis=====================*/

        if ("uk1".Equals(shortName) && active)//uk team trigger, create new if statement for each new trigger
        {
            Chkarmy = 2;
            if (GamePlay.gpPlayer() != null && GamePlay.gpPlayer().Army() == Chkarmy)
            {
                switch (uk1S)
                {
                    case 1:
                        ScreenMsg(-1, shortName + " trigger switch stage 2");// rem out once checks complete
                        uk1M();//trigger for map load
                        break;
                    case 2:
                        ScreenMsg(-1, shortName + " trigger already in action");// rem out once checks complete
                        break;
                }
            }
        }
        if ("uk2".Equals(shortName) && active)//uk team trigger, create new if statement for each new trigger 
        {
            Chkarmy = 2;
            if (GamePlay.gpPlayer() != null && GamePlay.gpPlayer().Army() == Chkarmy)
            {
                switch (uk2S)
                {
                    case 1:
                        ScreenMsg(-1, shortName + " trigger switch stage 2");// rem out once checks complete
                        uk2M();//trigger for map load
                        break;
                    case 2:
                        ScreenMsg(-1, shortName + " trigger already in action");// rem out once checks complete
                        break;
                }
            }
        }
    }
    
 
/*
    // triggered mission loader cascading type
    private void deM()
    {
        de1S = 2;//on off switch for trigger operation
        Timeout(resetde1S, () => { de1S = 1; });//switch delay stops multible trigger loading, resets by set time period 
        switch (derM)
        {
            case 1:
                derM = 2;//cascading map load
                GamePlay.gpPostMissionLoad(MissionPath + Mis9);
                Timeout(2.0, () => { ScreenMsg(-1, Msg9); });
                Timeout(4.0, () =>
                {
                    ScreenMsg(1, Msg9r);
                    ScreenMsg(2, Msg9b);
                });
                break;
            case 2:
                derM = 1;//cascading map load
                GamePlay.gpPostMissionLoad(MissionPath + Mis10);
                Timeout(2.0, () => { ScreenMsg(-1, Msg10); });
                Timeout(4.0, () =>
                {
                    ScreenMsg(1, Msg10r);
                    ScreenMsg(2, Msg10b);
                });
                break;
        }
    }
*/
         

    // triggered mission loader random selection type


    private void uk1M()
    {
        switch (uk1S)
        {
            case 1:
                uk1S = 2;//on off switch for trigger operation        
                Timeout(resetuk1S.Next(100, 900), () => { uk1S = 1; });//random timer reset function
                break;
            case 2:
                break;
        }

        Timeout(1, () =>
        {
            ScreenMsg(1, Msg100r);
            ScreenMsg(2, Msg100b);
        });
        switch (ukrM.Next(1, 4))
        {
            case 1:
                GamePlay.gpPostMissionLoad(MissionPath + Mis100);
                Timeout(2.0, () => { ScreenMsg(-1, Msg100); });
                break;
            case 2:
                GamePlay.gpPostMissionLoad(MissionPath + Mis101);
                Timeout(2.0, () => { ScreenMsg(-1, Msg101); });
                break;
            case 3:
                GamePlay.gpPostMissionLoad(MissionPath + Mis102);
                Timeout(2.0, () => { ScreenMsg(-1, Msg102); });
                break;
            case 4:
                GamePlay.gpPostMissionLoad(MissionPath + Mis103);
                Timeout(2.0, () => { ScreenMsg(-1, Msg103); });
                break;
        }
    }
    

    private void uk2M()
    {
        switch (uk2S)
        {
            case 1:
                uk2S = 2;//on off switch for trigger operation
                Timeout(resetuk2S.Next(100, 900), () => { uk2S = 1; });//random timer reset function
                break;
            case 2:
                break;
        }
        
        Timeout(1, () =>
        {
            ScreenMsg(1, Msg100r);
            ScreenMsg(2, Msg100b);
        });
        switch (ukrM.Next(1, 4))
        {
            case 1:
                GamePlay.gpPostMissionLoad(MissionPath + Mis100);
                Timeout(2.0, () => { ScreenMsg(-1, Msg100); });                
                break;
            case 2:
                GamePlay.gpPostMissionLoad(MissionPath + Mis101);
                Timeout(2.0, () => { ScreenMsg(-1, Msg101); });               
                break;
            case 3:
                GamePlay.gpPostMissionLoad(MissionPath + Mis102);
                Timeout(2.0, () => { ScreenMsg(-1, Msg102); });                
                break;
            case 4:
                GamePlay.gpPostMissionLoad(MissionPath + Mis103);
                Timeout(2.0, () => { ScreenMsg(-1, Msg103); });                
                break;            
        }
    }

    
    private void de1M()
    {
        switch (de1S)        
        {
            case 1:
                de1S = 2;//on off switch for trigger operation
                Timeout(resetde1S.Next(100, 900), () => { de1S = 1; });//random timer reset function
                break;
            case 2: 
                break;
        }
        
        Timeout(1, () =>
        {
            ScreenMsg(1, Msg200r);
            ScreenMsg(2, Msg200b);
        });
        switch (derM.Next(1, 4))
        {
            case 1:
                GamePlay.gpPostMissionLoad(MissionPath + Mis200);
                Timeout(2.0, () => { ScreenMsg(-1, Msg200); });
                break;
            case 2:
                GamePlay.gpPostMissionLoad(MissionPath + Mis201);
                Timeout(2.0, () => { ScreenMsg(-1, Msg201); });
                break;
            case 3:
                GamePlay.gpPostMissionLoad(MissionPath + Mis202);
                Timeout(2.0, () => { ScreenMsg(-1, Msg202); });
                break;
            case 4:
                GamePlay.gpPostMissionLoad(MissionPath + Mis203);
                Timeout(2.0, () => { ScreenMsg(-1, Msg203); });
                break;
        }
    }

    private void de2M()
    { 
        switch (de2S)
        {
            case 1:
                de2S = 2;//on off switch for trigger operation
                Timeout(resetde2S.Next(100, 900), () => { de2S = 1; });//random timer reset function
                break;
            case 2:
                break;
        }

        Timeout(1, () =>
        {
            ScreenMsg(1, Msg200r);
            ScreenMsg(2, Msg200b);
        });
        switch (derM.Next(1, 4))
        {
            case 1:
                GamePlay.gpPostMissionLoad(MissionPath + Mis200);
                Timeout(2.0, () => { ScreenMsg(-1, Msg200); });
                break;
            case 2:
                GamePlay.gpPostMissionLoad(MissionPath + Mis201);
                Timeout(2.0, () => { ScreenMsg(-1, Msg201); });
                break;
            case 3:
                GamePlay.gpPostMissionLoad(MissionPath + Mis202);
                Timeout(2.0, () => { ScreenMsg(-1, Msg202); });
                break;
            case 4:
                GamePlay.gpPostMissionLoad(MissionPath + Mis203);
                Timeout(2.0, () => { ScreenMsg(-1, Msg203); });
                break;
        }
    }

    #endregion
Reply With Quote
  #2  
Old 01-10-2012, 07:33 AM
Smokeynz Smokeynz is offline
Approved Member
 
Join Date: Apr 2011
Posts: 106
Default

Here is the complete mission and code complete
Attached Files
File Type: zip ScrimBase.zip (35.7 KB, 5 views)
Reply With Quote
  #3  
Old 01-10-2012, 08:03 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Can't work in your ScrimBase.cs
GamePlay.gpRemotePlayers() has no Army() - member.
If you use GamePlay.gpRemotePlayers() you get a player Array.

AiPlayer[] players = GamePlay.gpRemotePlayers();

so you can use foreach and if-clause to look for the players Army

or

you can copy it in a List

List<Player> players = new List<Player>();

if (GamePlay.gpPlayer() != null)
players.Add(GamePlay.gpPlayer()); // to get the host-player in single or normal hosted multiplayer or the server on dedicated server
if (GamePlay.gpRemotePlayers() != null)
players.AddRange(GamePlay.gpRemotePlayers());

then you can use
if (players.Exists(item => item.Army() == Army))
{


}

Last edited by FG28_Kodiak; 01-10-2012 at 08:16 AM.
Reply With Quote
  #4  
Old 01-10-2012, 12:51 PM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default

There is a huge disconnect between "server" hosted games & "player server" games.

Objects appear in one but not appear in the other, scripts that work in one do not work in the other. The reason for the disparity is unclear, but it is extremely frustrating. There is no solution that I know of. I test my battles in "server" hosted games ONLY for this reason.
__________________
When one engine fails on a two engine bomber, you will always have enough power left to get to the scene of the crash.

Get the latest COD Team Fusion patch info HERE
Reply With Quote
  #5  
Old 01-10-2012, 09:36 PM
Smokeynz Smokeynz is offline
Approved Member
 
Join Date: Apr 2011
Posts: 106
Default

Thanks Kodak,

Ok I did try and replicate the messaging to players in multiplayer for this, but must of had syntax wrong when i tried.

Can I use this as part of messaging aswell, or is it best to list separately for different jobs? (I hate repeating the same code, luv subs to do repeating stuff)

Ok I think I have followed your advise, can you please check the following section. Not sure if I am asking this if question correctly.
if (players.Exists(players => players.Army() == Chkarmy))



Code:
    private void Playerlist()
    {
        List<Player> players = new List<Player>();

        if (GamePlay.gpPlayer() != null)
            players.Add(GamePlay.gpPlayer());

        if (GamePlay.gpRemotePlayers() != null)
            players.AddRange(GamePlay.gpRemotePlayers());
    }

    //example of side specific overflight trigger response, message indicator    
    public override void OnTrigger(int missionNumber, string shortName, bool active)
    {
        base.OnTrigger(missionNumber, shortName,  active);
        int Chkarmy;
        /*===================de triggered mis=====================*/

        if ("de1".Equals(shortName) && active)
        {
            Playerlist(); //list players ingame
       
            ScreenMsg(-1, shortName + " trigger stage 1");// rem out once checks complete

            Chkarmy = 1;

            if (players.Exists(players => players.Army() == Chkarmy))
            {
                switch (de1S)
                {
                    case 1:
                        ScreenMsg(-1, shortName + " trigger switch stage 2");// rem out once checks complete
                        de1M();//trigger for map load
                        break;
                    case 2:
                        ScreenMsg(-1, shortName + " trigger already in action");// rem out once checks complete
                        break;
                }
            }
        }
    }
Reply With Quote
  #6  
Old 01-11-2012, 04:22 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Corrected:
Code:
    private List<Player> Playerlist()
    {
        List<Player> players = new List<Player>();

        if (GamePlay.gpPlayer() != null)
            players.Add(GamePlay.gpPlayer());

        if (GamePlay.gpRemotePlayers() != null)
            players.AddRange(GamePlay.gpRemotePlayers());

        return players;
    }

    //example of side specific overflight trigger response, message indicator    
    public override void OnTrigger(int missionNumber, string shortName, bool active)
    {
        base.OnTrigger(missionNumber, shortName, active);
        int Chkarmy;
        /*===================de triggered mis=====================*/

        if ("de1".Equals(shortName) && active)
        {
            ScreenMsg(-1, shortName + " trigger stage 1");// rem out once checks complete

            Chkarmy = 1;

            if (Playerlist().Exists(players => players.Army() == Chkarmy))
            {
                switch (de1S)
                {
                    case 1:
                        ScreenMsg(-1, shortName + " trigger switch stage 2");// rem out once checks complete
                        de1M();//trigger for map load
                        break;
                    case 2:
                        ScreenMsg(-1, shortName + " trigger already in action");// rem out once checks complete
                        break;
                }
            }
        }
    }
The problem in your code
private void Playerlist()
voids doesn't have any value.
so i changed
private List<Player> Playerlist()
{
.
.
return players;
}

Now Playerlist() includes all players in the game.
so you can use
if (Playerlist().Exists(players => players.Army() == Chkarmy))

Last edited by FG28_Kodiak; 01-11-2012 at 04:40 AM.
Reply With Quote
  #7  
Old 01-11-2012, 07:53 AM
Smokeynz Smokeynz is offline
Approved Member
 
Join Date: Apr 2011
Posts: 106
Default

Thanks Kodak.

re edited full cs script as per your update.

Unfortunately as previous attempts I have made, it runs perfectly when player is hosting mission as server.

But when run on server mode where I join the server across LAN the triggers fail.

I note that the messages I have to check stage progression 1 and 2 both fail, which seems to mean the trigger shortname and condition may not be met or not being checked?
Could this be like triggers and actions where a DO is needed to activate the trigger?

attached is full re edit mis set and cs
Attached Files
File Type: zip ScrimBase.zip (14.4 KB, 1 views)
Reply With Quote
  #8  
Old 01-11-2012, 08:33 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

At the moment i can not check your mission (not at my gaming PC), will take a look at it at evening.


but you get the current trigger state with
GamePlay.gpGetTrigger("Triggername").Active
true if active, false if disabled.

you can enable the trigger with:
GamePlay.gpGetTrigger("Triggername").Enable = true;
and disable with
GamePlay.gpGetTrigger("Triggername").Enable = false;

if ("de1".Equals(shortName) && active)
btw. you use tpassthru triggers, so active is true if you enter the area and false if you leave the area.
Reply With Quote
  #9  
Old 01-11-2012, 08:54 AM
Smokeynz Smokeynz is offline
Approved Member
 
Join Date: Apr 2011
Posts: 106
Default

Ok, I'll let you have a play around see what you can come up with.

Some notes:

I have avoided using trigger enable true/false , my intension is leave triggers live at all times and let the random timer switch define time out period for trigger, hence the test message "trigger already in action".

Also I have found if you have "&& active" in the,
if ("de1".Equals(shortName) && active)
the second "leaving trigger area" trigger is avoided. I note some ppl have reported double triggers, this happened when I just had,
if ("de1".Equals(shortName))

Yes I am using pass thru triggers for player in mis, then check for army in script(they need to add player and army combination option)
This is so triggers activate for players and side only, thus Ai won't cause triggers to respond.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:43 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.