Jump to content


  • Content Count

  • Joined

  • Last visited

  • Medals

Everything posted by king_richard

  1. MHQVehicleInit What it does: - Respawns a vehicle by simply adding " null = [this] execVM "scripts\MHQvehicleInit.sqf"; " without the surrounding " " to a vehicle in the editor - Retains name given in the editor - addactions on vehicle init and on respawns (actions are added in the script) - execute seperate sqf's on init, spawn, and/or destroyed - commented script DOWNLOAD >> MHQVehicleInit V1.1 << DOWNLOAD * The Extended Version - Includes an abandoned vehicle check and name checking for multiple vehicles with separated actions/code. MHQVehicleInitExt V1.0 Change Log Adding an action to your MHQ, create a new function or Replace one of the defaults MHQ_vehAction3 = { _this addAction ["ActionName","Scripts\YourScript.sqf", nil, 1, false, true, "", "alive _this && {speed _this == 0}"]; publicVariable "MHQ_vehAction3"; }; Now Add your action to MHQ_VehicleInit as this function gets called on vehicle init and respawn MHQ_VehicleInit = { private ["_vehAction1","_vehAction2","_vehAction3","_state","_vehicle"]; // added action 3 _vehicle = _this select 0; _vehName = _this select 1; _state = _this select 2; // 1 - onSpawn; 0 - onDestroyed; // Vehicle spawn/Init if (_state == 1) then { // call addaction functions _vehAction1 = [_vehicle,"MHQ_vehAction1",nil,true] spawn BIS_fnc_MP; _vehAction2 = [_vehicle,"MHQ_vehAction2",nil,true] spawn BIS_fnc_MP; _vehAction3 = [_vehicle,"MHQ_vehAction3",nil,true] spawn BIS_fnc_MP; // added action 3 }; There's also a commented line with an example for calling external sqf's. If your interested in separating your actions for different vehicles then check out this example: ---------------------------------------- There's still some functions that I'd like to add or fine tune as I get more familiar with Arma script. I'm open for suggestions and discussion! ---------------------------------------- To Do: - Vehicle Markers - Available and Destroyed Messages - Get those working in a dedicated enviroment
  2. king_richard

    Uav (cas)

    Updated first post with the current version. Once again thanks JShock, the groupID is now working on a dedicated server! Calling this v0.8 but don't be alarmed, it works, just missing some polish is all.
  3. king_richard

    Uav (cas)

    An AI controlled UAV script that is mostly working. But there's a few issues I have at the moment. 1. addEventHandler and the MP version both are not working for sidechat on dedicated server. The alternative is to create another block of code to check weapons #'s and then fire off a side chat when number decreases. ( That's what I've done for the time being ) 2. Bombing runs seem to be done around 250m - 350m, and if I increase the "flyInHeight" then the UAV will still descend to that altitude. Is there a simple way to force the AI to release bombs at a given altitude? I'd like for them to remain above 1000m at a minimum. 3. Setting the group ID is not syncing on a dedicated server, how may I do this within the script? -Thanks JShock for the tips, all gtg except for the dive bombing. RELEASE NOTES: I've included the original editing folder along with a pbo if you want to test it out. Forgot to include a read me so here it is: - Radio trigger is created in the description, I've just tweaked the example from the wiki. - init.sqf contains the code to add the radio trigger to the player ( eventually I'll add in restricting to player "x" ) - UAV_Master is the core of the script - UAV_radioPOS is a simple script solely to get players marker position when radio is triggered and feed that into the UAV_Master I'd suggest plopping this into the editor to check it out for a minute before adding it into your mission. Released as v0.8 ;) not that it matters but I call it about 80% done. There's some more checks I'll add down the road to get rid of messages when UAV first spawns in and when they return to previously called CAS position. Will also add in a RTB radio option to send the UAV home. It's now down to playing with it and seeing what else needs to be done besides the already mentioned. But, I'm a busy man so a final composition will take some time! Download >> https://docs.google.com/file/d/0B5jK56pciK37RXh6a05GNjhUa00/edit --Original Remainder of Original post in-case your curios---
  4. king_richard

    Uav (cas)

    The script for the time being is named "UAV_Master.sqf" called by UAV placed in the editor the following code in it's init: null = [this] execVM "UAV_Master.sqf"; There's a check in the script to loop until _vehicle is valid as well. Only caught it on the dedicated server with -showScriptErrors. Perhaps my syntax was wrong, idk, but I'll test what you've posted tomorrow if time permits.
  5. king_richard

    Uav (cas)

    JShock, I saw some examples using the Bis_fnc_MP however when called within my script I kept getting "error undefined variable" using ...."[_vehicle,"Side Text"]..... which is why I resorted to the function method that I've had success with tricky dedicated server issues as I'm not well versed in how to handle locality issues despite reading multiple multiplayer scripting guides! And a switch would clean it up nicely, got carried away with copy/paste ;) Thanks, Richard EDIT: I see where your headed now; Very much appreciated and I'll withhold further comments until I review your critique.
  6. Sorry for the delayed response. I have not been on arma lately but will check it out as soon as I can and hopefully get a fix up. And yes it was working pre-patch. I'll do some digging and let ya know. EDIT: I tested in a local MP session and it worked fine. But unable to test in a dedicated server environment at the moment.
  7. Been busy but finally got around to adding the abandoned vehicle check. Also included the code for checking names of vehicles so you can separate actions per vehicle. MHQVehicleInitExt V1.0 Link is also on the first post of the thread. Distance check is only set to 20, so you can see it in action and so I could test it out. It will also only check for one side. Let me know if there's anything else to add or fix and I'll put her on my todo list.
  8. I will look into running a deserted check and make that part of the extended version I suppose. Won't be hard to implement, it's just the frequency of running a player within area check is what I'd like to play with or atleast leave it easily adjustable. Not sure when I'll get around to implementing that though.
  9. The cold is full blown so been pretty slow the past couple of days. What you summed is up is pretty much it, the Trig involved really isn't complex once you refresh or learn the basics. In order to rotate everything we just need to find the distances from the corner points, or the center point and run that through a small calculation to get what the point will be after rotation. The Khan Academy got me brushed up and can definitely explain it all better then I. The points that the wall builds off of are not necessarily the corner points since they have to accommodate for the width of the walls and the origin of the walls model. The section count is used for calculating the points and the length and width of the FOB since each wall may vary in length. The idea is to have something flexible enough to use different types of walls in the future. We use the wall type's length to calculate the length of the FOB since it will not be equal to the exact marker size input. So, placing the buildings in the FOB will require coming up with a fraction or percentage of length or width from corner x, or from the center coordinate aka marker location. If you want a helipad 1/4 of the width away from the upper left corner or c1 then it'd be, for x: c1 - 25, for y: c1 - (width * 0.25), for z: _mZ < the -25 is just an estimate and would move the helipad 25m from the back wall. I get the x and y confused alot since this FOB gate is on the West wall. I think X was running the length of the FOB and Y is running the Width. N/S should be the Y axis and W/E should be the X axis in game. Just recalling from memory so hopefully it's mostly correct :) Perhaps once I get the towers set it'll give you an example to work off.
  10. Kabs, I am unsure of what your requesting. Could you expand on left behind vehicles.
  11. _H = createVehicle[_Towerzz ,[ ((_c4 select 0) + 0), ((_c4 select 1) + 0), _mZ],[],0,"CAN_COLLIDE"]; // Should be - for HQ _H = createVehicle[_HQ,[ ((_c4 select 0) + 0), ((_c4 select 1) + 0), _mZ],[],0,"CAN_COLLIDE"]; And Mwidth should be _wWidth I'll work on putting the building locations into a separate file. Also, if it helps you can build the templates however your comfortable and I'll work on converting them into something that's scale-able afterwards.
  12. No rush. I just finally resolved my rotation issue, was something extremely simple that I missed, but still need to redo the height code and then clean up the code so it'll take me a bit as well. edit -- The code is not cleaned up yet but I need you to look at it how to reference the placement of the objects within the FOB. As it is now, the wall will rotate but the towers have not been coded to rotate properly yet but I'm burnt out on it for the day. There's 4 corner markers that I've placed down that represent the corners of the FOB, these are the markers to do distance adjustments on. Or, you can do adjustments from the center coordinate as well. I tried to explain a bit better in the script too. I'll be continuing to re organize this script and perhaps add a few more functions to tidy everything up but didn't want to get too far into creating all of the templates with out first checking out how they need to be referenced now. FOB-DownLoad Also, I'm considering moving the object placement into another sqf file, since it'll make it cleaner and easier to modify the templates for the different sizes.
  13. Will get around to checking out the 11x11 some time today. I've got some of the stuff working for rotating but need to rebuild the code that builds the walls to accommodate for it plus figure out some extra stuff that goes along with it. Just looked at your code and see a problem with _Width = round floor (_markSize select 1); // ^ This variable was actually used to count the number of sections which is used _Yspacing = (((_Width + 1) * 5.6) - 4) * 0.5; // Orig _Width = round floor ((_markSize select 1) / 5.6); The variable's name is misleading and should be changed. I see your using the length and width of the marker for setting placement of the other objects so I'll just rename it to sectionCnt or similar.
  14. @Kabs, Good to hear it's working. As Doodle pointed out, perhaps the setObjectTextureGlobal command is what your looking for? A lot of things I've yet to tinker with and locality is one of those things that I can only learn through experience. But when you find a solution to something like that please do post what worked for you, may help the next guy. @Doodle, If you'd like to add further conditions to the actions you can do so in the function itself. You'll notice I've structured the function into 3 lines for the action, - the first is the name and sqf to execute - second line is the Bis stuff that generally stays the same for most actions: arguments, priority, showWindow, hideOnUse, shortcut - the third line is the condition that must be true for the action to be available more detailed info needed: addAction Now if you'd like to make it so that you can only use the action while outside of the vehicle than you could try: Change the == to != to make it so you have to be inside of the vehicle. I believe their was a vehicle cargo command to so you could possibly set up so that only players in the cargo could use the actions while inside of the vehicle. Do not recall the exact command off the top of my head.
  15. Fixes - MHQ_vehAction2 publicVariable named incorrectly - Multiple if(_state == 1) not necessary - Closing brackets on those if statements were missing - Declared all name checks outside of the scope if(_state == 1) - easier to read - Declared a new variable _nameCheckAll which adds all of the arrays together for the final if not in nameCheck - Updated the vehicle spawn to use the createVehicle array - undefined variable _heli changed to _vehicle - think that about sums it up Do note, this is untested code but should work, if not let me know and I'll put in some hints for you to check out where the code breaks down, or you can insert those hints yourself.
  16. I messed up when getting the size of the marker. Completely slipped my mind that the markers use radius instead of diameter. So, the fixed code is _Length = round floor (((_markSize select 0) * 2) / 5.6); _Width = round floor (((_markSize select 1) * 2) / 5.6); That might fix the large Icon issue! And yes my markers are scripted, except for the FOB atm since it's in production phase. However, there's a good chance that the "5.6" measurement will change. Just found that I can actually get the size of an object and then compute from there which is what I'll be working on later. So, the hard measurements that I've defined will likely be replaced with variables. That way you could change the type of wall if needed too. I've simplified the rotating issue, but I still need to brush up on some math before I can start piecing that portion together. I did test out one wall and was able to align it, but I just used estimates for the placements instead of trig. Hopefully when you get the sizes down and their default designs I'll be done with the rotation so we can merge the results. Depending on my cold and the weather it may take a few days though. Gonna have to go look for pictures of vehicles on buildings now, lol.
  17. Not sure if this will work since I'm still learning arma scripting but may be worth a shot to see if it improves performance. Also note that I have not tested this code, and the "_x" parts is the area I'm unsure of, I usually have to test it out a few times to get those _x references down. For your client side performance issue. Perhaps you should exit this script at a given time and then restart it? Maybe that'd help. Edited script to remove semi colon's, and thank you F2k Sel.
  18. Lol, got a kick outta the x-mas morning analogy. - Could always set the marker to border and get the same effect. I like using the markers since I feel as though I have more control with them, and I've got some other stuff going on with markers. - An entire vehicle on top of the HQ huh, hmm, I'd have to see that one. Sounds cool, but not sure how authentic it'd feel, lol. - The 1/6 ratio is due to the fact that each h-wall is roughly 5.6m long. The entrance is off centered if there's an even number of wall sections on the front. Did it that way because my mind blanked out when I was thinking of possible scenarios and spacing issues for leaving the entrance exactly in the middle and being exactly x in size and if there'd be exactly x space left over for all of the h-walls to fit perfectly. Just figured one section removed would be the easiest for placing other things near the entrance. I tried searching around for how to rotate multiple objects as a group and didn't come up with anything, I thought there'd be a few commands for accomplishing such task. The only alternative I see is to actually do the math behind it and I'm pretty rusty in the trig area. And no I am not offended by "We". Was actually wondering the same thing, felt as though I perhaps "overstepped" for lack of a better word.
  19. Was reading through the command list for something and found one for enableCoPilot! So, all that has to be done for the copilot issue is to add this enableCopilot false; To the vehicle's init or similar.
  20. Here's something cool! I've now set it up to take the input from the size of the marker to build the FOB. All that is needed now is to figure out how to rotate all of these objects as one, and add in some of the other buildings like the HQ and helipad if the FOB is bigger then some set size. A 60 x 60 marker will give you a 10 x 10. Smallest I've tested was a 20 x 20 but that was before I added the towers. With the towers, a FOB that small is pretty funny looking. Will have to add some minimum size checks as well. Only removed a section for the "gate" or entrance for now as well. I'm not sure if this is what your after, but this is similar to what I had in mind for setting up a generic FOB that could serve as a template for others to build off of. To rotate the entire thing, these objects are probably all going to have to go into an array and then use some sort of transformation, but unsure of what is available in arma for that sort of thing.
  21. I've created an sqf file that contains multiple pre-defined arrays of what I'm considering strategic locations. What I have so far is: bld_Barracks = []; bld_CargoHouse = []; bld_Factory = []; bld_HQ = []; bld_MilOffice = []; urb_Capital = []; urb_City = []; urb_Village = []; All arrays have been sorted for left to right calculations. Simply meaning, the furthest left village on the map is the first index and the last village on the right is the last index of that array. I've found that searches for markers seem to be a lot quicker then searches for buildings, or locations. Not verified, just observation. Creating these arrays has cut my load time down significantly, as compared to running a search on init. I've also setup a function for searching for the nearest marker and some other nifty stuff. From what I've noticed, there's quite a few people who are doing similar things and figured this could come in handy for anyone who has not set up something similar. I keep finding more and more things that can be done with markers each day! My next step is add in the hills, or peaks that are labeled on the map, helipads, open areas near towns and other sorts of useful areas. But, those things are extra's that aren't as commonly used. One other note is that all building markers are for building pos 0, that may come in handy for enter-able buildings. The only thing I'm not satisfied with so far is how many times I'm repeating createMarker and the like! Just haven't quite figured out how I could simplify that process into a function that'd be simple yet flexible. Also, what I couldn't figure how to do is to create an array that stores positions and names, and how to call such an array for what I wanted it for. Instead I've created arrays for the locations of the urban areas and the names seperateley, which are then combined upon marker creation. Think that pretty much sums it up, have something to add, let me know. Any questions, go ahead. Hopefully someone will find it of use. strategicMarkers If your interested in doing it yourself, then check this Link
  22. For distances, I went ahead and put the rest of the walls into loops and had to make various, but small adjustments to some of the starting points and such. And I see the reason for the gl's now. Didn't think of that as an alternative to the missile launchers.
  23. The 0 = 1 still throws me off at times too. And I deal with it on a daily basis in networking. The organization makes sense now! Ah, now I see what your saying. You could just adjust it to -50 and +50 for those or vise versa, lol. I don't know why it's defaulted that way, I assumed you built it, but now I see in the first post that your deciphering various scripts. So, who ever built it probably just copied the code from the build into a file and called it good? From what I'm seeing on it, all distances need to be tweaked and I keep tinkering with it off and on as well. I like the design of this fob excepts for the gate and the grenade launchers. To rotate all of it, I'd imagine it would be a combination of markerDir and such. Not sure how to tackle that one yet though as I've not dealt with modifying objects that way yet.
  24. Just a minor update, changed createVehicle to use the createVehicle array instead which is stated to be faster.
  25. Added some comments and hints to try and help ya visualize what's going on. Sorry about jumping the gun there, assumed you had some prior programming knowledge since your script was well organized. Assuming your unfamiliar with a for loop then, a for loop lets you define a variable, {_i = 0}, set a condition to run the loop until that condition is false {_i < _sideLength} and you can set it to increment _i after it runs through it's block of code {_i = _i + 1}. If you still have troubles with it then I'd recommend checking out some starter C++ tutorials to at least get familiar with the basics since majority of that will transfer to arma. And disregard the setting up a function. Looking at it, all of your stuff is offset at different values or starts at a different value for your positions. Just try to apply what I posted to the rest of the walls and then take it from there. Also, I don't get what your saying about two different numbers for the guard tower.