OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Thog on 03 Apr 2005, 03:20:09
-
Ok, so I've done some editing in the past, and I've decided to get back into it. I'm using GOTY edition, no mods (yet), 1.96.
What I'm running into is that I cannot seem to add ammo to a unit. I'm trying to add, say, grenades to a heavy grenadier, or Stingers to an AA guy, or (on the other end of the scale) switch weapons on a regular trooper so that he has an MP-5 instead of an M16.
It isn't working. I can get the weapon added, but no matter what I try to do, I cannot get the ammo to show up. I've tried every tutorial I could find, experimented quite a bit, and still had no luck.
Below are some examples of what I'm doing;
MP-5 guy
Here I'm just trying to strip away all weapons on a unit in the editor and replace them with a single MP-5 and 5 mags
Into the Init field I put;
this removeWeapon "m16"; this removeMagazines "m16"; this removeMagazines "handgrenade"; this AddMagazineCargo ["HK", 5]; this addweapon "HK";
Stinger Guy
I'm just trying to give him one or 2 more ammo (2 examples).
Example 1: this addmagazine "AALauncher"
Example 2: this addmagazineCargo ["AALauncher",2];
Heavy Grenadier
I'm trying to give him another 'bandolier'.
Example: this addmagazinecargo ["grenadelauncher",3]
In all cases the weapon was added (or present), but no ammo or reloads were added. I checked with the normal 'change/reload mag' command and with the 'enter' command list.
This is maddening. All of the tuts that I've checked have listed examples and snippets (usually only 1 each, sometimes glaringly wrong), and I've tried all of them and every variation I can think of. I'm stumped. I have an axe.
So, if anyone can sort this relatively simple problem out, I would be quite delighted.
Thanks,
Thog
(final note; the strings I've included are direct copies of the originals, not edited to be examples, just a straight cut'n'paste. I've tried variations without the brackets, and those failed with various error messages)
-
Dude, addmagazinecargo only works on vehicles. You have to use addmagazine.
:beat: *Gets Shot* :beat:
-
Thanks for letting me know(*), but that doesn't fix the whole problem. This seems to work so far on small arms (the HK for example), but if you'll notice at least one of those examples uses 'addmagazine' and didn't work either. I've also tried AddMagazine in the following format;
(AA Guy)
this removeWeapon "m16"; this removeMagazines "m16"; this addMagazine "AALauncher"
I've also tried variations with multiple entries for adding the magazine, such as
this addMagazine "AALauncher"; this addMagazine "AALauncher"
So for larger weapons it appears to fail. Any ideas? Maybe adding a second weapon? But that doesn't work for weapons that don't come loaded...
* For those making 'tutorials', I strongly suggest you explicitly state that AddMagazineCargo is for vehicles. I've seen several tuts that list 'AddMagazineCargo' in examples for 'AddMagazine'. They describe AddMagazine and then provide a 'AddMagazineCargo' example.
-
I dont think you can say "this removeMagazines "m16";
You have to repeat the line "this remove magazine "M16"" for every clip untill you've removed as many as you need to to replace with new ammo types...
You have to make sure there is a spot to add ammo to before you can add it.
Hope it helps.
-
Actually, -that- part worked. It removes the M16 and (as near as I can tell) all M16 ammo. It's one of the known commands (which appears to function better than the AddMagazine example).
Then again, maybe it's only removing one, but I can't see it because I no longer have an M16. Let me test it tomorrow and find out. I'll remove the command that deletes the M16, and just check to see if I'm one down on the M16 ammo.
Thog
-
Sometimes I think its easier to just use "removeallweapons" & start fresh giving them the loadout you want them to have...
Also if your using the editor in multiplayer you can easily preview & check your units gear...
-
I would use remove all weapons and start a fresh. thats what I do.
-
And always add at least one magazine before the weapon, so that the weapon is loaded.
The comref is crystal clear about addMagazineCargo. Never[/i] attempt to use a command for the first time without having studied both the online version of the comref (which often has helpful comments) and also the Unofficial command reference guide (which is a little out of date now but still valuable). ;) The only exception is if you are in a really good mood and wish, for some reason, to feel feel frustrated, unhappy and irritable. :o
Tutorials and forum posts frequently have minor error of syntax and occasionally even fact. If you find an error in a tute, post a (polite) Comment with details, so that future users don't get caught out. :thumbsup:
-
Units also have a carrying capacity. A soldier cannot carry more than 1 aa missle, or MM1 mag, even if they have no other weapons or equipment on them. You syntax is fine, but there is no space for the extra ammo
-
Thats rigth, a Normal soldier have 10 Slots (I think), 4 designed for the primary ammo, and the other 6 changes whit the Roll of each soldier, I dont Know why those commands dont work for you....
try using these in the loon's init field:
RemoveAllWeapons(This);This AddMagazine "HK"; This AddMagazine "HK"; This AddMagazine "HK"; This AddMagazine "HK"; This AddWeapon "HK"; This AddMagazine "AALauncher"; This addWeapon "AALauncher"
byes
-
My thought is downlaod Chris' OFP Editor. It has custom load out for you. It stripps the weapons and then adds what you want to the guys. As well custom Crate loading, Overview and Breifing, Script Edit, and He help me out not to long ago when I had a question. Give it a try and it really cuts down on the time.
-
I think the crux of the problem is that an AA soldier can only ever have one AA missile at a time.....i.e. he can't carry 2.
Planck
-
I checked the OFP and here is how many weapons and magazines each soldier can carry. :D
Normal soldiers(Soldier, Machine Gunner, AA AT LAW, Officer, etc.)
--------Primary + Secondary Weapon + Hand gun + 10 Primary slots + 4 handgun slots (Each slot is as size as a M16 mag)
Medic
--------Primary + Hand gun + 4 Primary slots + 4 handgun slots
Sniper
--------Primary + Secondary Weapon + Hand gun + 4 Primary slots + 4 handgun slots
Civilians
--------Primary + Secondary Weapon + Hand gun + 6 Primary slots + 4 handgun slots
And here is some magazine's slot
2 slots: LAW, RPG, M60, PK, Pipe bomb, Mine, etc.
6 slots: AA, 9k32, AT-4, Carl
So you must make sure that a soldier can carry the weapon and mag you add. ;)
If you want to add more mag than he can carry, you have to make a new addon and define the soldier to take more solts. ;)
-
IIRC civvies cannot carry a secondary weapon. And they have 4 slots, not 6, except for police who do have 6.