JeyR
Member-
Content Count
61 -
Joined
-
Last visited
-
Medals
Everything posted by JeyR
-
Nevermind I just found this https://community.bistudio.com/wiki/BIS_fnc_randomPos
-
Helo. I have a seeding problem with the random function that I just can't figure out. while { surfaceIsWater _suitable || count _list > 0} do { while {_spot distance officer_jeff < 1000 || surfaceIsWater _spot} do { _prevStep = _center getPos[ (random 2000), (random 350)]; for "_i" from 0 to 2 do { _step = _prevStep getPos[ (random 2001), (random 351)]; _prevStep = _step; }; _spot = [_step select 0,_step select 1,0]; }; _suitable = [_spot, 0, 300, 20, 0, 0.7, 0] call BIS_fnc_findSafePos; _list = nearestTerrainObjects [_suitable,["TREE","BUILDING","RUIN","ROCK","HOUSE"], _howBig,false]; }; If the script can't find a position that is not a water surface, it restarts BUT the RANDOM functions just keeps giving me the same position every time the cycle ends. I don't understand, is it not supposed to be random? I also tried this with seed using the alternate syntax of random: while { surfaceIsWater _suitable || count _list > 0} do { while {_spot distance officer_jeff < 1000 || surfaceIsWater _spot} do { _prevStep = _center getPos[ (time random 2000), (time random 350)]; for "_i" from 0 to 2 do { _step = _prevStep getPos[ (time random 2001), (time random 351)]; _prevStep = _step; }; _spot = [_step select 0,_step select 1,0]; }; _suitable = [_spot, 0, 300, 20, 0, 0.7, 0] call BIS_fnc_findSafePos; _list = nearestTerrainObjects [_suitable,["TREE","BUILDING","RUIN","ROCK","HOUSE"], _howBig,false]; }; Here is an example output: 15:12:48 "[823.795,10712.5] as _suitable, 56 as count _list, [816.133,10551.5,0] as _spot " 15:12:49 "[820.423,10745.8] as _suitable, 46 as count _list, [816.133,10551.5,0] as _spot " 15:12:50 "[828.004,10684.4] as _suitable, 76 as count _list, [816.133,10551.5,0] as _spot " Any help would be much appreciated.
-
What do you mean everything ? How do I tell that function to find a random position on the map then start searching? Nohow. It only searches for a designated small area. You have to give it the default position. And my script is trying to find a random default position.
-
Yes okey, I understand. But first off I just want this to work properly, then I can work on optimizing the algorithm.
-
Yes you see, the problem is that I don't want to create markers for this. I don't want anything in my mission editor nor I want to place any units/objects on the map .
-
The possibility of it checking the same area is very small (or it would be if random would work as intended here). The chance of checking the same area is really small because: 1- the script calculates 4 random distances, and random headings for each distance, 2-since every distance and heading is random you can clearly see the impossibility. But for some unknown reason, the random functions gets stuck in 1 distance and heading on my PC .
-
Find a safe spot for a composition to spawn , randomly.
-
Okey, I have to be missing something then. I am calling this script via debug console. like this : [100] spawn CHAB_fnc_findSpot; Each of my functions are listed in CfgFunctions.hpp. What do I do wrong?
-
17:49:03 "_spot = [9666.13,3028.81,0]" 17:49:03 ">>> [9531.69,2972.07] 167 [9666.13,3028.81,0] " 17:49:03 ">>> [9455.88,3236.07] 38 [9666.13,3028.81,0] " 17:49:03 ">>> [9409.98,3141.88] 44 [9666.13,3028.81,0] " 17:49:03 ">>> [9784.95,2756.75] 103 [9666.13,3028.81,0] " 17:49:03 ">>> [9478.4,3219.99] 66 [9666.13,3028.81,0] " 17:49:03 ">>> [9432.54,3081.66] 112 [9666.13,3028.81,0] " 17:49:03 ">>> [9464.37,3226.52] 45 [9666.13,3028.81,0] " 17:49:03 ">>> [9672.66,2894.3] 131 [9666.13,3028.81,0] " 17:49:03 ">>> [9427.07,3079.41] 109 [9666.13,3028.81,0] " 17:49:03 ">>> [9411.67,3120.7] 75 [9666.13,3028.81,0] " 17:49:03 ">>> [9499.26,3231.2] 92 [9666.13,3028.81,0] " 17:49:03 ">>> [9650.26,2901.7] 129 [9666.13,3028.81,0] " 17:49:03 ">>> [9455.83,3235.39] 38 [9666.13,3028.81,0] " 17:49:04 ">>> [9454.94,3095.55] 126 [9666.13,3028.81,0] " 17:49:04 ">>> [9778.71,2757.8] 105 [9666.13,3028.81,0] " 17:49:04 ">>> [9486.06,3108.22] 126 [9666.13,3028.81,0] "
-
I can't see it, the 2nd run just printed _spot as [6000.58,4245.9,0] 20 times in a row. What do you mean it varies ?
-
No it doesn't, I can see it clearly. The _spot didn't change in the last 20 cycles [6000.58,4245.9,0]. Don't tell me you don't see it. _spot is supposed to be random, not the same number in each cycle. Get it ?
-
_howbig is always more than 100 meters, of course it works with 11. I might have forgot to mention that.
-
How do you get only 1 print? Here is my output, and I just raw copied my script into pastebin : https://i.gyazo.com/0a4263a9d70009a2ebbe9b1418d6e196.png
-
https://pastebin.com/dvaUQzZu
-
Yes it does, and if you don't believe it, try it. I can upload the whole file if need be.
-
I know that the output is correct. Did you read my question? I want to know why the "[ (random 2000), (random 350)]" keeps giving back the same numbers in each cycle ?
-
diag_log format ["%1 %2 %3 ", _suitable,count _list, _spot]; I don't see how is this important.
-
Need help with a teleport script
JeyR replied to Liamsmith's topic in ARMA 3 - MISSION EDITING & SCRIPTING
This is your code here, and I just saw that you were missing { somewhere at the end, _OG_Arms = ceil(random 2); if (_OG_Arms == 1) then { OG_Location = getmarkerpos "OG_Arms_1"; OG_Check = getmarkerpos "OG_Arms_1" nearEntities ["man", 15]; if (OG_Check isEqualTo []) then { player setpos OG_Location; } else { _OG_Arms = 2; }; }; if (_OG_Arms == 2) then { OG_Location = getmarkerpos "OG_Arms_2"; OG_Check = getmarkerpos "OG_Arms_2" nearEntities [["man"], 15]; if (OG_Check = []) then { player setpos OG_Location; }; } else { ["All spawns blocked!"] call tankode_fnc_notification_system; }; -
Need help with a teleport script
JeyR replied to Liamsmith's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Then show us the next error. I was referencing to bis_wiki, you used the command correctly in the second if, but not the first. -
in the mission.sqm there is a an addons array on the top. If you find the corresponding item in the array (the array items are the names of the cfgPatches classes of the required mods)and delete it from there then you can delete the not needed stuff from the mission.
-
Need help with a teleport script
JeyR replied to Liamsmith's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Is "man" a global variable or something? where did you declare it? I think no. nearEntities needs a typename, so your command should look like this : OG_Check = OG_Location nearEntities [["man"], 15]; -
Who is the person that got the remoteExec ?
JeyR posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Alright. Welcome everyone. I have a very interesting problem, and I couldn't find a solution for it. I have been really trying to get past this but I can't solve this riddle. I have this small code snippet inside the initPlayerLocal.sqf: if (didJIP) then { [getPlayerUID player] remoteExecCall ["CHAB_fnc_jipcam",[-2,-(clientOwner)],false]; }; And here is the CHAB_fnc_jipcam: _uid = _this select 0; private "_player"; private "_local"; private "_localID"; { if ((getPlayerUID _x) isEqualTo _uid) then{_player = _x;}; } forEach allPlayers; _local = ???; _localID = ???; As you can see, I clearly have no clue who is the owner of machine ? In my mind's eye remoteExec sends a message to every player that they have to run this script with the given parameters. Here is what I tried so far: Create a global variable (not public) for each player and give it the playerUID -> Result is that inside the jipcam the returned value is "any" on each PC. Create a missionnamespace variable (global but not public) and give it the playerUID -> same results as before I have completely run out of ideas, I tried mostly everything I could think of. Is there anyone who has more tricks up his sleeve?- 24 replies
-
- remoteexec
- global variables
-
(and 4 more)
Tagged with:
-
Who is the person that got the remoteExec ?
JeyR replied to JeyR's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Okey so from that I can only assume that the server thinks my ID is 2 ? And that my player == NULL-OBJECT. Why is that?- 24 replies
-
- remoteexec
- global variables
-
(and 4 more)
Tagged with:
-
Who is the person that got the remoteExec ?
JeyR replied to JeyR's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Okey, unfortunately it didn't work. Here is what I got after I changed my code to yours: this is in my clipboard after a player joined JIP -> clip: <NULL-object> + "" Oh and btw this is the description of the player command on the wiki: "Person controlled by player. In MP this value is different on each computer and on dedicated server this value is null."- 24 replies
-
- remoteexec
- global variables
-
(and 4 more)
Tagged with:
-
Who is the person that got the remoteExec ?
JeyR replied to JeyR's topic in ARMA 3 - MISSION EDITING & SCRIPTING
initplayerlocal : waitUntil {!isNull player && player == player}; if (didJIP) then { [getPlayerUID player] remoteExecCall ["CHAB_fnc_jipcam",[-2,-(clientOwner)],false]; }; jipcam: _uid = _this select 0; private "_player"; private "_local"; private "_localID"; { if ((getPlayerUID _x) isEqualTo _uid) then{_player = _x;}; } forEach allPlayers; _local = ???; _localID = ???;- 24 replies
-
- remoteexec
- global variables
-
(and 4 more)
Tagged with: