Search the Community
Showing results for tags 'moveincargo'.
Found 3 results
-
SOLVED: "Dirty" vehicle seat after using moveInCargo and variants
kaleb c0d3 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Sup all. I'm asking for advice on a strange AI behaviour using moveInCargo. Scenario: I'm making a teleport module that allows a player to teleport to other player (a quality of life mod to help zeus with players disconnections). The first release of this mod was simple: a custom dialog that let the player pick a teleport location using the others players positions. The problem was when the "target player" was inside a moving vehicle... the teleported player was usually killed by a car accident 😛 In the second release, I want to improve the mod: if the "target player" is inside a vehicle, and the vehicle has free seats, teleport the player to one of these seats. Implementation: If the "target player" is on foot, its a normal teleport (player setPosASL _target_player). If the "target player" inside a vehicle, check for available seats (using "fullCrew"), and then using "moveInXXXXX" (cargo, commander, gunner, etc), "assignAsXXXXX" (cargo, commander, gunner, etc), I was able to teleport the player to one of the free seats on that vehicle. If no seats are available, just a "normal" teleport near the vehicle (TODO: air vehicles?). The problem: When I used one of the "moveInXXXX" functions against a player and a vehicle, the vehicle seat gets 'dirty': no AI can get into that seat anymore. Initially I tought it was some arma-3-wichcraft, a conflicting mod or an error with my code, but taking things to the basic, I was able to reproduce this strange AI behaviour on a fresh & clean mission, without any code. You can reproduce this weird thing like this: Create a new mission. Place a vehicle with only a unit as driver, and set it to "player unit". Place the zeus (curator) module. Start the mission. Get out from the vehicle. Enter zeus, spawn an allied squad (4+ units), and order them to get into the vehicle. You will see that the AI won't occupy the 'dirty' player seat. Try switching player seat in the editor and try again, and you will see how the 'dirty seat' changes. Why is that? Inspecting things a little, and exporting the mission to SQF code, you can see that the Arma 3 engine moves the player unit into a vehicle using "moveInDriver", just like I did it on the teleport code. Another thing is that the problem is consistent using other "base" mods, for example ACE3: if you want to load a prisioner/wounded AI unit into a 'dirty seat', that seat is not usable anymore. Final toughts: I think that the scripted versions of moving a player into a seat does not clear/set certain flags on the vehicle, rendering that position unusable for the AI. Sorry for the long post. Thanks in advance. Solution #1 (edited post @ 05/02/2022): Thanks to @fn_Quicksilver, this is one way to fix this: // Add this at initPlayerLocal.sqf or function with preInit/postInit to fix the 'dirty seat' behaviour. player addEventHandler ["GetOutMan", { params ["_unit", "_role", "_vehicle", "_turret"]; if !(isNull assignedVehicle _unit) then { unassignVehicle _unit; }; }];- 2 replies
-
- moveincargo
- teleport
-
(and 2 more)
Tagged with:
-
player setpos vehicle / player moveInCargo after respawn not working
LoOni3r posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
hi, I want the player to be teleported to a MHQ. I'm hereby doing this: if (!isEngineOn westmhq1) then { player moveInCargo westmhq1; }else{ player setPos (westmhq1 getPos [10,10]); }; if (!isEngineOn westmhq1) then { player moveInCargo westmhq1; }else{ player setPos (westmhq1 getPos [10,10]); }; that works too. If the MHQ named westmhq1 is destroyed, spawns it again: _vehicle = _this select 0; _respawntime = _this select 1; _facingofvehicle = getDir _vehicle; _positionofvehicle = getPosATL _vehicle; _vehicletype = typeOf _vehicle; _name = vehicleVarName _vehicle; .... _vehicle = _vehicletype createVehicle _positionofvehicle; _vehicle setVehicleVarName _name; _vehicle setPosATL _positionofvehicle; _vehicle setDir _facingofvehicle; ... that works too. After respawning from westmhq1, the player is no longer teleported. No error message appears. Unfortunately, I do not understand why that is. Maybe someone can explain why the player is no longer teleported after respawn westmhq1. thanks..- 11 replies
-
- setpos
- moveincargo
- (and 4 more)
-
I just can't get moveInCargo work for all players on a dedicated server
NyteMyre posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hey everyone, I've been pulling my hairs out with this issue of (in my eyes) simply teleporting a group of players into a plane. The main problem is: It just randomly works for some players. But never for everyone. I asked around on the Discord, on ArmaDev subreddit and some other scriptmakers, and i received multiple methods that should work, but so far none actually teleported all players. I haven't tried the BI forums yet though. My setup 4x player squads (alpha / bravo / charlie / delta) 2x CJ130, (plane1 & plane2) Both planes start in objectHidden true Trigger 1: unhide planes, send hint to players that mission starts in 10 seconds Trigger 2: 10 seconds delay: Black out screen, show mission title screen Trigger 3: 5 second delay: Run script that does the following: skipTime to 23:00 (re)set overcast to 0 (clear skies) Load squad alpha & bravo in plane1 Load squad charlie & delta in plane2 sleep 2 Ungroup all players The script (currently) looks as follows: On Activation ret = execVM "missionscripts\loadup.sqf"; loadup.sqf if (isServer) then { 1 setOvercast 0; skipTime ((23 - daytime) % 24); 1 setOvercast 0; private _plane1Cargo = units alpha + units bravo; private _plane2Cargo = units charlie + units delta; { [_x, [plane1, _forEachIndex]] remoteExec ["moveInCargo",_x]; } forEach _plane1Cargo; { [_x, [plane2, _forEachIndex]] remoteExec ["moveInCargo",_x]; } forEach _plane2Cargo; /*Short delay*/ sleep 2; /* remove from groups */ {[_x] joinSilent grpNull;} forEach (playableUnits + switchableUnits); }; IMGUR album: https://imgur.com/a/c1Lwq