Jump to content

Joshii

Member
  • Content Count

    173
  • Joined

  • Last visited

  • Medals

Everything posted by Joshii

  1. Joshii

    ALICE Spawn inside buildings

    # "ALICE_population" = <array>; - list of all civilians in town # "ALICE_populationActive" = <array>; - list of all active civilians in town (e.g. civilians who are outside) You can work with these two and figgure out something I guess.
  2. Gonna write you an example when I got my arma running again.That's in about 2 hours.
  3. Short form pseudo code: -Event Handler fired -Figure out what type of object was fired if(smokegrenade) then getPos _this select X Then you got it! questions? Ask!
  4. _impact = _this select 0; _ammo = _this select 1; _rnds = _this select 2; _count = 0; serial = 0; hint "INCOMING"; // For Testing Purposes & can be removed. //------------------------------------------------------------------------------------ while { _count < _rnds } do // Infinite loop. { _randomnumberx = ceil(random 2); // Creating a random number result is either 1 or 2. _randomnumbery = ceil(random 2); // Creating a 2nd random number. _impactx = getPos _impact select 0; // Assigning the x value of the impactzone to the variable. _impacty = getPos _impact select 1; // Same with the y value. switch(_randomnumberx) do // Using the random number to either add or subtract an ammount to / of the x value otherwise the artillery would always be infront or behind the player. { case 1: { _impactx = _impactx + (random(100));}; // If 1 is the random number. case 2: { _impactx = _impactx - (random(100));}; // If 2 is the random number. }; switch(_randomnumbery) do // Using the random number to either add or subtract an ammount to / of the y value this will make the impact left / right random. { case 1: { _impacty = _impacty + (random(100)); }; case 2: { _impacty = _impacty - (random(100)); }; }; _shellname = format ["shell%1", serial]; // Formating a unique round name. _shellname = _ammo createVehicle ([_impactx, _impacty, 10]); serial = serial + 1; // Changing the round "serial" so the name stays unique. hint "SPLASH"; // For Testing Purposes & can be removed. _count = _count + 1; sleep random 5; // Adjusts the amount of time between impacts. }; Issues fixed. It was 1. You did not set serial = 0; 2. _scpt1 = [target1,"B_30mm_HE",16] execVM "FireSupport.sqf"; 3. Getting the position was forgotten in your I changed that and added getPos at @ _impactX and y 4. Please note getPos only works if its an object not a marker if your using a marker change it accordingly ( Put it in a string and change it to getMarkerPos
  5. It wasn't meant like "Eat my script or die!" More like take it as an example. I like the fact that you wanna learn instead of begging others to do work for you. while{condition} do {code}; The loop ends as soon as the condition = false while { ammount < rounds } do // Infinite loop My // Infinite loop command is not accurate anymore sorry for not changing I just realized. The script get started with [5] execVM "RandomArtillery.sqf"; In that case 0 < 5 = true after 3 runs 3 < 5 = true after 5 runs 5 < 5 = false While loop stops Edit your version 2: hint "INCOMING"// For Testing Purposes & can be removed. Forgot the ; hint "INCOMING"; // For Testing Purposes & can be removed. Also in line 29 the other hint hint "SPLASH"// For Testing Purposes & can be removed. for the ; hint "SPLASH"; // For Testing Purposes & can be removed. Also the way you call it You save it all as a string even though that not all of it are strings the " " defines if it's a script or not. i.e [10, "5"] execVM "example.sqf" example.sqf a = _this select 0; b = _this select 1; while{ a < b } Output : ERROR EXPECTING NUMBER GOT STRING (( Or something like this )) Reason: "5" gives the 5 over as a string and not a number while 10 is a number so using [10, 5] execVM "example.sqf"; would work
  6. You have hint "SPLASH"/ For Testing Purposes & can be removed. instead of hint "SPLASH"; // For Testing Purposes & can be removed. I changed it but it is still not working so there is another issue with your script. THis entire line for [{_count = 0},{_count < _rnds},{_count = _count + 1}] exitwith {_check = false}; Is redundant just use my script like this and it works explosive = "B_30mm_HE"; // Type of weapon ammount = 0; // Counter to get unique vehicle names rounds = 0; _rounds1 = _this select 0; rounds = rounds + _rounds1; // To avoid problems if the script is called multiple times. while { ammount < rounds } do // Infinite loop { impactZone = getPos player; // Impactzone _randomnumberx = ceil(random 2); // Creating a random number result is either 1 or 2 _randomnumbery = ceil(random 2); // Creating a 2nd random number _impactx = impactZone select 0; // assigning the x value of the impactzone to the variable _impacty = impactZone select 1; // same with the y value switch(_randomnumberx) do // Using the random number to either add or subtract an ammount to / of the x value otherwise the artillery would always be infront or behind the player { case 1: { _impactx = _impactx + (random(100));}; // If 1 is the random number case 2: { _impactx = _impactx - (random(100));}; // If 2 is the random number }; switch(_randomnumbery) do // Using the random number to either add or subtract an ammount to / of the y value this will make the impact left / right random. { case 1: { _impacty = _impacty + (random(100)); }; case 2: { _impacty = _impacty - (random(100)); }; }; _vehiclename = format ["shell%1", ammount]; // Formating a unique name _vehiclename = explosive createVehicle ([_impactx, _impacty, 10]); ammount = ammount + 1; // Changing the ammount + 1 so the name stays unique sleep 0.5; // So it's not 10 impacts per second and CPU cooldown }; Modified - 4:08
  7. http://forums.bistudio.com/showthread.php?t=74849
  8. http://community.bistudio.com/wiki/Dialog_Control If you manage to do it with Dialogs then you have clearly chosen the best option if not just use BIS_Communication stuff. Addaction should also work if you just put in the right conditions. There is another thread just about this http://forums.bistudio.com/showthread.php?t=109547
  9. http://community.bistudio.com/wiki/list http://community.bistudio.com/wiki/forEach http://community.bistudio.com/wiki/addEventHandler _tlist = list _triggerOne; {_x addEventHandler ["killed", {_this exec "playerKilled.sqs"}] } forEach _tlist or something like this.
  10. Ye right.. My variable names probably were not as clear. So I will explain the stuff right now. boompos = getMarkerPos "boom"; // Right this is just the marker position from where the random is added. explosive = "Mine"; // Ammo type used in my case it's "Mine" you can change it to "ARTY_Sh_82_HE" though value = []; // This value is just to create markers for my mine field. You can simply just delete this if you only want random mortars. done = false; // This was my value to stop the artillery impact at some point. In my case it's executed when the markers are created. ufa = 1; // Just a counter to later on get names for the markers. Not necessarily needed while { !done } do // While loop running whilst done is false. { ufa = ufa + 1; // Starting to count how many times it's running. sleep 0.1; // A sleep of 0.1 s so my CPU can cool down. + Otherwise it would be pure spamm it might be usefull to change this if you do not want an artillery shell every 0.1 seconds _x = (boompos select 0) + random 1000; // x position of the marker + random 1000 _y = (boompos select 1) + random 1000; // y position of the marker + random 1000 _z = 0; // height of a mine = 0 usefull to change for artillery though so you actually see it dropping randomPos = [_x, _y, _z]; // This is the position array it's [x,y,z] string1 = format ["T%1",ufa]; // Formating a string so later on I could create markers. string = subammo createVehicle (randomPos); // Finally creating the impact value = value + [randomPos+ [string1]]; // Saving the co-ordinates + the name of the shell in an array. // e.g with 2 shells this array looks like this // [[0,0,0, T1], [1,1,1, T2]]; // So if I do select 0 I had an array of [0,0,0, T1] the name of the first impact. // This means I can call the positions of the array with select 0, 1, 2 and the name with select 3 // This is however not really important for an artillery script }; // Ending the while loop // Now this script was executed for me when I had enough mines placed. // I always had a hint running so I saw how many mines I had done = true; // Ending the while loop bd = count value; // Counting how many mines I had counter = 0; // Setting a counter to 0 while { bd != counter } do // While loop running while counter has not reached the last mine { t1 = format ["a%1", counter]; // a name for the marker it has to be unique so it's the counter number plus the letter "a" t1 = createMarker[value select counter select 3,[value select counter select 0,value select counter select 1]]; // The line above this is // String = createMarker [name, position] // String = t1 name = value select counter select 3 - Cause as said before select 3 always gives me the name of the mine // position = value select counter select 0,value select counter select 1 - This gives me the x and y co-ordinates of a marker t1 setMarkerShape "ICON"; sleep 0.01; // Sleep so my CPU won't over kill value select counter select 3 setMarkerType "DOT"; value select counter select 3 setMarkerText t1; // Creating the marker counter = counter + 1; // Adding +1 to the counter when the mines if done }; I agree this is not needed if you only want artillery still it's cool to learn how arrays work :P Anyhow I will post an "artillery only" script here in about 10 minutes or so. Edit1: For your post above mine your using SQS syntax in SQF. e.g Loop is not SQF http://community.bistudio.com/wiki/SQF Edit2 artillery script : explosive = "B_30mm_HE"; // Type of weapon ammount = 0; // Counter to get unique vehicle names while { true } do // Infinite loop { impactZone = getPos player; // Impactzone _randomnumberx = ceil(random 2); // Creating a random number result is either 1 or 2 _randomnumbery = ceil(random 2); // Creating a 2nd random number _impactx = impactZone select 0; // assigning the x value of the impactzone to the variable _impacty = impactZone select 1; // same with the y value switch(_randomnumberx) do // Using the random number to either add or subtract an ammount to / of the x value otherwise the artillery would always be infront or behind the player { case 1: { _impactx = _impactx + (random(100));}; // If 1 is the random number case 2: { _impactx = _impactx - (random(100));}; // If 2 is the random number }; switch(_randomnumbery) do // Using the random number to either add or subtract an ammount to / of the y value this will make the impact left / right random. { case 1: { _impacty = _impacty + (random(100)); }; case 2: { _impacty = _impacty - (random(100)); }; }; _vehiclename = format ["shell%1", ammount]; // Formating a unique name _vehiclename = explosive createVehicle ([_impactx, _impacty, 10]); ammount = ammount + 1; // Changing the ammount + 1 so the name stays unique sleep 0.5; // So it's not 10 impacts per second and CPU cooldown }; Tested and working if you have any questions feel free to ask.
  11. I made one too for minfields but well still feel free to read and understand. test1.sqf / This creates the mines boompos = getMarkerPos "boom"; explosive = "Mine"; value = []; done = false; ufa = 1; while { !done } do { ufa = ufa + 1; sleep 0.1; _x = (boompos select 0) + random 1000; _y = (boompos select 1) + random 1000; _z = 0; randomPos = [_x, _y, _z]; string1 = format ["T%1",ufa]; string = subammo createVehicle (randomPos); value = value + [randomPos+ [string1]]; }; test2.sqf // This marks the mines on map done = true; bd = count value; counter = 0; while { bd != counter } do { t1 = format ["a%1", counter]; t1 = createMarker[value select counter select 3,[value select counter select 0,value select counter select 1]]; t1 setMarkerShape "ICON"; sleep 0.01; value select counter select 3 setMarkerType "DOT"; value select counter select 3 setMarkerText t1; counter = counter + 1; }; just for your information: You gotta change 2 things to make it an unlimited artillery instead of a limited mine field. Need help? Post back!
  12. With or without ACE? With ace it's simple. Without ace it's simple aswell but well.. different to manage.
  13. Make your script more readable and instead of doing the same thing 100 times just use a while loop with variables.
  14. That's quite weird. For me I start up in the A-10 drop any bomb on the right a hint appears and count the meters till impact at 30 it stops switches over to the bombing part and does it all well. Could you by any chance clear your arma2.rpt restart the mission and post me your rpt in here when your done?
  15. You possibly saved it as .sqf.txt make sure to let windows show known file extension in your CP and try again.
  16. Maybe you did something wrong? I dunno anyhow here is my test mission it's working fine for me. However be sure to be at above clusterheight in my case 70 meters when dropping it otherwise it wont work. Cluster.Desert_E http://uploaded.to/file/3ln3ar ______ I will just pickup some of your ideas and state my point to them. Well normal weapon is quite simple you can either do an entire addon which would not make it a script anymore. Also I have no idea how that works. The easier way is possibly to just limit the script on one weapon. Smoke is easy to do. I would write a function that is called on each to add smoke to it. Sound is more difficult but not impossible. Different ammo versions is simply done either by a GUI or by a simple menu in the radio.
  17. Here is my attempt - well it's actually working out pretty good. To be done: - Add a check if it's the "clusterbomb" launched cause right now it will do it for ANY weapon including pistols etc. :D Just fix that if you have time. - How to : put an A10 in put this in it's init init of a10 Create a debug.sqf debug.sqf Also I wrote a camera script for watching the explosion but it's not as good :D Just watch it from above that it much cooler. variable explinations subammo = "ARTY_Sh_82_HE"; // Subammo type I am using artillery shells unrealistic but good for debuging as they make a BIG boom clusterbombs = 20; // Ammount of bombs ropped clusterheight = 30; // Height in which the bombs are created height = 100; // Just don't change this number it is just cause I was to lazy to script it better - if you read through it you will see why.
  18. The scripting is fairly simple though just make it BOOM all around the city.
  19. if(driver this != "Name of the guy you want in there") then {driver this leaveVehicle this} or something like this
  20. If you can't find it. Jones, the scripter of Charlie Foxtrot. Wrote this in one of his missisons. pos2grid
  21. I know a lame way to do it. It's not a cool try but it will work very well pos = getPos unit; while {true} do {setPos Unit _pos; sleep 0.25; } It's lame I know.. Or just a while with a if included to check if its moved.
  22. Sorry about the == should be "=" of course. However the trigger was just a way of showing how a waypoint is ONLY executed if something else is triggered before thats why I was talking about the boolean in the trigger that the waypoint needs to be activated.
  23. How to: Waypoint that will KILL YOU WHEN YOU REACH IT 1. Create waypoint put in whatever you want BUT On Act(ivation): reached == true So what we do is, that we create a variable called "reached" and we put its status on true. 2. Create a trigger. Condition: reached On act(ivation): player setDamage 1
×