Arma 3
Call of Duty 4 - Modern Warfare [RU]
This topic has been locked
Leopard20 3 Nov, 2019 @ 9:50am
Fixing the problem with doors
Hi Erika,

So about the problem with doors that one of the users mentioned as well, you can do this:

The doors can be opened as follows (I'm using this example for the first door on top of the ship in mission Crew Expendable:
ship animate ["door_7_1_anm", 1];
Where ship is the ship object (you can return the object by just looking at it and using cursorObject)

If you want to find the door more quickly, try this code in a debug console or something:
[ship, "GEOM"] intersect [ASLtoAGL eyePos player, (ASLtoAGL eyePos player) vectorAdd (vectorDir player vectorMultiply 3)];
So you stand close to a door and point at it and it gives you the door name. Just add an "anm" at the end to turn in into the anim. You can also check if the anim is valid using:
animationNames ship

As for how to make the AI open it, you can put a trigger around the door (make sure to include the vertical dimension in the triggerArea, otherwise the doors can be opened from floors below/above).
Also, set the trigger activation condition to BLUFOR present so that the enemy don't open the doors by stepping onto the trigger accidentally.

Hope it helps!

Regards,
Leopard20
Last edited by Leopard20; 3 Nov, 2019 @ 11:47am
< >
Showing 1-10 of 10 comments
▽ Eriks0n  [developer] 3 Nov, 2019 @ 10:07am 
Thanks, I'll try to do it.
▽ Eriks0n  [developer] 4 Nov, 2019 @ 4:08am 
It all doesn't work, the mod on the ship itself is very strange. It is not affected by the commands hideobject, setPos, etc. I do not know what to do with it, do you have any other ideas?
▽ Eriks0n  [developer] 4 Nov, 2019 @ 4:09am 
Did you manage to open the doors in the editor?
Leopard20 4 Nov, 2019 @ 7:19am 
Originally posted by 「 Erika Itsumi 」:
It all doesn't work, the mod on the ship itself is very strange. It is not affected by the commands hideobject, setPos, etc. I do not know what to do with it, do you have any other ideas?
I'm a bit confused. Why do you want to use hideObject and setPos?



Originally posted by 「 Erika Itsumi 」:
Did you manage to open the doors in the editor?
No I just tested the mission directly, and it worked there. Which file contains the mission data? I could take a look.
Last edited by Leopard20; 4 Nov, 2019 @ 7:20am
Leopard20 4 Nov, 2019 @ 7:54am 
I realized what the problem is.
The ship consists of multiple objects (similar to the vanilla USS Freedom carrier).

I don't think you can get the objects directly, so instead you should use lineIntersectsSurfaces.
I'll send you a sample code in a bit.
Last edited by Leopard20; 4 Nov, 2019 @ 7:55am
Leopard20 4 Nov, 2019 @ 9:15am 
Originally posted by 「 Erika Itsumi 」:
Did you manage to open the doors in the editor?
Ok, here it is:
https://www.dropbox.com/s/5g11s900r9n8ltl/m2.Malden.zip?dl=0

I've written a code that does everything for you! You just have to move to the door step and register a bunch of positions! :)

First download the file. It only contains the changed files. So place them in the mission folder. (also replace init.sqf)

Next, run the mission, and then manually walk to every door that is used in the mission, face the door, (it's very important to face the door directly, and stand exactly in the door step, so it's okay to open the door because the triggers are created later) and run this code in debug console:
[] execVM "getTriggerPos.sqf"

Once you're all done, type in this code in debug console:
copyToClipboard str triggerPos
to copy all new triggerPos values to clipboard.

Next, you need to open the file init.sqf and replace the variable
triggerPos
value with the new array. So just delete the [ ] in front of triggerPos and paste the new array in there.

That's all, restart and run the mission!

P.S: If you're interested, the file which does this whole process is: createTriggers.sqf
Last edited by Leopard20; 4 Nov, 2019 @ 2:18pm
Leopard20 5 Nov, 2019 @ 7:03am 
Originally posted by 「 Erika Itsumi 」:
Did you manage to open the doors in the editor?

Hey Erika,

Did you manage to get it working?

BTW, I modified the file getTriggerPos.sqf to also show you where the triggers are created in 3D. So replace the contents with this one instead:
if (isNil "triggerPos") then {triggerPos = []}; triggerPos pushBack [getPosASL player, getDir player, vectorDir player]; onEachFrame { { _pos = ASLToAGL (_x#0) vectorAdd [0,0,1]; drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\CrewAimIndicator\gunnerAuto_ca.paa", [1,0,0,1], _pos, 1, 1, 0, str _foreachindex, 0, 0.03]; _vec = _x#2; _normal = ([_vec, 90] call BIS_fnc_rotateVector2D) vectorMultiply 0.75; _vec = _vec vectorMultiply 1.5; _p1 = (_pos vectorAdd _vec) vectorAdd _normal; _p2 = (_pos vectorAdd _vec) vectorDiff _normal; _p3 = (_pos vectorDiff _vec) vectorAdd _normal; _p4 = (_pos vectorDiff _vec) vectorDiff _normal; drawLine3D [_p1, _p2, [0,1,0,1]]; drawLine3D [_p1, _p3, [0,1,0,1]]; drawLine3D [_p4, _p2, [0,1,0,1]]; drawLine3D [_p4, _p3, [0,1,0,1]]; } forEach triggerPos; };
It's helpful to see which positions you've added already. Plus, if you need to delete one, all you have to do is run this in debug console:
triggerPos deleteAt n
Where n is the number you see next to the icons. Pretty neat right?! :)
Last edited by Leopard20; 5 Nov, 2019 @ 7:19am
▽ Eriks0n  [developer] 5 Nov, 2019 @ 9:32am 
Originally posted by Leopard20:
Originally posted by 「 Erika Itsumi 」:
Did you manage to open the doors in the editor?

Hey Erika,

Did you manage to get it working?

BTW, I modified the file getTriggerPos.sqf to also show you where the triggers are created in 3D. So replace the contents with this one instead:
if (isNil "triggerPos") then {triggerPos = []}; triggerPos pushBack [getPosASL player, getDir player, vectorDir player]; onEachFrame { { _pos = ASLToAGL (_x#0) vectorAdd [0,0,1]; drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\CrewAimIndicator\gunnerAuto_ca.paa", [1,0,0,1], _pos, 1, 1, 0, str _foreachindex, 0, 0.03]; _vec = _x#2; _normal = ([_vec, 90] call BIS_fnc_rotateVector2D) vectorMultiply 0.75; _vec = _vec vectorMultiply 1.5; _p1 = (_pos vectorAdd _vec) vectorAdd _normal; _p2 = (_pos vectorAdd _vec) vectorDiff _normal; _p3 = (_pos vectorDiff _vec) vectorAdd _normal; _p4 = (_pos vectorDiff _vec) vectorDiff _normal; drawLine3D [_p1, _p2, [0,1,0,1]]; drawLine3D [_p1, _p3, [0,1,0,1]]; drawLine3D [_p4, _p2, [0,1,0,1]]; drawLine3D [_p4, _p3, [0,1,0,1]]; } forEach triggerPos; };
It's helpful to see which positions you've added already. Plus, if you need to delete one, all you have to do is run this in debug console:
triggerPos deleteAt n
Where n is the number you see next to the icons. Pretty neat right?! :)
While not doing it. I'm still working on the Shock and Awe mission. After I finish to do it will come back to your code, thank you for your work.:happyrin:
▽ Eriks0n  [developer] 6 Nov, 2019 @ 9:18am 
Originally posted by Leopard20:
Originally posted by 「 Erika Itsumi 」:
Did you manage to open the doors in the editor?

Hey Erika,

Did you manage to get it working?

BTW, I modified the file getTriggerPos.sqf to also show you where the triggers are created in 3D. So replace the contents with this one instead:
if (isNil "triggerPos") then {triggerPos = []}; triggerPos pushBack [getPosASL player, getDir player, vectorDir player]; onEachFrame { { _pos = ASLToAGL (_x#0) vectorAdd [0,0,1]; drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\CrewAimIndicator\gunnerAuto_ca.paa", [1,0,0,1], _pos, 1, 1, 0, str _foreachindex, 0, 0.03]; _vec = _x#2; _normal = ([_vec, 90] call BIS_fnc_rotateVector2D) vectorMultiply 0.75; _vec = _vec vectorMultiply 1.5; _p1 = (_pos vectorAdd _vec) vectorAdd _normal; _p2 = (_pos vectorAdd _vec) vectorDiff _normal; _p3 = (_pos vectorDiff _vec) vectorAdd _normal; _p4 = (_pos vectorDiff _vec) vectorDiff _normal; drawLine3D [_p1, _p2, [0,1,0,1]]; drawLine3D [_p1, _p3, [0,1,0,1]]; drawLine3D [_p4, _p2, [0,1,0,1]]; drawLine3D [_p4, _p3, [0,1,0,1]]; } forEach triggerPos; };
It's helpful to see which positions you've added already. Plus, if you need to delete one, all you have to do is run this in debug console:
triggerPos deleteAt n
Where n is the number you see next to the icons. Pretty neat right?! :)
Excellent, many thanks for the script. Everything works as it should!
Leopard20 6 Nov, 2019 @ 10:14am 
Originally posted by 「 Erika Itsumi 」:

Excellent, many thanks for the script. Everything works as it should!

You're welcome!
< >
Showing 1-10 of 10 comments
Per page: 1530 50