Home   Help Search Login Register  

Author Topic: Creating my first real mission - need help.  (Read 2693 times)

0 Members and 1 Guest are viewing this topic.

Offline Mada291

  • Members
  • *
Creating my first real mission - need help.
« on: 13 Aug 2007, 04:23:08 »
Hello everybody, hopefully this is posted in the correct section! If not, don't hesitate to move it.

I've fooled around in the Editor enough to know the basics of it. I'm not totally clueless, but I am clueless enough that I need to ask for help here.

What I am hoping for, is to use this thread as a means to ask for help as I go about making the mission - expect me to have many more questions in the near future.

Anyway, on to my first question.

How can I make my own units, and choose their loadouts? I want to use Ebud's EBU SOCOM units as the default skins - specifically, I want to use the Woodland Sniper skin in place of Navy SEALs. The only way I know to do this would be to type a big long list of commands in the Initilization box of each unit.

RemoveAllWeapons player; player addWeapon "M4A1GL"; player addMagazine "30Rnd_556x45_Stanag"

Not to mention NVG's, grenades, and lots more ammo.

So, is there any other way to make my own units that will spawn with Ebud's Woodland Sniper skin and a loadout I define?

That's the only question I have for now. It won't be the last, I can assure you that.

Thanks in advance.

Offline firecontrol

  • Members
  • *
Re: Creating my first real mission - need help.
« Reply #1 on: 13 Aug 2007, 06:58:12 »
This is where scripting can come in really handy. Read some of the tutorials from the editing depot here. Great stuff.
But, I'll show ya how to do this with a script called from the player's initilization line:

In the initialization field of each unit you want to change, type:
Code: [Select]
this exec "prestoChango.sqs"
Now in the mission folder under my documents, Arma, your name, missions, and the name of the mission folder (You should see the mission.sqm file in here, as well):

Create a file in notepad called prestoChango.sqs. In the file type this:

Code: [Select]
;prestoChango.sqs   <--- this is just a comment
_unit = _this select 0

RemoveAllWeapons _unit
_unit addMagazine "30Rnd_556x45_Stanag"
_unit addMagazine "30Rnd_556x45_Stanag"
_unit addMagazine "30Rnd_556x45_Stanag"
_unit addMagazine "30Rnd_556x45_Stanag"
_unit addWeapon "M4A1GL"

exit

There are about a metric butt-tonne (Yes, an actual unit of measure!) of ways to do this though, this is just a sample. :)

I do feel wrong showing you how to make an .sqs script instead of .sqf, which is the new standard and adheres to a better, more structured type of code. Close to C++, if you want an idea. It may be a good idea to learn and become proficient with .sqs syntax first though, unless you've programmed before, in which case .sqf is a breeze.

That same script wouldn't look much different at all... but it would have delimiters at the end of each line. ; <--- delimiter. That and the way the script exits is different.

Code: [Select]
//prestoChango.sqf
_unit = _this select 0;

RemoveAllWeapons _unit;
_unit addMagazine "30Rnd_556x45_Stanag";
_unit addMagazine "30Rnd_556x45_Stanag";
_unit addMagazine "30Rnd_556x45_Stanag";
_unit addMagazine "30Rnd_556x45_Stanag";
_unit addWeapon "M4A1GL";

if (true) exitWith {};

The way in which it is called is a little different too...

In each unit's init field:
Code: [Select]
handle = this execVM "prestoChango.sqf"

the variable handle, well.. handles the return value of the script, in this case it doesn't return anything, so it doesn't matter. But you have to have something there to handle it. That is unique to .sqf in that you can return values from the script (often called a function, since it should serve only one purpose.) 

But anyway, don't want to get too complex. Delve into those tutorials on scripting and you'll be a master mission maker in no time. And by all means, ask away! Plenty of great people here who can help. Be careful of that Mandoble guy though... he tends to solve any problem thrown at him with an insane amount of ease.

I'm thinking up some crazy problems; like: how do I tell what phase the moon is in, and how far away is it at this moment in time, if I wanted an AI to launch an M136 at it, what angle of elevation from tree number 136441 is it, etc. etc....... and I'll get a fancy script in a day or two.

Offline LeeHunt

  • Former Staff
  • ****
  • John 21:25
Re: Creating my first real mission - need help.
« Reply #2 on: 13 Aug 2007, 17:09:01 »
wow this is very helpful Firecontrol for me too. gracias, much better to use a function like that than clutter up my initialization lines...  :good:

Offline Mada291

  • Members
  • *
Re: Creating my first real mission - need help.
« Reply #3 on: 14 Aug 2007, 00:38:44 »
Thanks Firecontrol.

New question.

How do I remove all of the weapons or ammo from vehicles, and then add different ammo?

I've tried..

RemoveAllWeapons boat1; boat1 addWeapon "M4A1GL"

..but that doesn't work. A friend told me that I need to use 'removeallcargo' or a similar command, but I can't find it.

Also, how do I get an enemy to patrol between two points. I know of the "Patrol" waypoint, but I thought that they will only patrol the number of waypoints you set down. I'd like them to patrol between two waypoints continually.

That's all for now. Sorry for he basic questions.

Thanks.

Offline firecontrol

  • Members
  • *
Re: Creating my first real mission - need help.
« Reply #4 on: 14 Aug 2007, 01:08:27 »
Code: [Select]
clearMagazineCargo ftTruck;
clearWeaponCargo ftTruck;
ftTruck addWeaponCargo ["M16",5]
ftTruck addMagazineCargo ["30Rnd_556x45_Stanag",50];
ftTruck addMagazineCargo ["PipeBomb",5];
etc. etc.


ftTruck in this example is the name of a vehicle. Same goes for ammocrates, you just need to name them. Note that this is written in .sqf format.

Almighty Command Reference! This thing is a lifesaver.

As for patrols.... make your waypoints, and the last one should be of type "CYCLE" not "MOVE"... from there they will go to the closest waypoint... so it's often seen at the end of a circular or some other type of shape which leads back to the start. In your case... make one waypoint "MOVE" and the other "CYCLE"... they'll go between the two endlessly (until they smell trouble.) You can also set them on "SAFE" in the behaviour field to make them walk.

Don't worry about asking basic questions. We've all gotta start there! Besides, they're the only ones I'm good at answering! ;)
« Last Edit: 14 Aug 2007, 01:20:26 by firecontrol »

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Creating my first real mission - need help.
« Reply #5 on: 14 Aug 2007, 01:39:43 »
Of course you could always try the one on this site too:

Even Mightier Command Reference


Planck
I know a little about a lot, and a lot about a little.

Offline firecontrol

  • Members
  • *
Re: Creating my first real mission - need help.
« Reply #6 on: 14 Aug 2007, 01:44:21 »
Gads, of course, where are my manners.  :-[ Mightier than mighty, I might add.
Some constructive feedback I hope: I really love the "Commands by functionality" approach, too... can the OFPEC ComRef include something like that? Unless I just can't find it in there.

Like this.

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Creating my first real mission - need help.
« Reply #7 on: 14 Aug 2007, 13:53:48 »
Ask in OFPEC Comments forum, you'll get a response better there rather than in someone else's thread.

Offline Mada291

  • Members
  • *
Re: Creating my first real mission - need help.
« Reply #8 on: 14 Aug 2007, 17:04:37 »
New question. Has anybody played Black Sword? It's a really neat mission that features a computer in it, used to call for Extraction, a Satellite to survey to battlefield, and the ability to call in CAS. How would I use this laptop in my mission?

Is there a way to get somebody to spawn already in a vehicle?

Also, how do I get a dead US pilot to spawn in a Harrier?

Thanks for all the helpful replies.
« Last Edit: 14 Aug 2007, 17:11:53 by Mada291 »

Offline Beagle

  • Members
  • *
  • OFPARMAFTW!
Re: Creating my first real mission - need help.
« Reply #9 on: 15 Aug 2007, 09:28:45 »
Hey Mada - I'm no ace scripter but I think I can solve some of your troubles  :D

Q: Is there a way to get somebody to spawn already in a vehicle?

Like, making the player start inside a Truck, instead of putting him near the truck and making him get in?

If that's what you're talking about, what you need is to go to the Init field of the person you want inside the vehicle, and type:

this moveInCargo BigTruck

Of course you could put the name of your man in place of 'this', and 'BigTruck' is where the name of your vehicle goes.

If you want them to assume a particular position in a vehicle, here are the other variations of that command:

(man) moveInDriver (vehicle)
(man) moveInGunner (vehicle)
(man) moveInCommander (vehicle)

All very useful commands  :)

Q: How do I get a dead US pilot to spawn in a Harrier?

Let's say you've already placed your empty Harrier where you want it. Then you can use the (blah) moveInDriver (blahblah) command to stick a dead BLUFOR Pilot in there.

So, the other half of the problem is how to make the pilot dead. A good way to do this would be to put this in his Init field, after the moveInDriver command:

this setDammage 1

which will kill him. If all goes well you should have a dead US Pilot sitting in your harrier :D

Q: How would I use this laptop in my mission?

This is a little trickier than the last two things to do, but I can give you an example to get you started. If I understand correctly, you want to be able to access different abilities through a menu at a laptop.

First, place your laptop down in the Editor. Give your laptop a name (Let's say, Laptop1). Write in the Init field:

openlaptop=laptop1 addaction["Open Laptop","openlaptop.sqs"]

'openlaptop' is the handle you give to the action so you can remove it later if you want.

'laptop1' is the name of the object you're adding an action to.

"Open Laptop" is the text that will be shown - so when you get close enough to the Laptop, your action menu will have "Open Laptop" in it and you can select it.

"openlaptop.sqs" is the script that ArmA will open when you select the "Open Laptop" action in game.

So now, you need to create a file in your mission directory called openlaptop.sqs. In there you can write what should happen when the player opens the laptop. In this case, a new series of choices would come up. So in there you could write:

laptopmenu1=laptop1 addaction["Call for Air Support","airsupport.sqs"]

You'd also want to put in this line:

laptop1 removeaction openlaptop

That will remove the "Open Laptop" action - now that we've opened the laptop, we don't want to open it again, that'd just be wierd.

You could also put something like

hint "Select a choice from the menu"

to bring up a little hint to tell the player what to do.


That's all just an example, hopefully if you get what I'm trying to say you'll be able to take that knowledge and make your own script. I highly reccomend you check out some tutorials on the site about adding actions and whatnot, that'll set you on the right track better than I can.

And as a last note, I'm sure there are way better ways of doing that last question than I did it, but like I said I'm just a novice ;D

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re: Creating my first real mission - need help.
« Reply #10 on: 15 Aug 2007, 14:51:16 »
never heard bout da black sword mision... mebe u cud PM w/ link ;) :P

but... da laptop thingy can b done in many wayz :D i recomend dialogs, 1ce u get urself used 2 ArmA (im in a dialog fever right now)...

btw use da editor depot 2 get many TUTs from ny kind :D

nd also

WELCOME 2 OFPEC M8

enjoy ur stay ;)

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline Mada291

  • Members
  • *
Re: Creating my first real mission - need help.
« Reply #11 on: 15 Aug 2007, 21:06:54 »
Thanks for all the help guys.

Here is a link to Black Sword. Wonderful mission.

Offline Nixer6

  • Members
  • *
Re: Creating my first real mission - need help.
« Reply #12 on: 16 Aug 2007, 08:28:23 »
Black Sword is really cool. Check it out LCD.  :)

Love the Halo insertions.
Why do I have to be a Rocket Scientist to make a good mission?

Offline Mada291

  • Members
  • *
Re: Creating my first real mission - need help.
« Reply #13 on: 17 Aug 2007, 06:54:51 »
Couple more simple questions, mostly regarding triggers.

1. How would I set it up so once a player enters a certain area, a Civillian in a Ural spawns down the road and proceeds towards the players.

2. How would I set it up so once every hostile in a given area is dead, an objective is completed.

3. How would I set it up so once a building is destroyed, an objective is completed.

Thanks :D.


Offline smoke52

  • Members
  • *
Re: Creating my first real mission - need help.
« Reply #14 on: 17 Aug 2007, 10:48:07 »
1. well you could just place it down the road and have a hold waypoint for the truck, make another waypoint where you want him to move then for your trigger set it up how you like. for TYPE choose SWITCH, then syncronize the trigger with the hold waypoint.

another way is you could have an empty ural and the civilian just standing around. make the hold waypoint, then a GET IN NEAREST waypoint near the truck and finally the move waypoint where you want him to go. do the same with the trigger as above and sync it with the hold waypoint.

a third way to make it look like he spawned is place a civilian way off on an island somewhere. then for the trigger that tells the civilian to drive you put this
Code: [Select]
civil1 moveindriver truck1 ; civil1 domove (getmarkerpos "move1")
place a marker named move1 and he will go in the truck and drive to that marker.

finally to make him spawn you need a script, but i think the above ways would do what you want.
------------------------------------
2. make a trigger covering the area named enemyleft. set the settings to "anybody", and "present" then put this in the condition:
Code: [Select]
abs(EAST countside list enemyleft)<=8

and this in the ON ACT

Code: [Select]
"1" objstatus "DONE"
-----------
i would recommend making a script though so the trigger isnt always checking when you dont need it to. to do that make the trigger and for the condition put
Code: [Select]
abs(EAST countside list enemyleft)<=5

now when theres 5 or less it will activate this trigger, next in the ON ACT

Code: [Select]
[] exec "obj1.sqs"

in the obj1.sqs file put this:

Code: [Select]
#chkenemy
?(abs(EAST countside list enemyleft)<=5):goto "alldead";
?(abs(EAST countside list enemyleft)<=9):goto "fewenemyleft";

#fewenemyleft
~10
goto "chkenemy"

#alldead
hint "Objective Complete!"
"1" objstatus "DONE";
exit
-------------------
3. make a trigger over the building and name it destroy1, click SHOW ID's in the editor and zoom in on the building until you see numbers. thats the ID number of the building. next in the triggers condition put this
Code: [Select]
damage ((position destroy1) nearestObject ******) > 0.9

replace the ****** with the ID number of the building. next in the ON ACT put:

Code: [Select]
"2" objstatus "DONE"
« Last Edit: 17 Aug 2007, 10:56:15 by smoke52 »