Jump to content

shuko

Member
  • Content Count

    2231
  • Joined

  • Last visited

  • Medals

Everything posted by shuko

  1. Since you guys insist on using my silly scripts, I've been forced to update this one as well. As usual, it's a port from A2, so it's most likely buggy, and certainly hard to use! ;) The Arma 2 thread SHK_startingPositionRandomizer.sqf SHK_startingPositionRandomizer.Stratis.zip Example video made for Kyllikki members Randomly selects a location for each side from predefined, editor placed, markers. IMPORTANT! The positions of all units and objects to be moved are based on their relative position to the first marker (for example startpos_east). What this means is that you should place your objects around/on top of the first marker. For example, if the randomizer decides that the starting position is startpos_east_2 instead of startpos_east. All the objects will be moved and placed to same direction and distance from the position 2 marker that they were from position marker startpos_east. Marker naming: All markers need to start with "startpos", following an underscore and side. Then an underscore and an incremental integer. Only exception is the first marker, it has no number. Examples: startpos_east startpos_east_1 startpos_west startpos_west_1 startpos_west_2 Tip: if you first create the marker without number, you can copy & paste that and rest of the markers will be named correctly. Supported sides: "east", "west", "guer", "civ" Syntax: [["side",number,<objectrange>,[]],["side",number,[object1,object2],["color","type","text"]],...] call compile preprocessfile "SHK_startingPositionRandomizer.sqf" Parameters: 0 String One of the four sides. 1 Integer How many possible positions (markers) there is for this side. Optional parameters: 2 Number Range in meters from the first marker to move all vehicles etc objects. Array List of objects to move besides playableunits. 3 Array If given an empty array ([]) a green "Start" type marker will be shown at the selected starting position. Settings to define the appearance of the start marker. 0 Color Valid colors: black, blue, green, orange, red, white, yellow 1 Type Marker types: [url]http://community.bistudio.com/wiki/cfgMarkers[/url] 2 Text Optional. Text to display next to the marker. Examples: [["west",3]] call compile preprocessfile "SHK_startingPositionRandomizer.sqf" [["west",3],["east",2]] call compile preprocessfile "SHK_startingPositionRandomizer.sqf" [["west",2,20],["east",5,[car1,truck4]]] call compile preprocessfile "SHK_startingPositionRandomizer.sqf" [["west",3,0,[]]] call compile preprocessfile "SHK_startingPositionRandomizer.sqf" [["west",3,50,["blue","b_inf","Infantry"]]] call compile preprocessfile "SHK_startingPositionRandomizer.sqf" Briefing: If marker parameter(s) is defined for a side, a marker with name "startpos" is created at the starting location. This marker will be different for each side, but has same name on each client, which means you can link to this marker in briefing and/or notes and it will point to a location of the player's starting position.
  2. Your idea doesn't really have anything to do with this script. You should be looking into moving the respawn markers.
  3. [["west",4],["east",3],["guer",3],["civ",5]] call compile preprocessfilelinenumbers "SHK_startingPositionRandomizer.sqf"; Number is the amount of different starting positions for that side.
  4. Either use a variable which actually describes the units instead of generic unit1 etc. Or use arrays to store all the needed info from which you can refer to the unit object directly without needing to name them all.
  5. shuko

    SHK_pos

    If you have water positions disallowed, and the random position is in water, the script will try to find land by circular search with increasing radius. This can, in some cases, make the returned position being outside of the given parameters. I should probably update the script and make it start from the beginning in those cases. As for the error. You are giving the object type as 3rd parameters, when it's place is 6th. The zeros are for not allowing water position and not forcing road position. As for direction you can replace it with random 360. _armousSpawnPos = [_centerPos, random _baseSize, _directionFromAnchor,0,0,"C_Offroad_01_repair_F"] call SHK_pos;
  6. shuko

    SHK_pos

    Is there water between the anchor and minimum distance?
  7. If the goal is to make a unit join a player group once the player is in a trigger/close enough to the unit. Then, I would approach this a little different, and not try to work with the trigger's thislist at all. Instead, I would simply check which player is the closest to the unit once the trigger fires. To ensure that the player will the correct one, make the trigger small enough. Function: [color="#FF8040"][color="#006400"][i]// SHK_closestPlayer = compile preprocessfile "SHK_closestPlayer.sqf";[/i][/color] [color="#006400"][i]// obj1 call SHK_closestPlayer;[/i][/color] [color="#006400"][i]// [obj1,side] call SHK_closestPlayer;[/i][/color] [color="#191970"][b]private[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"_o"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_s"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_p"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_b"[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_o[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_this[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_b[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]if[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#191970"][b]typeName[/b][/color] [color="#1874CD"]_o[/color] [color="#8B3E2F"][b]=[/b][/color][color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]typeName[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]then[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#1874CD"]_s[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#1874CD"]_o[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_o[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#1874CD"]_o[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_b[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_p[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]objNull[/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]if[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#191970"][b]alive[/b][/color] [color="#000000"]_x[/color] [color="#8B3E2F"][b]&[/b][/color][color="#8B3E2F"][b]&[/b][/color] [color="#191970"][b]isPlayer[/b][/color] [color="#000000"]_x[/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]then[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]if[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#000000"]_x[/color] [color="#191970"][b]distance[/b][/color] [color="#1874CD"]_o[/color] [color="#8B3E2F"][b]<[/b][/color] [color="#000000"]_x[/color] [color="#191970"][b]distance[/b][/color] [color="#1874CD"]_p[/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]then[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]if[/b][/color] [color="#1874CD"]_b[/color] [color="#191970"][b]then[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]if[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#191970"][b]side[/b][/color] [color="#000000"]_x[/color] [color="#8B3E2F"][b]=[/b][/color][color="#8B3E2F"][b]=[/b][/color] [color="#1874CD"]_s[/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]then[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#1874CD"]_p[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_x[/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color] [color="#191970"][b]else[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#1874CD"]_p[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]_x[/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color] [color="#191970"][b]forEach[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#191970"][b]if[/b][/color] [color="#191970"][b]isMultiplayer[/b][/color] [color="#191970"][b]then[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#191970"][b]playableUnits[/b][/color][color="#8B3E2F"][b]}[/b][/color] [color="#191970"][b]else[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#191970"][b]switchableUnits[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_p[/color][/color] Made with KK's SQF to BBCode Converter _trig setTriggerStatements ["({isPlayer _x} count thisList) > 0","TE1 stop false; [TE1] join (group (TE1 call SHK_closestPlayer))",""];
  8. shuko

    Loop is failing

    Running infinite loop without delay is always nice.
  9. shuko

    SHK_Patrol

    You can call the script from anywhere you like, but you need to pass the group as a parameter. nul = [myGroup1] execVM "shk_patrol.sqf";"
  10. shuko

    SHK_Patrol

    Yeah, I did some changes with domains and web hosts. Forgot to update every single link on this forum. ;) Anyway, first post is updated.
  11. There's probably a better way nowadays, but if nothing shows up, you could try this: http://forums.bistudio.com/showthread.php?162695-SHK_pos Example: http://shuko.kapsi.fi/arma3/scripts/SHK_pos/img/road_position.jpg (317 kB)
  12. shuko

    String to Condition?

    What exactly are you trying to do that would require such, rather ugly, coding? Why can't you use proper structures and conditions?
  13. Never use "player" in multiplayer unless you know what you are doing. Triggers are local to each machine and not synchronized. The condition above will result the trigger firing on each machine at different times (if at all) and never on server. For MP, use playableUnits. And, you don't need "this" in trigger condition when using "thislist", because it already includes the trigger settings.
  14. shuko

    Dynamic trigger pos?

    Nothing wrong with editor triggers. Yes the attachto will work everywhere.
  15. shuko

    isServer

    http://shuko.kapsi.fi/temp/isserver.png (124 kB)
  16. shuko

    isServer

    How do you know it's not working on the server? It's displaying the messages on the server, not on your client.
  17. I might be nitpicking here, but is it optimal/safe to have a loop that can go on forever? Sure, in most cases it will pick a human player right away. How about doing something like this: _units = []; { if (isPlayer _x) then { _units pushBack _x; } } foreach playableUnits; _unit = _units call BIS_fnc_selectRandom;
  18. shuko

    SHK_Taskmaster

    "200" is a string, not a number. Try without the quotation marks.
  19. Doesn't spawnGroup return a group already? That would make the "group" command unnecessary at least, but I don't know if that's causing any problems though. forEach units glb_civnorth;
  20. shuko

    SHK_pos

    I tried to make a script for it, but since it has some issues, I haven't made a thread for it. However, if you want to have a go: http://derfel.org/arma2/scripts/SHK_buildingpos.sqf
  21. I don't know if there are that many people who will find this useful, but if it helps even just one, it's worth sharing. With this script you can quite easily move multiple objects from A to B without the objects loosing relative positions to each other. That's all it does, basically saves you from doing all the "setpos select 0 + 1.7" stuff. Moves set of objects from A to B, retaining the direction and distance from a point of reference. Parameters: 0: Object or Position Anchor, point of origin. 1: Object or Position Center position to which objects are move around. 2: Number Range in meters to search for objects. 3: Array or String Optional. Type of objects to search for. 4: Number or Object Optional. Direction adjustment. Affects position of objects, not the dir they will be facing. 5: Number or Object Optional. Direction the objects will be facing after they are moved. Examples: nul = [gl1,gl2,50] execvm "shk_moveobjects.sqf" nul = [start,destination,100,"Man"] execvm "shk_moveobjects.sqf" nul = [[3243,5234,0],gl2,50,["Man","Car"]] execvm "shk_moveobjects.sqf" nul = [gl1,gl2,50,[],gl2] execvm "shk_moveobjects.sqf" nul = [gl1,gl2,50,[],45] execvm "shk_moveobjects.sqf" nul = [gl1,gl2,50,[],45,270] execvm "shk_moveobjects.sqf" SHK_moveObjects.sqf SHK_moveObjects.Stratis.zip Using parameters 4 and 5 https://www.youtube.com/watch?v=WWQyGZuF4O0 Arma 2 thread
  22. That's because isPlayer _x in thislist is incorrect syntax. Correct usage of the commands would be: isPlayer _x That checks if the unit is a human player. _x in thislist That checks if the unit is in the unit list of the trigger So, basically you are trying to use two commands at the same time. If you want to check both: isPlayer _x && _x in thislist
  23. shuko

    SHK_pos

    It seems I have version 0.2 on my harddrive, but I can't remember what's the difference, or if it's even finished. :) All I can remember is that I never got the building stuff work as well as I would have wanted.
×