Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×

Woodpeckersam

Member
  • Content Count

    230
  • Joined

  • Last visited

  • Medals

Everything posted by Woodpeckersam

  1. Woodpeckersam

    Moving newly created ai units

    Not tested but maybe try... leader _newGroup doMove (getMarkPos "CenterOfTown");
  2. Hi all, been a little while since i've been on here so bear with me. I have 2 questions regarding a few scripts i've made which allows the player to move objects and place them down. Here are my scripts: MoveObjects.sqf _object = _this select 0; _person = _this select 1; _action = _this select 2; ypos = _this select 3 select 0; zpos = _this select 3 select 1; _object attachTo [_person,[0,zpos,ypos]]; if (not alive _object) exitwith {_object removeaction _action;}; _object removeaction _action; place = _object addaction ["Place Object In Current Position","MoveObjects\PlaceObjects.sqf"]; up = _object addaction ["Increment Height Up","MoveObjects\Up.sqf"]; down = _object addaction ["Increment Height Down","MoveObjects\Down.sqf"]; exit; PlaceObjects.sqf _object = _this select 0; _person = _this select 1; _action = _this select 2; if (not alive _object) exitwith {_object removeaction _action;}; pos = (getPos _object select 2) + 1; detach _object; _object setPosASL [getPos _object select 0,getPos _object select 1,pos]; _object setPosASL [getPos _object select 0,getPos _object select 1,(getPosASL _object select 2)-(getPos _object select 2)]; _object removeaction _action; _object removeaction place; _object removeaction up; _object removeaction down; _object addAction ["Move Object", "MoveObjects\MoveObjects.sqf",[zpos,ypos]]; exit; Up.sqf _object = _this select 0; _person = _this select 1; _action = _this select 2; yposVert = (getPos _object select 2) + 1 + 0.1; sleep 0.1; if (not alive _object) exitwith {_object removeaction _action;}; _object attachTo [_person,[0,zpos,yposVert]]; exit; Down.sqf _object = _this select 0; _person = _this select 1; _action = _this select 2; yposVert = (getPos _object select 2) + 1 - 0.1; sleep 0.1; if (not alive _object) exitwith {_object removeaction _action;}; _object attachTo [_person,[0,zpos,yposVert]]; exit; Ok so the scripts work fine, i can pick up objects and drop them and the actions are removed from the menu where appropriate. Question 1: How do I make the increment height go down? If i press the action "Increment Height Down" it goes up. It also goes up when i do "Increment Height Up" which is what i want. I have a feeling there is an issue with this code: yposVert = (getPos _object select 2) + 1 - 0.1; Question 2: How do I make it so that when I place the object, it grabs to the nearest surface? Say I want to place a mortar on top of those metal buildings or even on a roof. When I use my script it does grab itself onto the building, but only on the ground floor (of the building, not the land), not on top, as there are stairs leading up to the top of the metal building and I would like to place my objects there if possible. Basically the scenario is you have 3 men (AI or otherwise). You must defend the small base on the hill from the enemy. You have tools at your disposal in which you can move around the base however you want. You have 5 minutes to sort your base out before the enemy arrives. I have a feeling it could be this code? I grabbed it from an ArmA II editing page somewhere. _object setPosASL [getPos _object select 0,getPos _object select 1,pos];_object setPosASL [getPos _object select 0,getPos _object select 1,(getPosASL _object select 2)-(getPos _object select 2)]; I really wanted a machine gun in place, but that'll have to wait until after the Alpha. So i'm sticking to using Mortars.
  3. It was that simple, how could i be a fool to forget that physics are in this game, and when you setpos it falls into place. Fantastically simple F2k Sel, many thanks. Good responses as always =)
  4. Aite. I have been having a little problem that has cost me a bit of motivation in my mission scripting. So I plucked up some courage and tried to sort it out again. Basically the player starts inside a base. He's gotta gather his team before he can leave the base. I have 3 triggers at places where the player can walk out at will. Two trigger at the exits on the left side of the base Condition: CantLeave == 1 Activation: null = [this, 90] execVM "Scripts\GetBackInside.sqf"; One trigger at the exit on the right side of the base Condition: CantLeave == 1 Activation: null = [this, 270] execVM "Scripts\GetBackInside.sqf"; As you can see, there is a number in the codes above. These indicates which direction the unit has to walk to get out of the trigger and back into the base. Here is the code I am using. GetBackInside.sqf private ["_dir","_trig"]; _trig = _this select 0; _dir = _this select 1; while {true} do { if (player distance _trig <= 10) then { if (getDir player != _dir) then { player setDir ((getDir player) + 1); hint "turning"; } else { player playMove "AmovPercMwlkSlowWrflDf"; }; }; }; Notice I put a hint in there, the hint doesn't show up, so that indicates that it is not checking if the player does NOT equal to _dir (direction he needs to walk out) Can someone help me? It's been bugging me for a couple of days.
  5. @Kylania roflmao the ai in ArmA are too dumb to walk away from an explosion xD They'll probably end up walking into it @CarlGustaffa That seems to be a better solution. I wish there was an invisible wall that could be used so we would have to worry about that.. but then if there was... this game wouldn't be a realistic war simulator. Freedom is the whole point of the game. I will use your method, so thanks to everyone else for helping :D I have three questions... 1. I would like it so that when the player enter the final trigger, they have 10 seconds to get back inside the base, otherwise the player will get shot by the taliban. Is that possible? 2. Just to check (logically check, not really a question) while {true} do { If (([b]getBack == 1[/b]) && (player in list tBase) && (player in list tOutside)) then {}; If (([b]getBack == 1[/b]) && !(player in list tBase) && (player in list tOutside)) then { ...warn player... }; If (([b]getBack == 1[/b]) && !(player in list tOutside)) then { ...fail mission... }; }; So I could change the variable getBack between 1 and 0 depending on the situation. My situation would be... gather your team, meet at the gate. Once the team has been gathered, getBack = 0; then that would remove the restrictions. I think that sounds right. 3. You mention the use of markers to show that the player is not allowed outside of the trigger area. Is there a way to show/hide markers (They can be placed inside an array, so they can be toggled on or off depending on the variable getBack) Is this possible?
  6. What smartgun and 2nd Ranger said or... waitUntil {unitReady _guard}; _guard playMove "c7a_bravoTOerc_idle24"; waitUntil {unitReady _guard}; _guard playMove "c7a_bravoTleskani_idle4"; What ever suits your style =) all does the same thing.
  7. Nice one thats even better cheers! =) I sort of changed the code a bit, so that it creates a camera (to stop the player being able to turn left and right while walking forward) however I havent done camera scripting for a while. I cant work out how to get the camera to start in FRONT of the player, no matter what direction he is facing. That model to world command seems to place it at the other end of the world xD private ["_dirP","_trig","_cam","_dir"]; _trig = _this select 0; _dir = _this select 1; _dirP = getdir player; _cam = "camera" camCreate (position player); _cam camSetTarget player; _cam camSetRelPos (player modelToWorld [0, 5, 3]); _cam CameraEffect ["Internal","Back"]; _cam camCommit 0; if ((getDir player >= 0) && (getDir player <= 180)) then { player setDir _dir; sleep 3; player playMove "AmovPercMwlkSlowWrflDf"; } else { player switchmove "otockaErcRflLow_180leva"; sleep 3; player setdir _dirp + 180; }; sleep 0.1; waitUntil {player distance _trig >= 5}; player switchMove ""; exit; ---------- Post added at 08:16 PM ---------- Previous post was at 08:14 PM ---------- I know I havent destroy the camera yet... i just wanna get it to work before i carry on.
  8. That simple.. i must be extremely tired today not to think of that logic. Ta again :D thanks so much for the help =)
  9. Lol that made me laugh rofl. At least it works.. to some extent so thank you so much for that. Another question related to the script. How can i make it so that when the direction of the player is between 85 - 95 playMove (walk forward) ?
  10. Would that work on the player? Anyways yeh I can get the player to turn around. Thats my issue.
  11. very useful mate F2k Sel. How did you find that iceman11a? I have an ATI HD Radeon 4670 (or 4650). If you wanna know my 3D Application Settings here they are.. (doubt they will be much help) SMOOTHVISION HD:Anti-Aliasing (anti aliasing dont bother me too much) Slider - Far Left Filter : Box SMOOTHVISION HD:Anisotropic Filtering (I love being able to see models from far away, not boxes) Slider - Far Right (16x) Catalyst A.I. Slider - Far Right (Advanced) Mipmap Detail Level Slider - Second from Right (Quality not High Quality) Wait for vertical refresh Slider - Second from Left (Off, unless application specifies) Adaptive Anti-Aliasing Off OpenGL Settings (doesnt matter in ArmA 2 as it's a Direct X Game Afaik) Triple Buffering - Ticked. Likewise i'm not sure this will be of much use. I can post a screenshot of my settings in game.. you pretty much will be getting the same if not similiar card to me. It matters if you have a high CPU and RAM too. CPU - Intel® Core2 Quad CPU Q6600 @ 2.40GHz so my CPU = 9.60GHz in total. RAM - 4.00 GB Still lags with everything on the highest settings, so pretty much lower the shadows and turn off HDR, works fine. On Topic: So yeah when you get your new card, if you cant see the ID numbers clearly, put the interface on the largest size and restart your game. It should work.
  12. Ok no problem. You obviously know you can turn on ID's in the editor. Zoom in to the building on the 2D editor to read the numbers. If you still cant read it, then prepare to restart the game. Go into options -> video options -> change interface size higher than the one you are on -> Restart and try again. If you still cant read it, then go back and make the interface size higher. I was having this problem when I was using the mode RTE (Real Time Editor) so after hours of playing around with resolution and stuff, i simply changed my Interface size from small to large and voila i could read it all. (same goes for the 2D Mission editor, although it wasn't so bad) Hope that helps =)
  13. Welcome to the forums Unleash and Fox =) @UnleashtheFury Every bit of code you see here on the forums should work, only the codes that relates to mods and addons wont. At least that's what I read, that Arma 2 Free has full mission editing capabilities, but with no mod support. @fox100cool I unfortunately have the full version of the game. So i do not know much about Arma 2 Free. Have you tried playing the game in full screen and window mode? Also make sure that 3D Resolution and Interface Resolution are the same (assuming the options are there in the video options)
  14. It can be done =) First create a marker on the building you want the AI to climb. Name the marker "BuildingPos" Make sure you have init.sqf in your mission folder. Add these two lines anywhere in the init.sqf (at mission start at least) _buildPos = getMarkerPos "BuildingPos"; deleteMarker "BuildingPos"; Now in the script you want the units to climb onto the buildings, add this code _nBuilding = nearestBuilding _buildPos; [color="SeaGreen"][i]//This checks for the nearest building near the position where the marker was. The nearest building should be the one you want the units to climb.[/i][/color] [color="SeaGreen"][i]//For each unit you can set it's own individual building position so make sure you name all the units in the group[/color] Leader commandMove (_nBuilding buildingPos 5); Sergeant commandMove (_nBuilding buildingPos 6); Lieutenant commandMove (_nBuilding buildingPos 7); Private1 commandMove (_nBuilding buildingPos 1); Private2 commandMove (_nBuilding buildingPos 2); Of course you would need to work out the position of the area at the top of the ladder. Theres a way to check the position. Go in game, create the Player Leader and A team mate. Press F1 then aim at the point you want your team mate to move to, it should tell you the number of the buildingPos near the crosshair. Use that number in the script. Hope that helps, there may be a little issue with the script (hopefully not) but the idea is there. I am on my Iphone, not my computer so I cant check. ta ---------- Post added at 12:54 AM ---------- Previous post was at 12:50 AM ---------- edit:: Ah i lost the race to comment. As sxp2high mentioned about ID, you can change the script i used above. So basically forget about the marker and init.sqf, simple change this line in the script... _nBuilding = nearestBuilding _buildPos; to _nBuilding = (nearestObject 84952); [color="seagreen"][i]Change the number to match the ID of the building[/i][/color] Forgot to mention that doing the method above, if the buildPos requires the AI to climb up the ladder to get there, then the AI will climb up the ladder. Use the ladder action will just make the AI climb up, nothing more.
  15. do you want them to be there from the start? or you want to move them during the mission?
  16. Yes as Kylania said, you can use wait until, or you can use while {condition} Here.. unitName doMove getPos unitName2; //Moves unitName to unitName2 while {unitName distance unitName2 > 10} do //While the unitName is greater than 10 meters away from unitName2 do { [indent]_camera camsetTarget h1; _camera camsetrelPos [2,-5,1]; _camera camPrepareFOV 0.700; _camera camCommitPrepared 0;[/indent] }; // When unitName is 10 or less meters away from unitName2 the while {condition} will stop and carry the script on. waitUntil {unitReady unitName}; //Waits until unitName is ready (stopped) unitName attachTo [unitName2[0,0,2]]; //Attaches unitName to unitName2 unitName2 doMove getMarkerPos "ManOnMyHead"; //Moves unitName2 with unitName on his head to the position of the marker called ManOnMyHead
  17. Woodpeckersam

    AI walk to vehicle and get in

    Pleasure =) Great community this is, glad to be a part of it. Have fun. (gonna get the Take On Helicopters preview...) ta
  18. Woodpeckersam

    AI walk to vehicle and get in

    you could try this.. At the point the unit needs to get into the car, use this code. unit doMove getPos car; // Unit do move to the position of the car waitUntil {unit distance car <= 10; // Wait Until unit is less than or equal to 10 meters away from car unit assignAsCargo car; // Change cargo to things like gunner or driver if you dont want cargo [unit] orderGetIn true; // Order's the unit to get in whatever vehicle he is assigned to. waintUntil {unitReady unit}; // Waits until the unit is ready driver car doMove getMarkerPos "endofisland"; // create a marker with the name "endofisland" and the driver of car will drive to that marker when unit has gotten into the car Most of the code i mentioned has already been mentioned above. It's just trial and error, play around with it. So many different ways to get things done. Good luck. ta
  19. Aite. I have a couple of useful scripts for anybody who struggle to make scenes work.. ie. Keep the player in position, whilst allowing him to move his head. RootSpot When I play games, I like to have cutscenes... that dont involve Cinema borders etc. Like Assassins Creed, where you are there, without a camera pointing at the character. So here's a small script for that. It basically keeps the player in place (and direction) but allowing the use of ALT to move your head around. private ["_ppos","_pdir"]; while {true} do { if (rootspot == 1) then { _ppos = getPos Player; _pdir = getDir Player; Player setPos _ppos; Player setDir _pdir; } }; save this code anywhere in your mission folder. Call it init.sqf or the Player's init using this null = [] exec "Scripts\RootSpot.sqf" Then whenever you want a cutscene to play, where the character is frozen on the spot, just simply type rootspot = 1 to disable it type rootspot = 0 Do this as many times as necessary. If you want to turn on the spot, simply comment out the setDir line. (Havent really tested it though..) ACC TIME 1 When I play games, and I need to get from Point A to Point B, I always using AccTime to speed up the game so I can get to Point B quicker. I usually forget to turn off AccTime when I get to Point B, and it does not help if there is a cutscene at that point. So i made a script, similiar method to the previous script.. This script basically turns the Acc Time back to 1. So while in a cutscene, if you keep pressing the = button, it will always change the AccTime to 1. while {true} do { if (actime == 1) then { setAccTime 1; } }; save this code anywhere in your mission folder. Call it init.sqf or the Player's init using this null = [] exec "Scripts\AccTime.sqf" Then whenever you want a cutscene to play, and to make sure that the scene is'nt being sped up, actime = 1 to disable it type actime = 0 You can do this as many times as needed. These two scripts are constantly checking for variable changes, which is good because I hate to have lines and lines of codes, when I can simply just get the effect I need by changing a variable. I have no idea if running these scripts the way I have are power hungry. I have not had any stuttering using it. If there is a way someone can optimize these scripts (if they are stuttering while using it) then it will benefit everyone who uses them. Hope this helps some. Ta.
  20. Woodpeckersam

    Following a unit

    Lol an error i made there. I meant to have put "unitName" doMove getPos Ambulance; If i was using Squint for that code, it would have told me off. :P
  21. while {true} do { [indent]if (fox == 1) then { [indent]code....[/indent] };[/indent]}; put this in a script and run it at init. Everytime you set fox = 1 (inside ANY SCRIPT in your mission, even in the mission editor... triggers.. etc), it will run the code inside the if statement. If you set fox = 0 it will not run it, until you change it back to 1. Do this as many times as you like =)
  22. Woodpeckersam

    Following a unit

    Try this... In "init.sqf" add the following line support = 0; null = [] execVM "Scripts\FollowMeds.sqf"; Then create a new script called "FollowMeds.sqf" somewhere in your mission folder. (I put all my scripts inside folder called "Scripts". while {true} do { [indent]if (support == 1) then { [indent]Support doMove getPos Ambulance; sleep 2;[/indent] };[/indent] }; And when you want the support vehicle to follow the ambulance, simply type support = 1; When you want the support to stop following the ambulance, just type support = 0; Basically FollowMeds.sqf will be in constant loop non stop. When it detects that the variable ' Support is equal to 1 ' it will execute the code. When it detects that the variable ' Support is not equal to 1 ' it will stop the code, until ' Support is equal to 1'. This is probably not the best way to do it, but it should work.
  23. Aren't those errors BI Related? All sweguy was doing was setting variables.. Good idea though, I can imagine this working after a mission is complete.. basically soldier saves town, and helps build oilfield etc. Good work =)
  24. condition: a1 == true (= sets the Variable to whatever you want.. Boolean.. Number.. String) (== means - If variable is Equal to Boolean.. Number.. String) should work.. edit: oops just noticed your first post. You got it to work. Gratz =)
×