Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
maffa

getposasl>0 to trigger some black magic

Recommended Posts

Hello all :)

I'm working on a script to turn all amphibious vehicles of my choice (USMC AAV, classname "AAV") in another (Lingor GAL's Leopards 1A5, classname "ibr_Leo1A5gal") as soon as they hit the beach. This is a way to simulate a LCM/LCAC landing that we as a clan don't have. So i thought (well, "fought with for three days" is more accurate) this:

- to the AAVs (the amph vehicle i chose) init

res = [this] execvm "createleo.sqf";

and in the "createleo.sqf" script file

systemchat "beginscript";
_Leospawn = _this select 0; systemchat "leospawn";
_Leodir = getdir _leospawn; systemchat "leodir";
_Leospawnpoint = getpos _leospawn;systemchat "leospawnpoint";
_leoasl = getposasl _Leospawn select 2; systemchat "leoasl";
waituntil {_leoasl>0}; 
{deletevehicle _x} foreach crew _leospawn;
deletevehicle _leospawn; systemchat "leo delete";
[_Leospawnpoint, _leodir,"ibr_leo1a5gal", west] call BIS_fnc_spawnVehicle;
systemchat "endscript";

now, i tried everything for that line 8. This is a waituntil, but i even tried if ()then{}, foreachframe {} , took random underscores away, put directly _leospawnpoint or _this with select 2, with and without () and (()), to no avail. Without that condition line, the AAV does its vodoo and turns in a (were)leopard. With that and the waituntil, the script stops indefinitely at line 8, no errors on ArmaOA.rpt. With if () then {} and foreachframe {} the script flows through without any effect. I am at my wits' end.

I would prefer this to be executed directly to the unit instead of having a trigger, because coasts are pretty rough and it's simpler to copy'n'paste units with a single init line.

Help me script gurus!

edit: nothing better than focusing on your own problems LOL as soon as i decide to give up and ask for advice i manage to find a way through:


waituntil {((getposasl _leospawn) select 2)>3};
sleep 5;
{deletevehicle _x} foreach crew _leospawn;
sleep 5;
_Leodir = getdir _leospawn; 
_Leospawnpoint = getpos _leospawn;
deletevehicle _leospawn;
[_Leospawnpoint, _leodir,"ibr_leo1a5gal", west] call BIS_fnc_spawnVehicle;

Edited by Maffa
problem solved :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

×