OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Marto on 24 May 2009, 19:14:43
-
I have a mission with 12 units available to select in in the slotting screen.
How do I detect if a human player or AI is selected/slotted?
I have a script that runs on startup that shows each unit and types a message about them like this:
_cam camsettarget m72
_cam camsetrelpos [4,4,2]
_cam camcommit 3
@camcommitted _cam
titletext [ format["%1 as the M72 cat - wannabe Aussie...", name m72],"plain down"];
m72 switchmove "EffectWeaponPanic";
~5
_cam camsettarget dragon
_cam camsetrelpos [0,5,4]
_cam camcommit 3
@camcommitted _cam
titletext [ format["%1 as the Dragon operator - he couldn't operate a can opener...", name
dragon],"plain down"];
dragon switchmove "FXStandhip";
~5
_cam camsettarget dragass
_cam camsetrelpos [0,5,4]
_cam camcommit 3
@camcommitted _cam
titletext [ format["%1 as the Dragon ammo bearer - lug that missile you dipstick...", name
dragass],"plain down"];
dragass switchmove "FXdismay";
~5
_cam camsettarget r1
_cam camsetrelpos [0,5,4]
_cam camcommit 3
@camcommitted _cam
titletext [ format["%1 as the Arse End Arnold - haha!", name r1],"plain down"];
r1 switchmove "FXangel";
~5
but if a human or AI is not selected it still shows the text. How do I get it to not show the text if there is no human or AI slotted to that unit?
I have tried ?(alive dude1) like this but it doesnt work:
?(alive dude1) : goto "player1"
?(!alive dude2) : goto "player2"
#player1
_cam camsettarget dude1
_cam camsetrelpos [0,5,4]
_cam camcommit 3
@camcommitted _cam
titletext [ format["%1 as the scab-lifter medic", name dude1],"plain"];
dude1 playmove "FXstanddip";
~5
?(alive law) : goto "player2"
?(!alive law) : goto "player3"
#player2
_cam camsettarget law
_cam camsetrelpos [4,4,2]
_cam camcommit 3
@camcommitted _cam
titletext [ format["%1 as the Javelin anti-armour guy - what a tosser...", name law],"plain
down"];
law playmove "lyingstillv1";
~5
#player3
_cam camsettarget dude3
_cam camsetrelpos [0,4,2]
_cam camcommit 3
@camcommitted _cam
titletext [ format["%1 as the Javelin ammo bearer", name dude3],"plain down"];
dude3 playmove "effectstandsalute";
~3
etc....
Should I be using
?not local dude1: goto "player1"
or
?dude1 == player : goto "player1"
or something else???
-
something like this will check if the unit is the player..
? (player dude1) : goto player1
gawd I hate sqs :D
-
Thanks hoz,
Ok figured it out, in the script:
?(Player == radio): radio_Alive = true; Publicvariable "radio_Alive"
?(Player == m136): m136_Alive = true; Publicvariable "m136_Alive"
?(Player == m72): m72_Alive = true; Publicvariable "m72_Alive"
?(Player == dragon): dragon_Alive = true; Publicvariable "dragon_Alive"
etc etc.....
#player6x
?(radio_Alive) : goto "player6"
goto "player7x"
#player6
_cam camsettarget radio
_cam camsetrelpos [4,4,2]
_cam camcommit 3
@camcommitted _cam
radio playmove "combattotreated";
titletext [ format["%1 as the radio operator - this guy couldn't get bombs on target...", name radio],"plain down"];
~5
#player7x
?(m136_Alive) : goto "player7"
goto "player8x"
#player7
_cam camsettarget m136
_cam camsetrelpos [4,4,2]
_cam camcommit 3
@camcommitted _cam
radio playmove "combattotreated";
titletext [ format["%1 as the anti-armour specialist - what a norbert...", name m136],"plain down"];
~5
#player8x
?(m72_Alive) : goto "player8"
goto "player9x"
#player8
_cam camsettarget m72
_cam camsetrelpos [4,4,2]
_cam camcommit 3
@camcommitted _cam
titletext [ format["%1 as the M72 cat...", name m72],"plain down"];
m72 switchmove "EffectWeaponPanic";
~5
etc etc...
And in the init.sqs:
radio_Alive=false
m136_Alive=false
m72_Alive=false
dragon_Alive=false
etc etc...