Home   Help Search Login Register  

Author Topic: Unit In Vehicle  (Read 1696 times)

0 Members and 1 Guest are viewing this topic.

Offline Ding

  • Contributing Member
  • **
  • Jurassic Park
Unit In Vehicle
« on: 06 Sep 2006, 19:21:55 »
Well basically Im using the "In" condition to play music as soon as the player gets in a car, and I want it to stop when they get out of the car. Is there a similar condition command that goes something along the lines of

Player Out Car1

that could work for this?
"If I remain lost and die on a cross, atleast I wasn't born in a manger"

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Unit In Vehicle
« Reply #1 on: 06 Sep 2006, 19:24:34 »
i would investigate eventhandlers if i were you. much more versatile.  :thumbsup:

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Unit In Vehicle
« Reply #2 on: 06 Sep 2006, 19:37:09 »
Hmmm would:

player !in car1

work?

Offline Cheetah

  • Former Staff
  • ****
Re: Unit In Vehicle
« Reply #3 on: 06 Sep 2006, 19:38:34 »
Hmm: !(player in vehicle)
is what I would use.
Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re: Unit In Vehicle
« Reply #4 on: 06 Sep 2006, 21:02:01 »
Quote
@ (vehicle player == player):

would become true when the player was out of a vehicle

bearing in mind the @ condition is fast looping, so a slower ~1 loop would be better

eg

Quote
#LOOP
~1
?(vehicle player == player):goto "OUT"
goto "LOOP"

#OUT
0.1 fadeMusic 0
exit
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Unit In Vehicle
« Reply #5 on: 07 Sep 2006, 09:34:44 »
Quote
bearing in mind the @ condition is fast looping, so a slower ~1 loop would be better
True, but heed what bedges said..

Looping scripts for this kind of thing are soooo 1.46 ;)
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re: Unit In Vehicle
« Reply #6 on: 07 Sep 2006, 11:53:49 »
I have found no hard and fast rule about the perfomance hit from a loop vs an @ command.

Each case needs to be tested.  For complex conditional statements the @ must suffer vs the the loop, but the loop brings an overhead that the @ does not have.

In many missions the difference will be hard to spot, but in large missions where there may be many such commads running at the same time then you should test which is better.  For example I know that:

Code: [Select]
@ (getdammage _unit >0.9)
is much better than:

Code: [Select]
#loop
~0.5
if (getdammage _unit <0.9) then {goto"loop"}

Because I tested it with 5,000 scripts all running smultaneously.


Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re: Unit In Vehicle
« Reply #7 on: 07 Sep 2006, 19:24:00 »
i think what is more important, is how quickly you need the "condition" to be seen

if you dont need it to be as "instantaneous" as possible, then use a slower loop

Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline Ding

  • Contributing Member
  • **
  • Jurassic Park
Re: Unit In Vehicle
« Reply #8 on: 08 Sep 2006, 20:08:16 »
actually "!(player in vehicle)" is what i needed really D:, I always forget about the uses of the Exclamation mark, I find that too many eventhandlers can cause lag sometimes when i have used them :(.

Thanks for all the help though  :check: :thumbsup:

Edit: Do we still need to lock Solved topics?
"If I remain lost and die on a cross, atleast I wasn't born in a manger"

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re: Unit In Vehicle
« Reply #9 on: 08 Sep 2006, 23:47:46 »
We're not making a fuss about it but it remains good practice, if your question has been answered satisfactorily, to lock the thread and write something like "Topic solved - thanks everybody" at the bottom.  Always wait a couple of days after the last answer in case somebody has something intelligent to add.

Plenty of reviewed ArmA missions for you to play

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Unit In Vehicle
« Reply #10 on: 09 Sep 2006, 15:17:23 »
@Ding
Quote
I find that too many eventhandlers can cause lag sometimes when i have used them
I find that very hard to believe, unless of course you execute scripts directly from them..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re: Unit In Vehicle
« Reply #11 on: 09 Sep 2006, 18:20:48 »
Quote
I find that very hard to believe,
Me too.  I have a mission  that has around 1,500 killed EHs waiting to fire, and they all do eventually  :), many at the same time

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re: Unit In Vehicle
« Reply #12 on: 09 Sep 2006, 18:28:14 »
It's not the event handlers, it's the people who start long looping scripts from, for example, fired event handlers and then they go and wonder why they get lag in a firefight of 24 soldiers... weapons on automatic fire.

On topic: there is also a function groupInVehicle written for checking if a whole group is in a vehicle or not. Can be used for checking if group members are in any vehicle or if they are in the same vehicle.