Oh, I forgot to mention. This page uses .sqs files a lot. No, no! Don't turn away all non-scripters! You forget! I am here to help you. So what are you doing? Read on. This senseless babbling isn't going to enlighten you!
Scripts - Creating them
A lot of people say they can't script because either they won't take time to learn it, or they can't get that damned .txt file to turn into a .sqs file.
If you're of the former, then I suggest this - JUST LEARN IT!
However, if you're the latter, keep reading.
We've all been there. We go and learn how to do some scripting from tutorials. They say 'create a whatever.sqs file. So you do. Alt-tab! You make a new .txt file and call it whatever.sqs. However, when you try to make it work... it doesn't! There is only one reason for this - you must have the file extensions hidden on your machine. Although you can't see the extensions, your system can. People usually hide their extensions to make their folders look neater. but if you want to script, then you'll need to un-hide them. To do this go to Start/Settings/Folder Options. Under the View tab, uncheck the 'Show file extensions for known file types' tick box and Apply. Now you should be able to see the file extensions. Take a look at that whatever.sqs file. It'll now say whatever.sqs.txt. Remove that .txt extension and your script will work (unless you've made a mistake in it, which is your own fault, not mine). If your computer STILL won't run your scripts even though you've checked everything a million times... then I don't know what the hell to do! What do you think I am? A mircale worker? Next section, please!
One of the first things people don't know how to do is place a unit. For those who haven't yet figured it out, double-click anywhere on the map. Anywhere.
There, now that we all know how to place a unit, it's time to move on.
Click on the top-right section of the screen. Where it says Easy. This will put it in Advanced mode, if it isn't already. Advanced mode is infinitely better than Easy. You can do a million more things to a single unit.
Anyway, the first unit you place on the map is always the Player unit, by default. So let's do that. Now you can press 'Preview' and go inside the level. Great mission, eh? Running around an empty town/empty grassland. Press Escape and click Abort. There. You're back in the editor.
The next thing people want to know is how to have a fire lit from the missions start. Easy peasy lemon-squeezy. In the fire's Init line (that's the big bar that you can type stuff in), type this inflame true. Check out your fire. Way-hey! It's now burning brightly (if you look at it during night-time)!
Want to know how to have a chopper in the air when you start? Simple. Double-click on the chopper, go to 'Special' and click on 'Flying'. Now the whirlybird will be flying. Same thing goes for planes.
How to place an empty Jeep, you say? Well, once you've placed the Player, create another unit, but in the 'Side' drop-down box, click on a new option called Empty. Now you can choose a whole mess of things. You'll find Jeep under 'Cars'. You can make an empty version of every single vehicle in the game. You may have noticed that the 'Rank' option has disappeared, and so has the ability to choose a 'Man' type of unit. This is because the unit is on the Empty Side. There is nobody controlling it and you can't have an empty soldier (unless it's spiritually or he's had his insides pulled out, but this is all getting a bit anal now).
Setting mimics (expressions)
name SetMimic "expression"
Expressions:
Normal
Smile
Angry
Agresive (<---that's how it's spelled in the OFP:ME)
Cynic
Surprise
Hurt
Sad
Ironic
Example: sadbloke setmimic "sad"
Now your soldiers are professionally trained actors!
Unlocking/locking vehicles
vehicle lock false/true
Example: car1 lock true/false
lock true will make the car un-enterable, while lock false does the opposite.
Ever wanted to know how to add an action and make it activate a script?
In a trigger's On Activation/Unit's Init field:
unitname addaction["Action name","scriptname.sqs"]
Example: dude1 addaction["suicide","suicide.sqs"]
Obviously, you will have to create the script "suicide.sqs" or else nothing will happen.
Want to change your mission's/intro's startup message from the dull "Get ready..." line?
Create a description.ext and in it put the line:
OnLoadMission="Its time to get loaded"
Type in OnLoadIntro to get the message appear at the intro.
It's never been easier to get loaded!
Want to change the speed of time?
Do this in a trigger/script
setacctime x.x where x.x is the speed you want time to go at.
1 is normal. Fool around with it.
Example:
setacctime 0.3
Think of it as percentages. In the example, time would run at 30% normal speed, 0.5 would make time go at 50% normal speed, etc. You can have loads of fun with this!
Papa Bear not talking to you? Force him by typing the following in a trigger/script:
[West, "HQ"] sideChat "Blah blah blah"
Of course, I'm sure you can come up with something a bit more imaginative and intelligent than "Blah blah blah".
You can also get Firefly base to talk to you by typing:
[West, "Airbase"] sideChat "Blab blab blab"
You can also use this on soldiers:
unitname sideChat "Text"
Example: soldierOne sideChat "Attack!"
There are several commands to use for radio.
sidechat - Everyone on the same side as the unit talking receives the message.
groupchat - Everyone in the same group as the unit talking receives the message.
globalchat - Everone recieves the message, regardless of side or group.
Remember, though, you will get no sound with the radio text, you will have to record that yourself!
Getting soldiers to sit:
Init: this setbehaviour "safe";this switchmove "effectstandsitdown"
Script: unit setbehaviour "safe";unit switchmove "effectstandsitdown"
To add weapons/ammo to a vehicle/ammo crate:
vehiclename addweaponcargo ["weaponname", #];vehiclename addmagazine ["weaponname", #]
Example: truck1 addweaponcargo ["M16", 99];truck1 addmagazinecargo ["M16", 99]
To add to a unit's arsenal, put this in a script/the unit's init line:
unitname addWeapon "weaponname"
example: player addWeapon "binocular"
Now you have Binoculars. Always a good thing!
Set a unit's behaviour:
unitname setCombatMode "colour"
"BLUE" (Never fire)
"GREEN" (Hold fire - defend only)
"WHITE" (Hold fire, engage at will)
"YELLOW" (Fire at will)
"RED" (Fire at will, engage at will)
Example: wimp setCombatMode "BLUE"
Time Warping: skiptime hours
Example: skiptime 5
This means that 5 hours are skipped!
Note: Effect is instantaneous
To make an objective work, create a trigger which covers the whole of the 'Mission Area' and put:
"x" objStatus "STATUS"
in the 'On Activation' box, where 'x' is the objective number
Example:
Activation: East - Not Present
On Activation: "1" objStatus "DONE"
You can use the following status options:
DONE - Makes the objective tick off
FAILED - Puts a red cross next to the objective
HIDDEN - Hides the objective until it is activated (use this in your init.sqs; "2" objstatus "HIDDEN", for example)
ACTIVE - Activates the objective (either in a script or a trigger; "2" objstatus "ACTIVE", for example)
Getting AI to drop their weapons
Use this line
unit action ["DROP WEAPON", unit, 0, 0, (primaryweapon unit)]
Example:
guy1 action ["DROP WEAPON", guy1, 0, 0, (primaryweapon guy1)]
Next, here's the simplest of the lot
saveGame
This will save the game (surprisingly)!
Alright, that should be enough for now. If there's something you want to ask me about, or if there's something I think I should add here, don't hesitate to contact me!