Jump to content
Sign in to follow this  
El_Nino

Open/close bar gate

Recommended Posts

Is there a way to open and close the bar gates with a script or command? I've searched the forum, google, and ofpec but haven't been able to find anything. The bar gates that are placeable in the editor can be opened and closed by the player. I'd like to figure out a way to make AI guards open/close the gate or at least appear to with some kind of trigger.

I found this:

House1=position this nearestObject 12345

The Name of the ID is now House1

House1 animate ["dvere1",0]

For houses from here:

http://www.flashpoint1985.com/cgi-bin....se+gate

But can't seem to make it work for the gates. Anyone know if there's a solution?

Thanks!

Share this post


Link to post
Share on other sites
Quote[/b] ] I'd like to figure out a way to make AI guards open/close the gate or at least appear to with some kind of trigger

this is one way you can do it.

place a trigger around or close to the bargate,

lets name the bargate MYBARGATE!

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

Activation:YOURSIDE

Contition: this

On Act: MYBARGATE animate ["barGate",0]

On Dea: MYBARGATE animate ["barGate",1]  

now. when a unit is close to the gate it opens and closes when he leavs the trigget area.

if you put this on the gates init feald it will close itself on start:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

MYBARGATE animate ["barGate",1]

Share this post


Link to post
Share on other sites

Thanks so much! I'll try it and get back to you.

A related question: I notice that there are a number of fixed bar gates on the road in Corazol. When you stand next to them, I don't get the same open/close icon as with bar gates I place myself with the editor. Anyone know if they are movable?

Share this post


Link to post
Share on other sites

Not sure if this works.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Activation:YOURSIDE

Contition: this

On Act: (position MYTRIGGER nearestObject 123456) animate ["barGate",0]

On Dea: (position MYTRIGGER nearestObject 123456) animate ["barGate",1]

Try putting that into your trigger and name the trigger MYTRIGGER, then change the 123456 to the ID of the bargate.

You can find the ID by pushing the Show ID button in the editor now everyobject on the map will have its ID shown on the map simply zoom in on the bargate and get its ID.

Share this post


Link to post
Share on other sites

Nuxil, your recommendation worked like a charm. Thanks so much. Unknown, I tried your script out but without success. I have a feeling that the bargates planted at the border crossings in Corazol are fixed objects that are not moveable like the ones you can place with the editor. When you stand next to them, there's no open/close icon.

I am able to destroy the fixed bargate by using set dammage. It tips over. What I'd like to do now is remove the damaged object and place one in its place with the editor. Would really like to have the gates down when the player approaches, then raised when they are allowed through.

I tried using deletevehicle to remove the damaged bargate as the nearest object as here:

http://www.flashpoint1985.com/cgi-bin....+object

and here:

http://www.flashpoint1985.com/cgi-bin....+object

But no luck. Anyone know if there should be a way to remove the damaged bargate?

Thanks again!

Share this post


Link to post
Share on other sites
Quote[/b] ]But no luck. Anyone know if there should be a way to remove the damaged bargate?

Just move it out of the way via a setPos command (be aware though, that if you do this for a MP game, you have to execute the command on all machines).

P.S. I have also recently updated my Vehicle Browser, so that it will also show you any possible user actions and their syntax for objects. This may also help you in finding out how to operate specific objects.

Share this post


Link to post
Share on other sites

Kronzky,

Thank you for the reply.  Still trying to get this to work. So far I have:

1.  Game logic over the bargate named "bg1"

to test:

2.  A proximity trigger on initialization does

bg1pos = (position bg1 nearestobject 3195);

bg1pos setdammage 1; (***note:works so far to destroy the bargate)

bg1pos setPos [getPos bg1pos select 0, (getPos bg1pos select 1) + 10, getpos bg1pos select 2]

But the bargate doesn't move. I've tried it on other fixed objects to the same effect.  Do I need something else in the setpos statement to recognize the ruined object?  What else am I doing wrong?  Thank you for helping out

Share this post


Link to post
Share on other sites

Oh sorry...

I guess I should never assume that things work the same way in ArmA as they do in VBS (where I just had to do the same thing).

So I'm afraid you're out of luck...

Perhaps you can just place a movable gate on the opposite side of the existing one, and use that instead. Not pretty, but probably the best you can do.

Share this post


Link to post
Share on other sites

I've found you can "wiggle" a pre-placed object to be completely underground using a series of setVectorDir and setVectorUp commands.

The big problem is they seem to stay that way until the island gets reloaded (ie, over following missions until the island is changed)

Share this post


Link to post
Share on other sites
I've found you can "wiggle" a pre-placed object to be completely underground using a series of setVectorDir and setVectorUp commands.

The big problem is they seem to stay that way until the island gets reloaded (ie, over following missions until the island is changed)

I could live with it staying that way since I just want to disappear the fixed bargate and replace with a movable one in the editor. By chance do you have script sample for how to do this?

Share this post


Link to post
Share on other sites

try this in a mission on Sahrani:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">player setPos [13485,8847.5,0]

player setDir 270

myGate = position player nearestObject 3194

myGate setDamage 1

~2

myGate setVectorUp [0,1,0]

myGate setVectorDir [0,0,1]

myGate setDamage 0

I haven't thought through how it works, or how to optimally make use the setVector commands, but this example works for me. The tree/fence destruct type moves the object's center point as it falls over when destroyed, then you can re-orientate the object around the center point, then un-destroy it. Repeat if needed. I'm sure it would be possible to move an object to an arbitrary location using a refined version of this method. I've also noticed that it's possible to create weird skew effects using this trick.

The AI seem to be happy enough to walk/drive over the buried gate object, I haven't tested it with other objects.

Share this post


Link to post
Share on other sites

This is a REALLY late reply, but there's something wrong with either the page, the browser, or my computer. Whenever you guys type a ' it says ! for me, which makes the stuff I'm supossed to copy into the init-field really hard to understand since it says ! instead of ' and like " instead of ! for me, etc.

Anyone who could send me an email or something like that with the actual text that you're supossed to copy into the init field of the gate? Would be extremely appriciated.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×