Jump to content

twirly

Member
  • Content Count

    1304
  • Joined

  • Last visited

  • Medals

Everything posted by twirly

  1. twirly

    OnPlayerKilled script

    Another little bit of info.... For those more comfortable with .sqf .... onPlayeKilled can be an .sqf instead of an .sqs!
  2. See if this little demo mission here helps you out.
  3. Check this post here... http://forums.bistudio.com/showthread.php?t=114780
  4. Also...here's a thread that might help you. There's code there to find positions in buildings. http://forums.bistudio.com/showthread.php?t=118983
  5. twirly

    ArmA 2 OA Beta Build 83313

    Can't get stuff out of crates cause I can't look at them!
  6. Just easier to read for everyone. Enjoy Disneyland!
  7. Haven't run the code but glad you got it working mate. Are you structuring your code like that posted above or is it being reformatted when you copy it here? It's pretty messed up! Would look better something like this.... _grp = createGroup _side; //create group //create helicopters if (_type isKindof "helicopter") then { for "_i" from 1 to _maxunits do { [_spwnpos, 180, _type, _grp] call BIS_fnc_spawnVehicle; _grp selectLeader ((units _grp) select 0); _grpvehs = []; _grpDir = getDir (vehicle (leader _grp)); { _vehicle = vehicle _x; if (_vehicle isKindOf "helicopter" AND !(_vehicle in _grpvehs)) then { _grpvehs = _grpvehs + [_vehicle]; _vehicle setDir _grpDir; _vehicle setPos [getPos _vehicle select 0, getPos _vehicle select 1, 150]; _vehicle setVelocity [sin (_grpDir) * 100, cos (_grpDir) * 100, 0]; _vehicle flyinheight 150; sleep 0.5; }; } foreach units _grp; }; };
  8. Hi man... welcome back from wherever! Are you trying to spawn more than one vehicle?. So for instance if _maxunits was 5 .... then five vehicles would spawn? Having a hard time trying to follow the code! EDIT: Added this till I can figure exactly what you need! I think there's other stuff wrong but this is obvious to me. Since we start counting at 0 your for statement needs to be like this to get the correct count. for "_i" from [color="Red"][b]0[/b][/color] to [color="Red"][b](_maxunits - 1)[/b][/color] do { or like this if we start the count at 1.... for "_i" from [color="Red"][b]1[/b][/color] to [color="Red"][b]_maxunits[/b][/color] do {
  9. You have to delete the objects that make up _newobjs..... Try this.... {deleteVehicle _x} foreach _newobjs;
  10. Here mate.... this might help you view the commands without an internet connection. http://www.mediafire.com/file/cv3ktxtfc50vd4g/wiki.zip I'm assuming you can download it to your phone and then get it on to your PC. I used a freeware program called HTTrack. I just randomly chose it... and captured the Scripting Commands page with 1 deep links, so all the commands should link properly. They appear to... so should be fine. Extract the .zip file to your hard drive somewhere. Look for Category_Scripting_Commands_ArmA2.html. Create a shortcut for it somewhere and use that to access the commands in your browser. It's rough but should accomplish what you need. EDIT: Here's a tip mate.... nobody likes reading what you posted. It's a bit hard on the eyes. Use capitals, sentences and paragraphs.... you'll get more help that way.
  11. Try something like this.... if (_type isKindof "helicopter") then { //create two vehicles _grp = [_spwnpos, _side, [_type, _type],[[0,0],[100,-100]],[],[],[],[], random 360] call BIS_fnc_spawnGroup; //select leader _grp selectLeader ((units _grp) select 0); _grpvehs = []; for "_i" from 0 to ((count units _grp)-1) do { _veh = vehicle (units _grp select _i); if (not (_veh isKindOf "Man") and not (_veh in _grpvehs)) then { _grpvehs set [count _grpvehs,_veh]; }; sleep 0.01; }; _spwndir = [(vehicle leader _grp), _movepos] call BIS_fnc_relativeDirTo; for "_i" from 0 to ((count _grpvehs)-1) do { (_grpvehs select _i) setPos [_spwnpos select 0, _spwnpos select 1, 150]; (_grpvehs select _i) setDir _spwndir; (_grpvehs select _i) setVelocity [sin(_spwndir)*100,cos(_spwndir)*100,0]; (_grpvehs select _i) flyInHeight 150; sleep 0.5; //maybe gives enough time so they don't end up on each other! }; }; I probably have that _spwndir in the wrong place but you can figure that out. If you wanted to use foreach instead of the for .... this is how. { _x setPos [_spwnpos select 0, _spwnpos select 1, 150]; _x setDir _spwndir; _x setVelocity [sin(_spwndir)*100,cos(_spwndir)*100,0]; _x flyInHeight 150; sleep 0.5; } foreach _grpvehs; EDIT: I don't think you need the setvelocity if the aircraft are already created and flying... unless you specifically want the speed set at 100 for some reason.
  12. Oh yes. My bad for not reading it through.
  13. Cool mate.... I'll give your routine a little spin later with some cattle for ammo. Always fun!!!
  14. Wow!... It's starting to get complicated! :) ... now you will need code to determine the vehicles in the group. _grpvehs = []; for "_i" from 0 to ((count units _grp)-1) do { _veh = vehicle (units _grp select _i); if (not (_veh isKindOf "Man") and not (_veh in _grpvehs)) then { _grpvehs set [count _grpvehs,_veh]; }; sleep 0.01; }; So now.... instead of using vehicle leader _grp on the group returned from BIS_fnc_spawnGroup... run the code above on the group to get all the vehicles into the array _grpvehs. See if you can figure out the next move!
  15. Here's another little demo where the mortar rounds are created when a trigger marker is entered. Complete with incoming mortar sound whizz. This was a demo I had done for someone previously.... the threads in here somehwere! EDIT: Actually that works with a marker and not a trigger.
  16. Once you get the vehicle that was created using vehicle leader _grp then you can setPos and setDir that vehicle...no worries. (vehicle leader _grp) [b]setPos[/b] [ x, y, 100]; //Height is 100...x and y are whatever (vehicle leader _grp) [b]setDir[/b] _whateverdir; Hope that helps.
  17. You can also use this which is easier. Run this code on each unit. Put it in their init. this [url="http://community.bistudio.com/wiki/allowDamage"]allowDamage[/url] false; You'll still get the blood when hit.... but will be invincible.
  18. I did a little demo here....working fine. You need to use createCenter or have a resistance guy already existing on the map. ZombieHQ = createcenter Resistance; or place a resistance guy anywhere with "deletevehicle this;" in his init. In the demo walk away from the guys that are created right next to you.... they will disappear.
  19. Works fine for groups of one.... but if the guy is the leader of a group of more than one..... it seems he will know about all the targets that the members of his group knows about....even after they are dead and buried! Just today I had a group leader calling artillery on enemy he clearly could not see.... after the rest of his group was dead. Using a nearestTargets list.... and then knowsAbout values of the targets in that list. There should have been no targets in the list to get a knowsAbout from!
  20. Hi mate. You need to initialise any arrays that you are are using in any if's, switch's etc before they will work. Try adding.... _Light_Heli_East = []; _Heavy_Heli_East = []; _type = []; etc... .... for any arrays before the statement where you use them. Tested and working. Use isKindOf to choose between helos and planes and set the flyInHeight. You also need to get the actual vehicle using vehicle and leader on the group returned by BIS_fnc_spawnGroup. if (vehicle leader _grp isKindOf "Plane") then {vehicle leader _grp flyInHeight 200}; if (vehicle leader _grp isKindOf "Helicopter") then {vehicle leader _grp flyInHeight 100}; The aircraft will follow the terrain though....they won't fly flat. No way around that really. You can also use a switch statement for that stuff above. While running the code I realised that you could sort of "boil it down" some.... you only need to check for EAST or WEST once and put all the relevant stuff for each array in each of those checks. Another thing man...try to use the code tags next time... I had to reformat all your code before being able to read it!
  21. Back up your mission.sqm first!!!!
  22. Was trying with foreach and gave up... was taking too much time to figure out! This works though.... _grp1 = _this select 0; _run = true; while {_run} do { for "_i" from 0 to ((count units _grp1)-1) do { _zomb = units _grp1 select _i; if ((_zomb distance player) > 100) then { _run = false; }; sleep 0.01; }; sleep 1; }; {deletevehicle _x} forEach units _grp1; deletegroup _grp1;
  23. You can get the math from the code in this post with a little fiddling..... http://forums.bistudio.com/showpost.php?p=1881211&postcount=5
  24. Some triggers I am creating by code don't work anymore. They trigger as soon as they are created. If not using the beta the triggers work as expected. EDIT: Disregard this.... Not sure what the hell is going on.... need to give it a rest for now I think.
  25. No problems using and' date=' [b']or[/b], not etc...
×