![]() |
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:
|
1 Attachment(s)
Here is the complete mission and code complete
|
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)) { } |
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. |
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:
|
Corrected:
Code:
private List<Player> Playerlist() 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)) |
1 Attachment(s)
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 |
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. |
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. |
All times are GMT. The time now is 01:49 PM. |
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.