shadow 6 Posted November 18, 2002 Would it be possible to get OFP to detect if you play a mission in single-player or in multi-player (coop)? unit1= the player in SP (playable in mp) unit2= playable in coop, not grouped with unit1 What I want to do is delete unit2 in single-player, but he should be 'playable' in 2-player coop. Is this possible? Is there a way to detect if a human is controlling the unit or not? saw this </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_number = playersNumber side<span id='postcolor'> in this thread Share this post Link to post Share on other sites
Chris Death 0 Posted November 18, 2002 You could delete the unit anyway. Delete unit doesn't work on player units (AFAIK). Now if the second dude is selected by a player, he won't become deleted. P.S: don't forget to use the commands for both units. :remember - in multiplayer, there's no rule that a player has to select the very first unit. Often players tend to disable the officer, and take the lower ranked guys instead. ~S~ CD Share this post Link to post Share on other sites
shadow 6 Posted November 18, 2002 I think you misunderstood me/I did'nt make myself clear enough. I want to delete the second unit only when the mission is launched as a single-player mission (placed in the \missions folder, not \mpmissions). The reason I want this is so I can keep to one PBO-file for both SP and MP-version of the mission. In SP I want only a player at the start. In MP I want all human-selected units showing at the start, but no AI-controlled units. Share this post Link to post Share on other sites
whisperFFW06 0 Posted November 18, 2002 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">but no AI-controlled units<span id='postcolor'> That's why you can delete them, because if in MP, the unit is selected by a player, deleteVehicle won't work on it. If it is not (so it remains AI) or you play singleplayer (so it is IA), it will be affected by deleteVehicle and deleted. So in the init field, just put deleteVehicle this This will remove the unit unless it is selected by a player, which can happen only in MP Whis' Share this post Link to post Share on other sites
Chris Death 0 Posted November 18, 2002 And i think, you misunderstood me As i said, player units won't get deleted, if you are using the command: deleteVehicle unitname on them. So if you do delete each playable unit, the ones, selected by a player, won't become deleted. And again i say: you can't get sure, that the guy, who's playing your mission in multiplayer (sometimes ppl are playing mp missions alone aswell), will select the original player unit. Therefore i suggested, to delete both units. Just in case, you don't believe me that: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> deleteVehicle object Operand types: object: Object Compatibility: Version 1.34 required. Type of returned value: Nothing Description: Delete any unit or vehicle. Only vehicles inserted in editor or created during mission can be deleted. Player unit cannot be deleted. Example: deleteVehicle tank <span id='postcolor'> ~S~ CD Share this post Link to post Share on other sites
shadow 6 Posted November 18, 2002 LMAO yeah, I did'nt see that untill now I'll use deletevehicle on all the units then. -just typical: the solution is always alot simpler than what I was looking for Thanks, guys. Share this post Link to post Share on other sites
Chris Death 0 Posted November 18, 2002 Just one thing, I would not recommend to use the unit's init field to delete them, because i'm not sure, if this would cause the game to crash. For more info, read my thread here: http://www.flashpoint1985.com/cgi-bin....t=23881 I would rather suggest to use a trigger instead. Or you go and try out to delete it from the init field, and if it doesn't crash, you can keep using the init field. ~S~ CD Share this post Link to post Share on other sites
shadow 6 Posted November 18, 2002 I just tried it out on the unit's inits. Seems to work fine. But I'll probably use it in a trigger. I prefer using triggers for as much as possible (except unit-inventory). Easier to find coding you've added when you want to edit it and you got tons of units all over the place. Share this post Link to post Share on other sites
Chris Death 0 Posted November 18, 2002 Just thought, that the init field could probably cause the same problem, as when using waypoints of the very same unit/group. As it works from the init field - no more worries then in here. ~S~ CD Share this post Link to post Share on other sites