Home   Help Search Login Register  

Author Topic: keeping track of player. (solved)  (Read 1280 times)

0 Members and 1 Guest are viewing this topic.

Offline loki72

  • Former Staff
  • ****
    • Loki's Nightmare
keeping track of player. (solved)
« 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

Code: [Select]
[] 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?
« Last Edit: 11 Jun 2008, 22:31:36 by loki72 »

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: keeping track of player.
« Reply #1 on: 11 Jun 2008, 14:51:17 »
Code: [Select]
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?                 
« Last Edit: 11 Jun 2008, 14:59:45 by Mr.Peanut »
urp!

Offline loki72

  • Former Staff
  • ****
    • Loki's Nightmare
Re: keeping track of player.
« Reply #2 on: 11 Jun 2008, 22:30:53 »
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

Code: [Select]
[] 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;
     };

  };
};
« Last Edit: 17 Jun 2008, 02:03:27 by loki72 »