Home   Help Search Login Register  

Author Topic: Dang addaction, it ruined my whole misson! >;(  (Read 1429 times)

0 Members and 1 Guest are viewing this topic.

Offline Wildebeest

  • Contributing Member
  • **
  • The time the wildebeest ruled the Earth.
Dang addaction, it ruined my whole misson! >;(
« on: 27 Nov 2002, 15:11:26 »
What's up with "addaction"? I have a guy who is supposed to be given an extra action command when he steps on a trigger and so far so good. The annoying part is that another player standing in the trigger at the same time as my guy also can see and use the command. This is a big problem in multiplayer since people can make events occur that are originally reserved for certain specified players, unlocking a car for instance. Help me, you are the best!

Cheers :)
Weeee...

Offline Wildebeest

  • Contributing Member
  • **
  • The time the wildebeest ruled the Earth.
Re:Dang addaction, it ruined my whole misson! >;(
« Reply #1 on: 27 Nov 2002, 15:42:32 »
I found this description of "addaction" in the official command reference:

*************************

unit addAction action
Operand types:
    unit: Object
    action: Array
Compatibility:
    Version 1.1 required.
Type of returned value:
    Nothing
Description:
    Create an action. Action ID should be returned, but due to bug it is not. To determine action ID use following algorithm: first action added to given vehicle has ID zero, next has ID one, etc.

Example:
    player addAction ["Hello", "hello.sqs"]

*************************

What really caught my attention was this: "Action ID should be returned, but due to bug it is not."

What does that mean? Is this bug the cause of my problem? And what about determine Action ID? I'm no programmer and I'm not too good at this stuff so I'm asking for your help in this matter.

Cheers again :)
Weeee...

dreaming_adam

  • Guest
Re:Dang addaction, it ruined my whole misson! >;(
« Reply #2 on: 27 Nov 2002, 16:02:20 »
Addaction assigns the action to an object/vehicle in the game. When you assign it to the particular player, anybody who steps inside a 5M (i think?) radius of the player can activate it. The simple soloution to this is to check who action belongs to, and if it isnt the correct player then to exit the script.

FOR EXAMPLE:

Use the follow line instead of just addaction.

?(Player == p1): p1 addaction["Detonate!","boom.sqs"]

Replace p1 with the name of the unit who is calling it.
The way this works is long winded.. if you would like an explination feel free to ask, otherwise ill save you the reading time.

BTW in the comref, the problem outlined has nothing to do with the problem you are experiencing. In order to remove an action menu from an object you have to refer to its ID. Unless you later want to remove an action you have added, you have no reason to worry about this

ADDITIONALLY.
From the sounds of things, you are trying to add the action to a car which only a certain player is permitted to unlock. instead of using triggers and etc, a much more efficient way is the following:

Insert the car which you want to have locked. In its init field you most likely have something like this:
this locked true

change that init line to read as this:
this locked true; ?(Player == p1): this addaction["Unlock Vehicle","unlock.sqs"]

This *SHOULD* (untested) let only p1 unlock the car when (s)he is in a 5 metre radius of the car.

Cheers
Adam
 

Offline Wildebeest

  • Contributing Member
  • **
  • The time the wildebeest ruled the Earth.
Re:Dang addaction, it ruined my whole misson! >;(
« Reply #3 on: 27 Nov 2002, 16:47:11 »
Wow! To be honest I never thought anyone would know the answer to this one, thanks a bounch! I'm not really using this to unlock cars, that was just an example. No, the real purpose was to make an US engineer enter an underground VC bunker in Vietnam and since one can't dig in OFP I had to teleport the poor guy to a fake complex hundreds of kilometers away :)
Wouldn't be very fun if his co-players could make him enter that dangerous place against his will, now would it? hehe

thx once again, cheers  8)
Weeee...