lmapper Posted May 5, 2014 Report Share Posted May 5, 2014 _teleports_locations = [ [2194.91,12838.1,0.00143433, "Войти в бункер", 14657.8,14696,1.56864], [14657.8,14696,1.56864, "Выйти из бункера", 2194.91,12838.1,0.00143433], [3915.79,10776.2,0.0, "Moscow Metro", 5615.73,10776.2,0.0] ]; { if ((player distance [(_x select 0), (_x select 1), (_x select 2)]) < 8) then { // 8 - Teleport checkpoint radius if (s_player_onteleport < 0) then { s_player_onteleport = player addAction [format["%1"], (_x select 3)],"scripts\teleporter.sqf",[_x], 6, false, true,"",""]; } else { player removeAction s_player_onteleport; s_player_onteleport = -1; }; }; } forEach _teleports_locations; Link to comment Share on other sites More sharing options...
0 jahangir13 Posted May 6, 2014 Report Share Posted May 6, 2014 if distance < 8 ? Maybe you mean > 8? Why teleporting if you are already there or did I misread something? Link to comment Share on other sites More sharing options...
0 lmapper Posted May 6, 2014 Author Report Share Posted May 6, 2014 if distance < 8 ? Maybe you mean > 8? Why teleporting if you are already there or did I misread something? if (distance to teleport checkpoint (A1)) < 8 then { teleport player to B1 } else if (distance to teleport checkpoint (A2)) < 8 then { teleport player to B2 } else if (distance to teleport checkpoint (A3)) < 8 then { teleport player to B3 }; Link to comment Share on other sites More sharing options...
0 jahangir13 Posted May 6, 2014 Report Share Posted May 6, 2014 Hm, from the scripting commands wiki: if positions are given in command distance, these are seen as positionATL. Try maybe: _objPosition = getPosATL player and compare that. Thats just a rough gess. Didn't mess around so much with positions so far. But for me the documentation sounds like this. I would put an if around your if for checking player_speed < 1. So these distance checks will only be executed if a player stands still. Don't know how much that costs if this is being done for any step every player is doing while moving. Link to comment Share on other sites More sharing options...
0 ruubje11 Posted May 8, 2014 Report Share Posted May 8, 2014 Would like to see a fix for this as well. Will try to do the objposition one Link to comment Share on other sites More sharing options...
0 lmapper Posted May 8, 2014 Author Report Share Posted May 8, 2014 Hm, from the scripting commands wiki: if positions are given in command distance, these are seen as positionATL. Try maybe: _objPosition = getPosATL player This is nothing to do with. Condition is satisfied in both cases, ruubje11 1 Link to comment Share on other sites More sharing options...
0 jahangir13 Posted May 8, 2014 Report Share Posted May 8, 2014 Imapper: yes, and the second thing with the if for checking player speed? I have the feeling with my server menu that it only appears if there is a change, like I run or stand still...or you have a look at a cursurtarget or something. It does not apear if the condition is just set to true. It needs some kind of update or change if you understand what I mean? lmapper 1 Link to comment Share on other sites More sharing options...
0 ruubje11 Posted May 8, 2014 Report Share Posted May 8, 2014 Yeah, I think I understand what you mean, I'll try doing it with an extra check then Link to comment Share on other sites More sharing options...
0 lmapper Posted May 8, 2014 Author Report Share Posted May 8, 2014 Imapper: yes, and the second thing with the if for checking player speed? I have the feeling with my server menu that it only appears if there is a change, like I run or stand still...or you have a look at a cursurtarget or something. It does not apear if the condition is just set to true. It needs some kind of update or change if you understand what I mean? yes, thanks ! i will check it ! Link to comment Share on other sites More sharing options...
0 lmapper Posted May 8, 2014 Author Report Share Posted May 8, 2014 Yeah, I think I understand what you mean, I'll try doing it with an extra check then Thank you answered for me x) Link to comment Share on other sites More sharing options...
0 ruubje11 Posted May 8, 2014 Report Share Posted May 8, 2014 I tried this, but to no avail. Again no error on arma 2 rpt client or server side: _napf_bunkers = [ [1058.68,2963,0.0, "North-West", 3090.19, 10751.9,0.0], [1068.76,2981.2,0.0, "North", 6576.86, 15874.3,0.0], [1101.9,2941,0.0, "North-East", 17317.203, 10170,0.0], [1137.22,2889,0.0, "South-East", 17086.6, 4305.84,0.0], [1112.31,2886.65,0.0, "South-West", 6405.6, 3493.56,0.0], [1112.31,2886.65,0.0, "Center", 10385.249, 8766.09,0.0] ]; { if (((player distance [_x select 0, _x select 1, _x select 2]) < 3) && (speed player <= 1) && cursorTarget isKindOf "Bunker_PMC") then { if (s_player_napfbunker < 0) then { s_player_napfbunker = player addAction [format["Move in %1"], (_x select 3),"addons\extras\bunker\napftransport.sqf",[_x], 6, false, true,"",""]; } else { player removeAction s_player_napfbunker; s_player_napfbunker = -1; }; }; } forEach _napf_bunkers; What's the next proposal :D bring it on ^^ I tried only speed, only cursortarget Link to comment Share on other sites More sharing options...
0 lmapper Posted May 8, 2014 Author Report Share Posted May 8, 2014 I tried this, but to no avail. Again no error on arma 2 rpt client or server side: _napf_bunkers = [ [1058.68,2963,0.0, "North-West", 3090.19, 10751.9,0.0], [1068.76,2981.2,0.0, "North", 6576.86, 15874.3,0.0], [1101.9,2941,0.0, "North-East", 17317.203, 10170,0.0], [1137.22,2889,0.0, "South-East", 17086.6, 4305.84,0.0], [1112.31,2886.65,0.0, "South-West", 6405.6, 3493.56,0.0], [1112.31,2886.65,0.0, "Center", 10385.249, 8766.09,0.0] ]; { if (((player distance [_x select 0, _x select 1, _x select 2]) < 3) && (speed player <= 1) && cursorTarget isKindOf "Bunker_PMC") then { if (s_player_napfbunker < 0) then { s_player_napfbunker = player addAction [format["Move in %1"], (_x select 3),"addons\extras\bunker\napftransport.sqf",[_x], 6, false, true,"",""]; } else { player removeAction s_player_napfbunker; s_player_napfbunker = -1; }; }; } forEach _napf_bunkers; What's the next proposal :D bring it on ^^ I tried only speed, only cursortarget Link to comment Share on other sites More sharing options...
0 jahangir13 Posted May 10, 2014 Report Share Posted May 10, 2014 It's much better for performance to do several if conditions: if(speed player <= 1) then { if ((player distance [_x select 0, _x select 1, _x select 2]) < 3) then ...} } And leave out that part: && (speed player <= 1) && cursorTarget isKindOf "Bunker_PMC") Link to comment Share on other sites More sharing options...
Question
lmapper
Link to comment
Share on other sites
12 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now