Home   Help Search Login Register  

Author Topic: Simulating a CD player in a Car  (Read 1175 times)

0 Members and 1 Guest are viewing this topic.

Joukov

  • Guest
Simulating a CD player in a Car
« on: 24 Oct 2005, 02:53:46 »
Hokay, ;D
So i created this map where the player has to go someways to get to his objective, he has a car at his disposal. i made it so that when he gets into the car he gets two new actions: Play Aight, and Play spetsnaz; those are the two songs that the player can listen to while driving to the obj. I just have one problem with this whole thing. I want the two actions to disappear when the player gets out of the car. I found how to detect if a certain player enters a certain car, but i stil don't know how to detect if a certain player leaves a certain car... Anyone know?

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
Re:Simulating a CD player in a Car
« Reply #1 on: 24 Oct 2005, 03:24:15 »
Code: [Select]
? (vehiclePlayer != player) : myAction = player addAction ["BLAH","Blah.sqs"]

and

? (vehiclePlayer == player) : player removeAction "MyAction"

or the equivelent in a trigger
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08

Joukov

  • Guest
Re:Simulating a CD player in a Car
« Reply #2 on: 24 Oct 2005, 03:29:42 »
what is vehiclePlayer?
name of the vehicle?

Joukov

  • Guest
Re:Simulating a CD player in a Car
« Reply #3 on: 24 Oct 2005, 05:49:03 »
Ok, nm, i get it now
but it still doesn't work...
maybe if i show you my trigger you will see the problem..
I have a car named "truck", and a guy named "player",
in the "player" init field i declared a variable "r1" and set it to false, then i made a trigger in the condition of which i put "Player in Truck", in the On Activation field i put "PlayAight = truck addaction ["Play Aight","aight.sqs"]; r1 = true". I then made a second trigger in the init of which i put, as you said, "truck != player and r1", in the On activation i put "truck removeaction "PlayAight "; r1 = false; hint "stuff"". Both the triggers are turned on as "repeatedly". As you can see i added the "r1", this is because without it the game would right away go to the second trigger and it would not activate that trigger again. Now that i have the r1, it doesnt activate the second trigger at the beggining of the game, but when i get into the "truck", it adds the actions for a second, then removes them with the hint"stuff". My  best guees is that there is something wrong with the "truck != player" command... ne one know how to solve this?

Offline 456820

  • Contributing Member
  • **
Re:Simulating a CD player in a Car
« Reply #4 on: 25 Oct 2005, 19:58:21 »
no you shouldnt of changed it to say truck
vehiclePlayer is a command not the name of the truck if you change truck back to vehiclePlayer it should work fine

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re:Simulating a CD player in a Car
« Reply #5 on: 25 Oct 2005, 21:25:49 »
It should be vehicle player, not vehiclePlayer.

That would then enable the action if the player is in any vehicle. If there's only one unlocked vehicle in your mission, or you allow the action to be present no matter what the vehicle is, then vehicle player in the above code example would work just fine.
« Last Edit: 25 Oct 2005, 21:29:00 by Baddo »

Joukov

  • Guest
Re:Simulating a CD player in a Car
« Reply #6 on: 29 Oct 2005, 07:17:41 »
thanks guys
topic solved!