jts_2009 96 Posted August 8, 2012 hi all. How to check in multiplayer if given person is a human player? In arma it is - isPlayer unit1. but how in OFP? :confused: Share this post Link to post Share on other sites
faguss 65 Posted August 9, 2012 (edited) There isn't a straightforward way. You have to check locally and then send information. Here's one example: Edit: I've changed method a little a bit - instead of resetting bools (that could get desynchronized) I'm using integers which are incremented. It's more reliable but also more complicated. Initialization (run it once on the beginning): [color="#00B000"]UNITS = [p0, p1, p2, p3][/color] RESPONSES = [] _i = 0 _id = -1 #ResetVars Format ["RESPONSE_%1=0",_i] forEach [0] RESPONSES = RESPONSES + [0] ? player == (UNITS select _i) : _id=_i ? _i < count UNITS-1 : _i=_i+1; goto "ResetVars" ~0.01 And the actual test (you can loop it): ? _id > -1 : Format ["RESPONSE_%1=RESPONSE_%1+1; publicVariable {RESPONSE_%1}", _id] forEach [0] ~2 [color="#00B000"]_i = 2[/color] _oldVar = RESPONSES select _i _newVar = call ("RESPONSE_" + Format["%1",_i]) ? _oldVar != _newVar : RESPONSES set [_i,_newVar]; [color="#00B000"]hint "p2 is player"[/color] ? _oldVar == _newVar : [color="#00B000"]hint "p2 is AI"[/color] Green parts are customizable. If you want to check if player disconnected then just rerun the code. If you use Fwatch then the method is to search for parenthesis in the object name. isPLR_0 = call loadFile format [{:sf ( "%1"}, format ["%1", p0]] ? isPLR_0 >=0 : hint "Player" ? isPLR_0 == -1 : hint "AI" Checking if player disconnected works only on the server-side. Search for the word REMOTE. If it's missing that means the player is gone. Edited August 13, 2012 by Faguss second rework Share this post Link to post Share on other sites
jts_2009 96 Posted August 9, 2012 (edited) thanks but it will work without FWatch too? because i dont use addons. I need if p0 is not player, then [p0] exec "script.sqs" etc... Edited August 9, 2012 by JTS_2009 Share this post Link to post Share on other sites
faguss 65 Posted August 9, 2012 hanks but it will work without FWatch too? because i dont use addons. First method is universal. Also Fwatch is not an addon but a hack. I need if p0 is not player, then [p0] exec "script.sqs" etc... Then that will be ? !isPLR_0 : [p0] exec "script.sqs" Share this post Link to post Share on other sites
jts_2009 96 Posted August 9, 2012 (edited) First method is universal. Also Fwatch is not an addon but a hack.Then that will be ? !isPLR_0 : [p0] exec "script.sqs" thanks a lot! :) but im not sure how and on which line I add this to the script... And it works I think only for one time. I need always do that if p0 spawns :) And i think there are some errors in the syntax Edited August 9, 2012 by JTS_2009 Share this post Link to post Share on other sites
faguss 65 Posted August 9, 2012 but im not sure how and on which line I add this to the script This is up to you to decide, not me. And it works I think only for one time. I need always do that if p0 spawns I have rewrote the code. Now it's more suitable for repeating and added respawn compatibility. i think there are some errors in the syntax Care to point them out? Share this post Link to post Share on other sites
jts_2009 96 Posted August 9, 2012 (edited) This is up to you to decide, not me.I have rewrote the code. Now it's more suitable for repeating and added respawn compatibility. Care to point them out? thanks but if you say me how to run script.sqs for every AI and repeat it when he spawns, that would be awesome! :bounce3: I'm a bit confused at this script :) Edited August 9, 2012 by JTS_2009 Share this post Link to post Share on other sites
jts_2009 96 Posted August 9, 2012 I making dm. so it needs to check every time if AI spawns - exec "AI.sqs". there are 16 AI's. I don't know how to add this in the code. {[_x] exec "AI.sqs"} foreach ???? or by trigger - alive p0 and p0 is not player - exec "AI.sqs" Share this post Link to post Share on other sites
faguss 65 Posted August 10, 2012 (edited) Here's an example mission where test is run on respawn. Edited August 13, 2012 by Faguss updated mission Share this post Link to post Share on other sites
noone1 1 Posted August 13, 2012 I think there are only human players in OFP (ais don't count for players). Share this post Link to post Share on other sites