Home   Help Search Login Register  

Author Topic: Forbid to open a gate  (Read 628 times)

0 Members and 1 Guest are viewing this topic.

Uldics

  • Guest
Forbid to open a gate
« on: 03 Sep 2004, 18:49:11 »
It looks like the FDF mod doesn't have a hangar with doors able to close, so I placed some gates in front of the hangar. I know how to open a gate in FDF mod from script:

maingate animate ["keppi",1]

But how could I forbid the opening of the gate to human players, so it could be opened only after some objective is complete or so?

Offline Blanco

  • Former Staff
  • ****
Re:Forbid to open a gate
« Reply #1 on: 03 Sep 2004, 20:05:04 »
Should this work?

Let's say when that objective's completed , a bolean is set TRUE, alarm = true

;[name of the house] exec "lockdoors.sqs"
Code: [Select]
_object = _this select 0
alarm = false

#loop
?alarm : exit
@!(alarm) && _object animationphase "keppi" > 0
_object animate ["keppi",0]
player sidechat "Damned that door is locked"
goto "loop"
There are probably better ways to do this  :P

« Last Edit: 03 Sep 2004, 20:05:54 by Blanco »
Search or search or search before you ask.

Uldics

  • Guest
Re:Forbid to open a gate
« Reply #2 on: 04 Sep 2004, 08:07:30 »
Yes, I thought of that too, but it will balance between 2 disadwantages:
1. You will see the door/gate opening and closing
2. You will need to make very short time delay to make it seem as it never opens - can cause lag.

But if there  could be a possibility to remove the action "open gate" or make it not work and give a message : "Unable to open port, contact gate administrator."   ;D

It works with trigger, but it is still opening-closing visually.

Condition:         maingate animationphase "keppi" > 0
On activation:   maingate animate ["keppi",0]

« Last Edit: 04 Sep 2004, 08:21:44 by Uldics »

Offline The_Mark

  • Members
  • *
Re:Forbid to open a gate
« Reply #3 on: 04 Sep 2004, 10:20:45 »
Quote
2. You will need to make very short time delay to make it seem as it never opens - can cause lag

The lag.. Yes, but you can usually have a few of fast-looping scripts running before they cause lag, and you could run the script by a trigger only when the player (or his loons) are close enough.

Blanco's script will do it, with a 0.01 sec delay, and the script run by a trigger with:

radius=5
player side present
repeated
on activation:       [gate] exec "lockdoors.sqs"
on deactivation:   alarm=true

That should do it.

Other course of action would be placing (speculating here) your own variant of the "open gate"- action's script to your mission folder,as if I'm correct OFP will check first the mission folder for scripts, then addons folder and the game's global folders..
As I said that's only speculating and you'd have to rummage the FDF's addon folders for the script name and path...  :P
But it should work.

Of course you could use the first way, but it'd be to easy, wouldn't it?  ;D
Silent enim leges inter arma.