Home   Help Search Login Register  

Author Topic: Dumb- but probably simple- Question  (Read 446 times)

0 Members and 1 Guest are viewing this topic.

Shenton

  • Guest
Dumb- but probably simple- Question
« on: 31 Oct 2003, 02:55:46 »
Hi there.

Just got a quick question. I'm new to all this scripting stuff, and at the moment it all sounds like gibberish to me, as I know nothing about the syntax / format of writing scripts - what to put where in what order, with what punctuation etc.

Could someone give me a quick answer to this (If it's possible):

In a buildings init field, I want a line that makes all the streetlights on a map go out when the building is destroyed. I know it's something to do with alive equalling false, and setlight to off, but exactly how to write it I have no idea. Nor whether it would actually work...

Any help would be greatly appreciated.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Dumb- but probably simple- Question
« Reply #1 on: 31 Oct 2003, 13:37:06 »
First off, go and read snYpir's Friendly Intro to Code Snippets and also Johan Gustafsson's Scripting Tutorial.    This is now the accepted way of getting started in scripting.    

Now, the init field of a unit is the appropriate place for a command that you want that unit to execute at the very start of the mission.   If you're talking about something that you want to happen, say one second into the mission or later, then the init field is unlikely to be the best place for the command.

In the case of a building being destroyed what you need is a trigger.    (The editing tutorial which comes with the game calls them sensors, which is an equally good name:  they "sense" when something has occurred and, in general "trigger" a conseqence.)

Next, if you have a rough idea of what commands might be involved always look up both the online version of the official command reference and also the old unofficial command ref.   Both have helpful comments (sometimes) that help you to understand how a command works and what it does.    If you're not sure whether something will work, well, hey, try it, what have you got to lose.   More than likely you will get an error message which, if you read carefully, will point you in the right direction.

Now, what you're trying to do here is pretty big.  Switch off all the streetlights?   Well lets start small and switch off one streetlight.    Create a trigger:-

Condition:  object 1234 getdammage >= 0.9
On Activation:   object 1234 setdammage 1; object 9876 switchlight "off"

I have no idea whether that will work or not, for a start you'll need to check the syntax of the individual commands.   (object, switchlight, getdammage, setdammage)   To get the numbers of the buildings zoom into the Mission Editor Map really close and click on Show IDs.

The command alive is better suited to use with AI units than inanimate objects, although you're right, you could have this in the condition line:-

not (alive object 1234)

Oh,  and

Welcome to the forum!
« Last Edit: 31 Oct 2003, 13:38:32 by macguba »
Plenty of reviewed ArmA missions for you to play

Mr.BoDean

  • Guest
Re:Dumb- but probably simple- Question
« Reply #2 on: 01 Nov 2003, 20:10:52 »
Yup, What Mac said, for sure!  ;) Plus, you can get tools in the editor's depot like UnPbo /DePbo  that allow you to take a regular mission and decompress it back to the working folder with all of the scripts and see how things were done. I also highly recommend using Chris' OFP Script tool ..It will color-code words used in the scripts according to category and can also help with briefings and overviews, etc.  :D

And Mac , I did a double-take when I saw this:

Quote
"(The editing tutorial which comes with the game calls them sensors...."


 :o  :o   :o    :o    :-X   :-X   :-X   :-X    :-X

OMG and LOL!! I had NO IDEA that was even included with the game and never noticed it until your remark!! Was that added with Resistance or was it present from OFP - 1.00 + ?? 'Cuz I've been playing this game for 1.5 years and have gotten all of my editing info right here at OFPEC!  ;D   ;D   8)


Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Dumb- but probably simple- Question
« Reply #3 on: 02 Nov 2003, 03:58:30 »
 ;D  It was always there ... don't worry, you didn't miss much.     Start Menu - Codemasters - Flashpoint readme - click on the Editor tab.
Plenty of reviewed ArmA missions for you to play