OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: loki72 on 11 Jun 2008, 01:05:32
-
greetings,
while trying to learn how arma keeps track of a player, i hit a snag..
how do i:
1. tell arma its me (player) in the init and have it always keep track of me. (moving trigger?)* use the [] spawn command...
2. when i enter a vehicle.. i.e. MH-6..it responds with a hint: i.e. hint "you just entered a MH-6.."
3. when i get out and goto another vehicle.. it recognizes the new one.. i.e. AH-6.. i.e. hint "you just entered a AH-6.."
thx
edit:
i remembered something mando had written and edited it.. this works for the 'it's me part'.
init.sqf
[] spawn
{
private["_trackme", "_unit", "_veh"];
_trackme = -1;
while {true} do
{
while {(alive player)} do
{
_unit = player;
if (vehicle _unit != _unit) then
{
_veh = vehicle _unit;
_trackme = hint "greetings... you're in a vehicle";
};
Sleep 1;
};
};
};
so i'm guessing.... ??? i need to make a 'case' or 'switchdo' for each vehicle...?
so how do i get '_veh = vehicle _unit;' to recognize the different 'typeOf' vehicles?
-
while {TRUE} do
while {not isNull player} do
{
waitUntil {vehicle player != player};
_veh = vehicle player;
hint format ["greetings... you're in a %1.", typeOf _veh];
waitUntil {vehicle player == player};
hint format ["greetings... you just dismounted from a %1.", typeOf _veh];
};
sleep 1;
};
Your post is not entirely clear. What do you mean by track the player?
-
thx for the reply mr. peanut,
PeRFeCt! :clap:
by 'track' the player.. i only mean how arma knows where the player is and what the player is doing or using.
i didn't know it could be phrased as you did.. here is the finished code i was seeking:
init.sqf
[] spawn
{
private["_unit", "_veh"];
while {true} do
{
while {(alive player)} do
{
_unit = player;
if (vehicle _unit != _unit) then
{
_veh = vehicle player;
hint format ["greetings... you're in a %1.", typeOf _veh];
waitUntil {vehicle player == player};
hint format ["greetings... you just dismounted from a %1.", typeOf _veh];
};
Sleep 1;
};
};
};