-
Content Count
1304 -
Joined
-
Last visited
-
Medals
Everything posted by twirly
-
Function script problems
twirly replied to BomboBombom's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
I just modified a function I had here that returns a buildings ID to now return a buildings Type. The function is fed a building and it will return "wall" or "ind" or "shed" extracted from the classname. Not sure how much use it is to you but seemed to be along the lines of what you needed so here it is. The code alone might help you work out what you need. fnc_getBuildType To compile the function and have it available for use put this in your init.sqf.... fnc_getbuildType = compile preprocessFile "fnc_getBuildType.sqf"; Use like this.... _buildtyp = [_build] call fnc_getbuildType; There is a Demo Mission here. -
Weapon to Backpack - Save Loadout - Player/Weapons Respawn Problem
twirly replied to A-SUICIDAL's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Sorry to confuse you mate.... thought you could piece it together :) Changed it a bit more.... changes in red. _unit = _this select 1; _weapons = weapons _unit; _magazines = magazines _unit; [color="#FF0000"]_backpacktype[/color] = typeOf unitBackpack _unit; [color="#FF0000"]_backpackmagazines = getMagazineCargo (unitBackpack _unit); _backpackweapons = getWeaponCargo (unitBackpack _unit);[/color] savedloadout = [_weapons,_magazines,[color="#FF0000"]_backpacktype[/color],_backpackmagazines,_backpackweapons]; hint "Loadout Saved"; Thing is getMagazineCargo _backpacktype will not work because it's like saying getMagazineCargo "Assault_Pack_EP1" which is trying to get the magazines from a string and not an object. unitBackpack _unit would be the actual backpack... so is an object. You can get the contents of the backpack object. typeOf (unitBackpack _unit) would be the type of backpack... so is a string. No way to get contents from that. Hope that makes sense. Also... just noticed the first line is _unit = _this select 1;.... which maybe should be _unit = _this select 0; to select the first element that was passed to the script. ---------- Post added at 04:27 PM ---------- Previous post was at 04:07 PM ---------- Have a Birthday to deal with today... but I did start a little test mission to work it out for you. The "save" and "reload" part anyway. Will look at that later on tonight if I get time mate and upload something somewhere for you. If not will be tomorrow. NZ time of course :) -
Weapon to Backpack - Save Loadout - Player/Weapons Respawn Problem
twirly replied to A-SUICIDAL's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Hi mate. Just noticed this error. There may be more but this stands out. In that script you get the typeOf backpack... and not the actual backpack... so trying to get the contents of the typeOf backpack won't work! This should work... _backpackmagazines = getMagazineCargo unitBackpack _unit; -
Function script problems
twirly replied to BomboBombom's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
I did spot _hosues instead of _houses! -
Function script problems
twirly replied to BomboBombom's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
That call should work.... but you can also try changing the code to this.... At the top... //fn_getLootData private["_input","_output"]; _input=_this select 0; [color="#FF0000"]_output=[0,"NIL",0];[/color] ...and then delete this line at the bottom which may be working but looks a bit suspect to me. //BARRACK if (_input=="Land_Mil_Barracks_i") then {_output=[12,"BRK",40];}; [color="#FF0000"][s] if (format["%1",_input]=="any") then {_output=[0,"NIL",0];};[/s][/color] _output That way if none of the if comparisons are true... _output will remain set to [0,"NIL",0] ---------- Post added at 12:11 PM ---------- Previous post was at 12:01 PM ---------- I forgot to add that a function can call another function...no problems. -
CBA_fnc_getNearestBuilding confused
twirly replied to 1para{god-father}'s topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Like this if you want to store the marker positions in the array... mymissionmarkers set [count mymissionmarkers,getmarkerpos _mkr]; -
Way to adjust the rotation speed of aiming when i am gunner of a vehicle!
twirly replied to dimdic's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
As far as I know the only way to do this is to create an addon.... can't be done with script. -
spawngroup spacing
twirly replied to hogmason's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Good info... didn't know this. Cheers mate. -
spawngroup spacing
twirly replied to hogmason's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
By not using BIS_fnc_spawnGroup and doing it the harder way... spawning one at a time and spawning and moving in the troops. I was thinking that maybe you could spawn them somewhere else and then move them and line them up. That would be easy enough... but using BIS_fnc_spawnGroup... they spawn on top of each other and are being damaged in the process. It's pretty obvious to me that BIS_fnc_spawnGroup is not meant to spawn multiple vehicles. -
spacing between 2 spawned markers
twirly replied to hogmason's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Something like this maybe.... but it is possible that no town will ever be found outside the specified radius. So you have to do the check x amount of times... otherwise it can loop forever! Here the check is done 1000 times. Maybe just grab a random town from the array early on just in case one is not found. _gamelogic = center; _towns = nearestLocations [getPosATL _gamelogic, ["NameVillage","NameCity","NameCityCapital"], 25000]; _town1 = _towns select (floor (random (count _towns))); _convoy_MARKER_start_position = position _town1; _Convoy_start_marker = createMarkerLocal ["startmkr", _convoy_MARKER_start_position]; _Convoy_start_marker setMarkerTypeLocal "mil_start"; _Convoy_start_marker setMarkerColorLocal "ColorRed"; _Convoy_start_marker setMarkerTextLocal "Convoy Start."; //remove it from the list _towns = _towns - [_town1]; _found = false; //try 1000 times to find a random town that is > 2000m for "_i" from 1 to 1000 do { _town2 = _towns select (floor (random (count _towns))); if (_town1 distance _town2 > 2000) then { _convoy_MARKER_end_position = position _town2; _Convoy_start_marker = createMarkerLocal ["endmkr", _convoy_MARKER_end_position]; _Convoy_start_marker setMarkerTypeLocal "mil_end"; _Convoy_start_marker setMarkerColorLocal "ColorYellow"; _Convoy_start_marker setMarkerTextLocal "Convoy End!!!."; _found = true; } else { //not good so remove it from the list _towns = _towns - [_town2]; }; sleep 0.01; }; if (_found) then { hint "Town found"; } else { hint "Town NOT found"; }; -
How to change Colour of Marker once condition is meet
twirly replied to 1para{god-father}'s topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
I'll tackle question 2 for you.... see if I can wrap my head around this. //get a percentage of the count and round it... divide by 3 for 30 percent etc. _count = round ((count mymissionmarkers)/2); //copy the mymissionmarkers list... keeping it intact _oldlist = mymissionmarkers; //make a new blank list that will contain a percentage of the original markers _newlist = []; //randomly select a marker... delete it from the old list so it won't be selected again and add it to the new list //do this _count number of times for "_i" from 1 to _count do { _mkr = _oldlist select floor (random (count _oldlist)); _oldlist = _oldlist - [_mkr]; _newlist set [count _newlist,_mkr]; sleep 0.01; }; _newlist should now contain about 50 percent of mymissionmarkers. Someone may have a more elegant way of doing it but I'm pretty sure that will work. -
How to change Colour of Marker once condition is meet
twirly replied to 1para{god-father}'s topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Hi mate... mymissionmarkers = mymissionmarkers + [_mkr]; or.. more efficient... mymissionmarkers set [count mymissionmarkers,_mkr]; -
setFace for all units on map
twirly replied to Kommiekat's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Sure mate... just change RESISTANCE to CIVILIAN in the script. I also noticed the _unit disableConversation true; line does not work. They still speak. So don't know the answer to that part. EDIT: Here's the same script slightly different. This will change both RESISTANCE and CIVILIAN faces in one go. _allunits = allUnits; _sides = [RESISTANCE,CIVILIAN]; for "_i" from 0 to (count _allunits)-1 do { _unit = _allunits select _i; if (side _unit in _sides) then { _num = 108 + (floor (random 17)); _face = format ["Face%1_PMC",_num]; _unit setFace _face; _unit disableConversation true; }; sleep 0.01; }; -
Erratic AI behavior, some groups follow waypoints, others remain static.
twirly replied to The Hebrew Hammer's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Have you tried smaller groups. Looks like you have about 40 in a group! -
AI respawning - scripted coop mission
twirly replied to G4meM0ment's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Hi.. I'm not following you exactly but you can execute this script from the soldiers init or from another script if you wanted. To execute from the soldiers init add this text. This is supplying all the paramaters for the script and the script is called "respawn.sqf". nul = [this,300,"Spawn_West","",0.8,"PRIVATE"] execVM "respawn.sqf"; I have updated the little test mission to show you two ways to execute the script. Download it and have a look at it. -
setFace for all units on map
twirly replied to Kommiekat's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
OK mate... Create an init.sqf file in your mission folder or add this this to the existing one. If the units are already on the map and are not being spawned it should give you the random faces and hopefully disable the speech for all RESISTANCE (Independant) units. _allunits = allUnits; for "_i" from 0 to (count _allunits)-1 do { _unit = _allunits select _i; if (side _unit == [color="#FF0000"]RESISTANCE[/color]) then { _num = 108 + (floor (random 17)); _face = format ["Face%1_PMC",_num]; _unit setFace _face; _unit disableConversation true; }; sleep 0.01; }; EDIT: **Note** It won't work if the units are being spawned....and you need to change the "GUER" to RESISTANCE with no quotes. Silly me! Now tested! Demo here. -
AI respawning - scripted coop mission
twirly replied to G4meM0ment's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Hey mate.... I was just looking at this again and the stuff in red needs fixing. That could be why the init didn't work. _delay = if (count _this > 1) then {_this select 1} else {5}; _marker = if (count _this > 2) then {_this select 2} else {"Spawn_West"}; _init = if (count _this > 3) then {_this select [color="#FF0000"]3[/color]} else {""}; _skill = if (count _this > 4) then {_this select [color="#FF0000"]4[/color]} else {0.5}; _rank = if (count _this > 5) then {_this select [color="#FF0000"]5[/color]} else {"PRIVATE"}; My stuff up... I made a change on the left but not on the right and didn't test with an init line. -
setFace for all units on map
twirly replied to Kommiekat's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Hi mate... this little loop should do the faces (not tested). It can be shorter but is probably easier to follow like this. I guess you could also use faction instead of side. _allunits = allUnits; for "_i" from 0 to (count _allunits)-1 do { _unit = _allunits select _i; if (side _unit == "GUER") then { _num = 108 + (floor (random 17)); _face = format ["Face%1_PMC",_num]; _unit setFace _face; }; sleep 0.01; }; enableRadio and enableSentences seem to work across the board so not good here. Maybe this will work... but not sure. Just stick it into the if loop above to try it. _unit [url="http://community.bistudio.com/wiki/disableConversation"]disableConversation[/url] true; -
The Internet Oasis' New Series: A Day in the Life Episode 1: "Military Intelligence"
twirly replied to TheInternetOasis's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Hi mate... I think this is the wrong place to post this. This section of the forum is for editing and scripting. Not videos! -
[SP] Battle For Panovo
twirly replied to Metalvenom's topic in IRON FRONT: LIBERATION 1944 - USER MISSIONS
Should have put this here.... but anyway I answered in this other post. -
Adding Mission Edit Protection
twirly replied to A-SUICIDAL's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
@Gunter... Unpacked .pbo zipped and uploaded here if you need it. I used Eliteness. -
AI respawning - scripted coop mission
twirly replied to G4meM0ment's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Hi mate... try this. Tested and working. I changed a few things... like the delay so I could see the respawn happen in a few seconds. Also changed the command for creating the unit (createUnit array). This is more efficient and the other command just plain didn't seem to work every time! Don't know why! if (!isServer) exitWith {}; private ["_unit", "_delay", "_marker", "_group", "_init", "_skill", "_rank", "_type"]; _unit = _this select 0; _delay = if (count _this > 1) then {_this select 1} else {5}; _marker = if (count _this > 2) then {_this select 2} else {"Spawn_West"}; _init = if (count _this > 3) then {_this select 4} else {""}; _skill = if (count _this > 4) then {_this select 5} else {0.5}; _rank = if (count _this > 5) then {_this select 6} else {"PRIVATE"}; _type = typeOf _unit; _group = group _unit; hint "Debug 1"; while {true} do { if(!alive _unit) then { hint "Debug 2"; sleep _delay; //uncomment the next line if you want the unit to be in a new group //_group = (createGroup west); _unit = _group createUnit [_type, getMarkerPos _marker, [], 0, "FORM"]; _unit setrank _rank; _unit setskill _skill; _unit setvehicleinit _init; hint format ["All good!\n\n%1 created",_unit]; }; sleep 1; }; Demo mission here if you need it. -
Vehicle respawn - scripted coop mission
twirly replied to G4meM0ment's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Yes In the editor. Double click on the vehicle and look for the Initialization: text box. -
Ground Vehicle doMove issue
twirly replied to zapat's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
I put together this little test and found that the vehicle will always move unless I give it a path into an area surrounded by forest.... or somewhere with no access, which is how you would expect it to work I guess. It does take a few seconds for the path calculation depending on where the point is... and then the vehicle will either move or it won't. But every time I give the destination as somewhere with some kind of access... it seems to work just fine. Also found this command that I never knew about.... moveToCompleted. Works just fine with the moveTo command. EDIT: I should have added that in the test mission the vehicle moves to wherever you place the red circular marker. -
Creating/spawning an object at a random marker position?
twirly replied to THORFINN's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Try something like this mate... _mkr_array = ["rusartill2a","rusartill2b","rusartill2c"]; _mkr_position = getmarkerpos (_mkr_array select floor (random (count _mkr_array))); _spawn = [_mkr_position, "RU_WarfareBArtilleryRadar", "artil2",55] execVM "mission1a.sqf";