thestuntman
Member-
Content Count
48 -
Joined
-
Last visited
-
Medals
Community Reputation
10 GoodAbout thestuntman
-
Rank
Lance Corporal
-
Passing variables to an event handler without using globals
thestuntman replied to thestuntman's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Yep correct. I needed the actual heli so only the helicopter that is assigned to the group who dropped smoked responds to it -
Passing variables to an event handler without using globals
thestuntman replied to thestuntman's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Thanks for all the info guys. I have it working well now. All I need to do now is to get rid of a couple more global variables that control whether or not a heli has been called by a particular leader so they can not have 2 in action at once. I will probably use set\getVariable on the group leader for this as it seems to be the easiest way. -
Passing variables to an event handler without using globals
thestuntman replied to thestuntman's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I've changed from using BIS_fnc_spawngroup to using CreateVehicle and spawned the pilots an copilot with createUnit and got them in the chopper manually. Works great now. Still a few things i'd like to tweak to make it work better in MP so each group leader can call their own chopper. -
Passing variables to an event handler without using globals
thestuntman replied to thestuntman's topic in ARMA 3 - MISSION EDITING & SCRIPTING
OK so I have everything working now (Thanks for the tip albertfish) apart from a couple of things. Sometimes the heli has issues when moving from it's hover position into the landing position. Depending on where the smoke is thrown, sometimes it will not land at all, or will land and then takeoff again and land somewhere else. I think this has more to do with pathing and AI flying than anything else. Also the heli seems to spawn mid air, any way to make it spawn on the ground? -
Passing variables to an event handler without using globals
thestuntman replied to thestuntman's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I need to be able to access a few variables defined outside the EH inside the EH. Once the EH fires and gets the location of the smoke, I am creating WP's that need to be assigned to the heli. As the heli is spawned outside the scope of the EH, i was having difficulty getting to it inside the EH itself. Basically, when a group leader calls in an evac, they "own" that heli, and I need to the heli to only respond to smoke thrown by that group leader (or member of that group) @Iceman77. Ill give something like that a shot. Thanks! -
Passing variables to an event handler without using globals
thestuntman posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Basically, i'm trying to make a heli evac script that can be called by group leaders. I need the script to be able to be called by more than one leader, as each group will have it's own chopper that is dynamically spawned. This is what I have for the function to add the EH so far. EVAC_Heli_addEventHandler = { args = _this; _heli = _this select 1; _helicaller = _this select 0; _idx = _helicaller addEventHandler ["Fired", { if ((_this select 4) != "SmokeShell") exitWith {}; _null = (_this select 6) spawn { _posg = getPos _this; sleep 0.5; while {(_posg distance (getPos _this)) > 0} do { _posg = getPos _this; sleep 0.5; }; _heli sideChat "Smoke seen. Landing now"; }; }]; }; _heli sideChat "Smoke seen. Landing now"; does not work as _heli is out of the EH's scope. I can use globals to get the actual "name" of the the chopper, but Alpha 3-2 sideChat "Smoke seen. Landing now" obviously doesn't work either. I ahve tried using set\getVariable with the group leader and this works to the same extent. I can pass the variable values (such as the chopper name) onto the EH, but that is not what I need. Basically the script allows group leaders to call in a chopper, it will move to an area and await smoke until actually landing on the smoke's location for pickup I have the rest of the script working fine (the pickup function etc) but it gets a bit wonky when called by more than one group leader at the same time. I am trying to avoid globals as this will also not work if it is called more than once. I have also tried using format when creating the EH to write the variables into the actual EH when it is first created but this has also had limited success. The whole script so far is viewable HERE -
Need help - Choper evac by smoke
thestuntman replied to KronicBuzzKill's topic in ARMA 3 - MISSION EDITING & SCRIPTING
What would be the easiest way to modify this so that the chopper moves to a spot on the map (selected using onMapClick. I have no problem with this part) and once it arrives at this spot, THEN it starts waiting for the smoke grenade before landing? ---------- Post added at 09:05 ---------- Previous post was at 07:49 ---------- Super messy but it seems to work. Any improvements would be appreciated // SMOKEHELI by kylania with fixes from Larrow // Options. SMOKEHELI_spawnMarker = "heliBase"; // STRING - marker name of where to start and delete the helicopter. SMOKEHELI_helicopterType = "B_Heli_Light_01_F"; // STRING - class name of the helicopter to use. SMOKEHELI_groupType = (configFile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_ReconPatrol"); // CONFIG - CfgGroups entry of preset group // SMOKEHELI_groupType = ["B_Soldier_F","B_Soldier_F","B_Soldier_F"]; // ARRAY - List of classnames to spawn for reinforcements. Option instead of above. SMOKEHELI_SmokeColor = "SmokeShellGreen"; // STRING - classname of the smoke grenade to look for. SMOKEHELI_feedback = true; // BOOL - Yell smoke out like a boss? SMOKEHELI_hovering = false; hoverpos = []; if (isNil "SMOKEHELI_Active") then {SMOKEHELI_Active = false;}; // Function to check for smoke being thrown. SMOKEHELI_fnc_addSmokeCheck = { _spawnPos = getMarkerPos SMOKEHELI_spawnMarker; waituntil {visibleMap}; MapClicked = false; hint "click point on map"; sleep 0.2; onMapSingleClick "hoverpos = _pos; onMapSingleClick ' '; MapClicked = true; true;"; hoverpos = [hoverpos,random 360,[50,100],false,2] execvm "SHK_pos.sqf"; //hoverpos = [(hoverpos select 0)-(100*sin(random 359)),(hoverpos select 1)-(100*cos(random 359)),(hoverpos select 2)]; waituntil {MapClicked}; hint format ["Point Marked: %1",hoverpos]; sleep 1; MapClicked = false; //reset the variable for if you want to do it again // Spawn helicopter and crew. _helisv = [_spawnPos, [_spawnPos, hoverpos] call BIS_fnc_dirTo , SMOKEHELI_helicopterType, west] call BIS_fnc_spawnVehicle; _heli = _helisv select 0; _heliCrew = _helisv select 1; _heliGroup = _helisv select 2; SMOKEHELI_name = _heli; // Spawn reinforcements and get them in the helicopter. // *****Commented out for reinforcements***** //_reinforcements = [_spawnPos, blufor, SMOKEHELI_groupType] call BIS_fnc_spawnGroup; //{_x assignAsCargo _heli; _x moveInCargo _heli;} forEach units _reinforcements; SMOKEHELI_name flyInHeight 50; // Waypoint to the location for heli _wp1 = _heliGroup addWaypoint [hoverpos, 0]; _wp1 setWaypointSpeed "FULL"; // *****Commented out for reinforcements***** //_wp1 setWaypointType "TR UNLOAD"; _wp1 setWaypointType "MOVE"; _wp1 setWaypointStatements ["true", "SMOKEHELI_hovering=true;"]; waituntil{SMOKEHELI_hovering}; _heli sideChat "Evac chopper awaiting confirmation of LZ. Mark it with Green Smoke and we'll bring her down"; // Add eventHandler for tossing smoke from Demonized _idx = player addEventHandler ["Fired", { if (((_this select 5) != SMOKEHELI_SmokeColor) || SMOKEHELI_Active) exitWith {}; // Not green so ignore it. // Green! Lets see where it lands. _null = (_this select 6) spawn { // Get current location of the smoke shell _posg = getPos _this; sleep 0.5; // As it rolls keep updating the location. If it keeps rolling or jitters it's last pos when it disappears will be _posg. while {(_posg distance (getPos _this)) > 0} do { _posg = getPos _this; sleep 0.5; }; // We've come to a stop and know where to fly so lets do it! [[_posg], "SMOKEHELI_fnc_spawnReinforcements", false] spawn BIS_fnc_MP; if (SMOKEHELI_feedback) then { SMOKEHELI_name sideChat "Smoke seen. Landing now"; }; }; }]; }; // Function to spawn helicopter and reinforcements and deploy them. SMOKEHELI_fnc_spawnReinforcements = { private["_reinforcements", "_heli"]; SMOKEHELI_Active = true; publicVariable "SMOKEHELI_Active"; _landPos = _this select 0; _heligroup = group SMOKEHELI_name; _basePos = getMarkerPos SMOKEHELI_spawnMarker; hint format ["Heli: %1", SMOKEHELI_name]; sleep 2; hint format ["Group: %1", _heligroup]; //make sure helipad is at 0 elevation _landPos set [2, 0]; // Spawn invis helipad at the smoke to land on. _helipad = createVehicle ["Land_HeliPadEmpty_F", _landPos, [], 0, "NONE"]; // Waypoint to the location for heli _wp1 = _heliGroup addWaypoint [_landPos, 0]; _wp1 setWaypointSpeed "FULL"; // *****Commented out for reinforcements***** //_wp1 setWaypointType "TR UNLOAD"; _wp1 setWaypointType "MOVE"; _wp1 setWaypointStatements ["true", "(vehicle this) LAND 'GET IN';"]; // Wait till we're out. waitUntil{sleep 1; {_x in SMOKEHELI_name} count units group player == count units group player}; SMOKEHELI_hovering = false; // Release heli from being landed and clean up. SMOKEHELI_name flyInHeight 50; // Join the units to the player's group. // *****Commented out for reinforcements***** //units _reinforcements joinSilent _unit; //Waypoint back to base and delete _dir = [_landPos, _basePos] call BIS_fnc_dirTo; _delPos = [_basePos, 500, _dir] call BIS_fnc_relPos; _wp2 = _heliGroup addWaypoint [_delPos, 0]; _wp2 setWaypointSpeed "FULL"; _wp2 setWaypointType "MOVE"; // *****Commented out for reinforcements***** //_wp2 setWaypointStatements ["true", "{deleteVehicle _x} forEach crew (vehicle this) + [vehicle this]; SMOKEHELI_Active = false; publicVariable 'SMOKEHELI_Active';"]; _wp2 setWaypointStatements ["true", "(vehicle this) LAND 'LAND';SMOKEHELI_Active = false; publicVariable 'SMOKEHELI_Active';"]; deleteVehicle _helipad; }; // Add eventhandler to player. player call SMOKEHELI_fnc_addSmokeCheck; -
I'd like to be able to use AISSP and Simplecache in conjunction with crB unit caching to handle caching of units create outside AISSP. To stop groups being handled by crB, i need to use "group setVariable ["crB_disableCache", true];" this is not hard to add to militarize or fillhouse so that any groups it creates are automatically given this variable. Where would I have to change Simplecache so that the groups it creates (both when it creates the cached groups, and when it recreates the full groups when players get in range) so that they also receive this variable. Would one place be after call compile format["_grp = LVgroup%1;",(str (_ids select _i))]; //get group by adding _grp setVariable ["crB_disableCache", true]; and what other places would this need to be added? if((isNil("LVgroup"+(str (_ids select _i))+"spawned"))&&(_inRange))then{ //hint format ["CREATING: LVgroup%1",_id]; if(_script == "militarize")then{ call compile format["nul = %1 execVM 'LV\militarize.sqf';",_params]; }else{ call compile format["nul = %1 execVM 'LV\fillHouse.sqf';",_params]; }; call compile format["LVgroup%1spawned = true;", (_ids select _i)]; Could I add call compile format ["%1 setVariable ['crB_disableCache',true", LVgroup"+(str (_ids select _i))+"spawned"];"
- 586 replies
-
- ai spawn script pack
- aissp
-
(and 1 more)
Tagged with:
-
I seem to be having an issue lately and i'm not sure what is calling it. I don't remember having any issues before. When calling for example [["task_2b","task_2a"], "Testing a new task", "Test Task", "", getMarkerPos "task_2b"] call FHQ_TT_addTasks; or even ["task_2b", "Testing a new task", "Test Task", "", getMarkerPos "task_2b"] call FHQ_TT_addTasks; from a trigger, I am getting the error { if ((_x call FHQ_TT_getTaskName) |#|== _this) exitwith {_result = true;}; } Error Generic error in expression in line 507 of fhqtt.sqf Not sure why this is happening as I've used exactly the same call in a trigger before and I've never seen this error before Edit: My bad. forgot the "[west," part of the call... Not enough coffee atm
-
Still seem to be having some issues with drag. It works for some players but not others. Any ideas?
-
Thanks for all your hard work with the script but there still seems to be the same issues. I'd imagine it would be hard to get it working without being able to test it. Using this call: nul= [amb1,"mkrAmbush","track","AMBUSH","AMBUSHDIST:",3] execVM "scripts\upsmon.sqf"; The AI placed the mine on the nearest road, then ran about 300m away from where the mine was placed in a random direction. using nul= [amb1,"mkrAmbush","track","AMBUSH","AMBUSHDIR:","SOUTHWEST","AMBUSHDIST:",10] execVM "scripts\upsmon.sqf"; They placed the mines in the same spot as the other call, and then ran around 200m or so to the Northeast. They grouped up together, standing up, and then finally went prone about 20 seconds after the mines had already destroyed the vehicle that hit it
-
Issues with getting a JIP script to run
thestuntman posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hey guys. I've been playing around with a mission for my clan to play but I'm having some issues with getting one of our JIP scripts to run Basically, there will be a number of random start points where the mission can begin. I've got that part working fine, and it also transports the JIP flag along with the players. The mission is far from finished. I know how I am going to handle everything else in the mission, it's just the problem with the JIP script holding me up. Basically all the script does is to allow you to choose a player to JIP onto, as well as giving you options to leave group, and join a different group. This gives us options on the fly to reorganise groups when starting a mission without having to restart. a series of addActions are added to a flag pole named BTC_base_flag_west ( we are using BTC Revive Script ) My issue is that when execVM "Required_Scripts\val_jip.sqf"; is called, it doesn't add any actions to the flag pole. This script needs to be run for all players, including JIP players I've tried everything from using call compile preProcessFile "Required_Scripts\val_jip.sqf"; and then using Bis_fnc_MP to call the function remotely for every client, to execVM'ing it at the top of init.sqf At the moment as a workaround, i have made JIP place the player at the random spawn location that was chosen at the start of the mission. Is it possible that it's not working as I'm the only player on the server? I'm testing it on my PC using the dedicated server so all the isServer stuff works. I've uploaded the mission HERE -
It still seems a little off. When i tested it, the mines were placed, the UPSMON units chose a spot to move to which seemed to be in the correct direction but also seemed a bit too far away. Once the mine ran off, they continued running towards this spot even though the enemies that set off the mine engaged them. It's like the UPSMON units completely ignore combat and being shot at until they reach the point that is chosen as the ambush spot. It seems to work a little bit better if you give the AI lots and lots of time to setup, but this makes it very hard to have an ambush set off by a vehicle setting off a trigger for example. By the time the vehicle reaches the ambush site, the UPSMON units are still running away to get into position and ignore the fact that they have just blown up a vehicle and are now being shot in the back by it's occupants.
-
Cool thanks. I will test it tomorrow. It's not just the random position of the spawned units that i'm worried about, it's also the number of units and their classes as well. There's plenty of other workarounds but I'd like to keep the number of scripts\scripts I have to write myself to a minimum
-
I'm trying to use some of the functions from Na_Palm's version of the scripts, specifically from LV_fnc_menGroup.sqf. My init.sqf contains if(isNil("LV_ambientCombat"))then{LV_militarize = compile preprocessFile "LV\ambientCombat.sqf";}; which in turn contains if(isNil("LV_menGroup"))then{LV_menGroup = compile preprocessFile "LV\LV_functions\LV_fnc_menGroup.sqf";}; so theoretically I should be able to use _grp = [getPos ambushmarkerSpawn, 0, [10,3]] call LV_menGroup; hint format ["Leader: %1",_grp]; as LV_menGroup returns _leader which should be the leader of the group. My issues is that in my code, the hint comes up as Leader: any which would mean that _grp is undefined, which in turn means that _leader was not returned correctly from LV_menGroup. From what I can see I am calling LV_menGroup exactly the same as it is called in Na_Palm's ambientCombat.sqf. Also, when setting an ID number, is it possible to later on use something like leader LVGroup1 to refer to the leader of a certain group. I have attempted to but hint format "Leader: %1, leader LVGroup1"; returns a strange hex value, and LVgroup1 itself returns "any"
- 586 replies
-
- ai spawn script pack
- aissp
-
(and 1 more)
Tagged with: