OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Resources Beta Testing & Submission => Topic started by: THobson on 18 Oct 2004, 19:43:47

Title: Opening and Closing gates in a stockade
Post by: THobson on 18 Oct 2004, 19:43:47
I was inspired by a gate that macguba uses in his Un-impossible mission to write a general script that will enable objects to be moved so as to simulate the opening and closing of a gate.

I do not know if this has been done before or even if anyone would be interested in it so I would be very glad of any comments on this.

Attached are the scripts, a sample mission and a readmefile.
Title: Re:Opening and Closing gates in a stockade
Post by: Cpt. Red Nain on 18 Oct 2004, 23:51:31
I remember an mission released in may 2002 (http://www.ofpec.com/missions_depot/index.php?ID=308 (http://www.ofpec.com/missions_depot/index.php?ID=308)), where u could open and close gates. the author used a script that made 'em disappeare in the ground (while playing a rogue spear sound, 'wuz great  :D).
Title: Re:Opening and Closing gates in a stockade
Post by: Blanco on 19 Oct 2004, 01:03:27
I've wrote a security gate script with a codepad (http://www.ofpec.com/yabbse/index.php?board=27;action=display;threadid=19435).

The difference with my script is that I use a object that represent a button (with addactions) to activate them and the doors open sideways.
Actually, the math was borrowed from another script (author unknown)

Your script is something I couldn't figure out, they sway open, very nice stuff indeed  ;)





Title: Re:Opening and Closing gates in a stockade
Post by: THobson on 19 Oct 2004, 08:26:39
Blanco - from you that is praise indeed.  Thank you.

It is just a bit of trigonometry that I seem to have remembered from my school days.  Converting from my formulae to the script got a bit complicated because of the need for abs(..) and  ... % 360.  Strip those out and it looks more simple.  I would be very happy to post the proof of the formulae used if anyone is interested.

I have realised the script will not work with negative input angles.  I will have a look at how best to deal with that.

Bye the way the codepad looks very neat.
Title: Re:Opening and Closing gates in a stockade
Post by: Dubieman on 19 Oct 2004, 20:30:10
Tryed it and it seemed to work fine. Its good that you included angles and inputs for them. I could see this working wonders for a border mission or something of the like.

Hmm POW camps? Civvi's missions? Nice job. :)
Title: Re:Opening and Closing gates in a stockade
Post by: THobson on 19 Oct 2004, 20:39:37
Thanks.  I am glad you like it.

I have fixed it so that negative angles are converted to positive, and whole rotations are ignored.  

As it seems there is not yet anything like this and it may be of use to some people I will submit this soon then.
Title: Re:Opening and Closing gates in a stockade
Post by: Blanco on 20 Oct 2004, 03:24:40
it surely opens new objectives...

Title: Re:Opening and Closing gates in a stockade
Post by: THobson on 20 Oct 2004, 08:24:13
Thanks all.  

I have submitted a revised script that deals with silly gate opening angles (<0; >=360).  If a negative angle is needed then using the boolean 'clockwise' to specify the direction of rotation is the thing to use instead.  I have also added an item to the sample mission showing the script being used for an object other than 'wire'.  

The script in this thread is the old one so if you want the latest version please head on over to the Editor's Dept.

Thanks again for you input and encouragement.