Home   Help Search Login Register  

Author Topic: how to create user action?  (Read 553 times)

0 Members and 1 Guest are viewing this topic.

AvalanCh3

  • Guest
how to create user action?
« on: 07 Jan 2005, 02:58:27 »
hi all happy new year, i wish to create a user action when triggered the player will lock the vehicle but i do not know how to go about doing it please help me

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
Re:how to create user action?
« Reply #1 on: 07 Jan 2005, 09:08:07 »
Syntax not completely guaranteed, but...

player addAction ["Lock Vehicle", "lock.sqs"]

... should work if you make a small script called lock.sqs. This will add an action to your payers action menue. In lock.sqs you simply write...

myCar lock true

Check out the lock and addAction commands in the comRef
OFPEC | Intel Depot
RETARDED Ooops... Retired!

AvalanCh3

  • Guest
Re:how to create user action?
« Reply #2 on: 07 Jan 2005, 09:17:08 »
thanks however i feel that if i add these user actions into the config file would't it be easier?

Lean Bear

  • Guest
Re:how to create user action?
« Reply #3 on: 07 Jan 2005, 11:04:57 »
Umm, no, not really :P

Also, this way you can disable it using the action ID (see below)

That's pretty much correct nominesine.

As all addActions are given an ID, they normally go 0,1,2,3 etc.

But, to make things easier (ie. if you have more than one action or if you need it to be disabled quickly) you can give it it's own ID. eg.

LockCar = player addAction ["Lock Vehicle", "lock.sqs"]

Then the ID would be set as "LockCar".

Although..having said that...there was some bug or something which meant that in the earlier versions of OFP, you couldn't set it //or something along those lines.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:how to create user action?
« Reply #4 on: 07 Jan 2005, 12:53:28 »
In earlier versions of OFP the action Id was not returned .... that's the bug you are referring to Lean Bear.   It has now been fixed.

Using an explicit id like LockCar has always worked.

Use removeAction to remove the action when it is no longer appropriate.

Remember that lock only works on human units, it doesn't affect AI.    (And if you're using this in MP remember that scripts are local.)
Plenty of reviewed ArmA missions for you to play

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:how to create user action?
« Reply #5 on: 07 Jan 2005, 15:14:40 »
Quote
it doesn't affect AI.
Just to confuse ::)

Actually it 'semi-affects' the AI...
No AI in player's group can enter the vehicle if it's locked...
At least not when ordered in by the player (and who else ::) )

EDIT:
Oh, and you can get the specific action id with
_this select 2
in the script that is executed by the added action...
« Last Edit: 07 Jan 2005, 15:15:50 by HateR_Kint »
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.