Home   Help Search Login Register  

Author Topic: Making sure unit is a Player  (Read 1922 times)

0 Members and 1 Guest are viewing this topic.

Mr.BoDean

  • Guest
Making sure unit is a Player
« on: 07 Jul 2004, 22:34:43 »
Is there a way to ensure that the group leader is actually filled by a human player?  My mission is based around that premise. Although an AI leader could work in that position, some events would not occur and the mission is best run with that unit being a player.

Aside from putting a note inthe description part of the setup screen, would this be done in description.ext or Init.sqs and how?    ???  Thanks.  :)

Offline CrashDome

  • Members
  • *
Re:Making sure unit is a Player
« Reply #1 on: 07 Jul 2004, 23:49:32 »
I believe you can do so by using this:

? ( !(local <unitname>) OR (player == <unitname>) ) : <everything is ok>

This needs to run server side only. Do not use in the Init.sqs

This will check if unit is not local to a server (meaning controlled by a client machine and therefore a client player) OR if it IS the player on the server


Mr.BoDean

  • Guest
Re:Making sure unit is a Player
« Reply #2 on: 08 Jul 2004, 00:15:19 »
Thanks for the reply, Crash, but not sure if I follow correctly.  :-\

I have 8 playable units.
P1 is Alpha Black Leader , who needs to be a human player.

So, would I run a script from Init.sqs that would use the check line you stated ? Would that also ensure the unit was not AI and not Disabled all together?  ???

Init.sqs:

HumanLeader = false
[] exec "Leader.sqs"

Leader.sqs:

? !(local server): exit
#LeaderCheck
? ( !(local P1) OR (player == P1 ) : goto "Start"
~1
goto "LeaderCheck"

#Start
(seems like I would need something here to enable the "Launch" button in setup with:)

HumanLeader = true; publicvariable "HumanLeader"
« Last Edit: 08 Jul 2004, 00:16:28 by Mr.BoDean »

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Making sure unit is a Player
« Reply #3 on: 08 Jul 2004, 00:47:01 »

INIT.sqs
Quote
tx_HumanLeader = false
?(player == P1 ) :tx_HumanLeader = true; Publicvariable "tx_HumanLeader"
;;; have a wait period that gives enough time for the PV to be received over poor networks
~2
?!(tx_HumanLeader): goto "END"

#END
hint "Error: Lead unit must be a player, please reassign"
exit



or you could use the query

?(tx_HumanLeader): do whatever

If unit P1 is controlled by a player, every machine's version of "tx_HumanLeader" would change from false to true


hope that helps
« Last Edit: 08 Jul 2004, 00:53:52 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Mr.BoDean

  • Guest
Re:Making sure unit is a Player
« Reply #4 on: 08 Jul 2004, 04:11:57 »
Thanks again, terox. Is there something to this naming things with tx_ ...... in the prefix?

At any rate , I assume this method would only show up once the Admin clicks OK to launch and the players would then see this ERROR (hint) on their screen? Which means I could then keep the intro from starting, or vehicles from being fuelled or something, huh?   :o

Mr.BoDean

  • Guest
Re:Making sure unit is a Player
« Reply #5 on: 08 Jul 2004, 07:47:02 »
Ok Terox, so I managed to get this to work after figuring out where to put it. But it works great!  ;D  Using this version, the titles come up, but the Intro cutscene gets interrupted and the error HINT is displayed. I also left 2 groups of players with no fuel, hehe.  ;)   :-*

So that is a workable solution, unless there is some way to keep the game from launching at all from setup if there is no human player for P1 .    ???

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Making sure unit is a Player
« Reply #6 on: 08 Jul 2004, 15:21:22 »
i use a tag tx_  for all my global variables, this ensures that no global variable that i create conflicts with any addon or mod variable.  Its a good habit to get into

No you wont be able to stop the server from loading the mission.

What you can do is set your endmission trigger off just after the hint line to shut the mission down completely
« Last Edit: 08 Jul 2004, 15:23:37 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Mr.BoDean

  • Guest
Re:Making sure unit is a Player
« Reply #7 on: 08 Jul 2004, 18:52:15 »
A.) i use a tag tx_  for all my global variables, this ensures that no global variable that i create conflicts with any addon or mod variable.  Its a good habit to get into

B.) What you can do is set your endmission trigger off just after the hint line to shut the mission down completely

A.) Ah, ok ...never thought of those pesky variables buried in .pbo's of addons.  8)

B.) Ohh, what a delicious idea!  ;D   ;)

Thanks again.  :)

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Making sure unit is a Player
« Reply #8 on: 08 Jul 2004, 20:18:18 »
oh 1 more thing.

Mod makers and addon makers have a "Tag library" on OFPEC, they register their tag there, so that other mod teams dont use the same one.

These tags are 3 letters long, hence why i use only 2 as there aint a missionmakers tag library
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123