OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Wasper on 24 Jul 2004, 04:45:03

Title: A question with weapons
Post by: Wasper on 24 Jul 2004, 04:45:03
Hi , is there anyway I can get certain units to start with the weapons that I want them to have? i.e US soldier start with AK.

Thanks. ;D
Title: Re:A question with weapons
Post by: shadow99 on 24 Jul 2004, 05:08:23
This is the second question on OFPEC I am capable of answering.  :)

In the unit's initialization field put:
removeAllWeapons this;this addWeapon "AK47"

Remember, with the above code I've taken ALL the unit's weapons away, so you might have to put:
removeAllWeapons this;this addWeapon "AK47";this addWeapon "HandGrenade";this addWeapon "HandGrenade";... etc.

You can also do this through init.sqs if you know what this is. In init.sqs however, replace all the 'this's with the unit's designated name.
Title: Re:A question with weapons
Post by: Wasper on 24 Jul 2004, 05:10:15
Is there anyway I can get the unit to spawn with the weapon already reloaded?
And also how do I access this initsqs?  ::)
Title: Re:A question with weapons
Post by: CopyrightPhilly on 24 Jul 2004, 05:14:04
init.sqs is a file you make in the mission folder, you edit it with notepad

and as shadow99 said in that init file put

Code: [Select]
removeAllWeapons this
unitname addWeapon "G36a"
unitname addmagazine "G36amag"

replace unitname with the soldiers name
that will add a G36 with 1 mag to the soldier

cheers, Philly
Title: Re:A question with weapons
Post by: Wasper on 24 Jul 2004, 05:16:20
ahh many thanks , one more question , do you know where I could get an entire list of weapons names? I am trying to find out what the name of the weapon that the "hunter" class for resistance is using. I tried to type in kozlice ball but it crashes to desktop.  :-\
Title: Re:A question with weapons
Post by: shadow99 on 24 Jul 2004, 05:30:31
The Command Reference, also known around here as 'Comref'. Not too knowledgable on this one, or the whereabouts of it. Sorry about that. Shouldn't be hard to find though, you needn't look far, it's only the most popular OFP file.  :D

The weapons part is near the very bottom.
Title: Re:A question with weapons
Post by: CopyrightPhilly on 24 Jul 2004, 05:33:01
do a search on these forums for somthing like

weapons

you should find the list or a link to the list

cheers, Philly
Title: Re:A question with weapons
Post by: macguba on 24 Jul 2004, 12:09:21
Tutorials - References - Weapon and ammo listings.

Add a magazine before adding the weapon to make the weapon loaded.

Read macguba's guide to mission editing for beginners for information on init.sqs and the other files you need for a good mission.

There are several versions of the comref available:  the online official version with added Comments and the old Unofficial version are probably the most useful.

Read the comref like a book:  don't stop to understand every command, just get an idea of what's there.

Also get to know your way around the Editors Depot - there is a lot of stuff there now.

Title: Re:A question with weapons
Post by: Wasper on 24 Jul 2004, 23:20:23
Ahhh. thanks  ;D

Now is there anyway I can remove a specific weapon from units?  I am trying to remove grenades from units but can't figure out how.  ???
Title: Re:A question with weapons
Post by: macguba on 24 Jul 2004, 23:50:42
removeMagazine
removeWeapon
Title: Re:A question with weapons
Post by: Wasper on 25 Jul 2004, 18:30:20
Thansk  ;D , but now I have another issue..  :(

I can't seem to spawn the m60 or the PK machine guns. I type in :

this addweapon "m60" or this addweapon "PK" .. but nothing happens when I preview the game , I know that I got in the correct command code name because the game doesn't crash to desktop , but I don't get the gun when I spawn.  ???
Title: Re:A question with weapons
Post by: macguba on 25 Jul 2004, 19:39:10
Some units - such as snipers, medics and civvies, can't carry MGs.    

Does it work with another weapon, for example M16?