Home   Help Search Login Register  

Author Topic: Adding multiple Rifles to a unit  (Read 2578 times)

0 Members and 1 Guest are viewing this topic.

Offline Blip

  • Members
  • *
  • ...Old OFP FART...
Adding multiple Rifles to a unit
« on: 09 Apr 2004, 01:28:56 »
Is it possible to have a unit carry two types of rifles?

For example, have a unit carry an M4 and an M21?

I realize they can carry launchers and rifles, but can they carry two rifles.

I hope this is clear.

Thanks-
...NIGHT WALKER....

Kammak

  • Guest
Re:Adding multiple Rifles to a unit
« Reply #1 on: 09 Apr 2004, 10:17:24 »
Not unless you edit the config.cpp or (create a new one) that changes the space the weapon can be carried in.  You *could* make a Javelin fit in the pistol inventory spot, and each javelin missile fit in one mag spot - but you have to edit/create the config file to do that.


Offline SilentHunter

  • Members
  • *
  • frozen leg'o'lamb (every gamers most loved weapon)
Re:Adding multiple Rifles to a unit
« Reply #2 on: 09 Apr 2004, 19:16:19 »
Not necessarily,

You could add two commands to the unit...

Wepm4  = Ap addaction ["Weapon M4","m4.sqs"]
ap addweapon "m21"

...and make two scripts, m4.sqs and m21.sqs

In m4.sqs you could have...

Code: [Select]
Ap removeWeapon "M21"
ap removeaction wepm4

ap addweapon "m4"

WepM21 = Ap addaction ["Weapon M21","m21.sqs"]
exit

And in M21.sqs you could have...

Code: [Select]
Ap removeWeapon "M4"
ap removeaction wepm21

ap addweapon "m21"

Wepm4  = Ap addaction ["Weapon M4","m4.sqs"]
exit

Obviously you will have to fill in the actual gun names yourself

I hope i got that right, however, there will be a few bugs, such as, if the gun has a full mag when you switch you will loose the ammo in the gun, plus you would have to limit the ammo per gun, for example 2 mags for m4 and 1 mag for m21, unless you go without a rocket launcher

If you want to make these scripts and have trouble, you know where to find me

I hope this helped
[size=4.5]NERDS HAVE FEELINGS TOO! [/size] [size=2.5]*adjusts glasses*[/size]

Offline Blip

  • Members
  • *
  • ...Old OFP FART...
Re:Adding multiple Rifles to a unit
« Reply #3 on: 26 Apr 2004, 05:33:18 »
First let me say thanks to SilentHunter for getting me on the right track for this script.

The basic idea is for a unit to be able to carry multiple rifles.  For example, an M4 and an M21.

There's two scripts, and the player can switch between weapons through their action menu.  Here's what I have so far (with most of the work done by SilentHunter above  ;D)

-M4.sqs-
aP removeWeapon "M21"
aP removeaction WepM4
ap switchmove "WeaponToCombat"

aP addmagazine "M4"
aP addweapon "M4"

WepM4=aP addaction ["Weapon M21","M21.sqs"]
exit

-M21-
ap removeWeapon "M4"
ap removeaction WepM21
ap switchmove "WeaponToCombat"

ap addmagazine "m21"
ap addweapon "m21"

WepM21=ap addaction ["Weapon M4","M4.sqs"]
exit

All of it should be straight forward, the switchmove simply makes the player go through the motion of pulling the rifle off his back when he switches between the two.  

Now, this is what I was hoping you all could expand on.

1.  Make it so the rifle not being used is displayed over the units shoulder.

2.  Make it so when you switch between the weapons, the amount of ammo you have used stays the same.  

And of course any other good ideas!

Alright, Thank You all for help in advance!

Blip

p.s. I am still new to scripting so if you are going to get really technical you'll have to go slow  
...NIGHT WALKER....

csde-PiLLe

  • Guest
Re:Adding multiple Rifles to a unit
« Reply #4 on: 26 Apr 2004, 16:06:02 »
OT: If I catch my neighbour, who just started drilling holes in his ceiling (MY FLOOR), I will rip his heart out and watch him collapse.

DARN, he gave me the start. I just returned from the dentist and was trying to relax a bit....

Cheers
PiLLe

Dubieman

  • Guest
Re:Adding multiple Rifles to a unit
« Reply #5 on: 26 Apr 2004, 20:16:34 »
Would your unit be carrying two rifles like two M4s one in hand and one on back or do they just appear?

There was a previous post somewhere that addressed this. Both rifles were visible but it looked rather odd.

Offline Blip

  • Members
  • *
  • ...Old OFP FART...
Re:Adding multiple Rifles to a unit
« Reply #6 on: 26 Apr 2004, 23:45:17 »
GRK-

At the moment the unit will appear to be only carrying one gun at a time, basically the same way it normally looks.  When you call for the other weapon through your action menu the unit goes through the switchmove "Weapontocombat".  You can probably just look at the animation, but basically he kneels, the gun you had disappears, the new gun appears over his shoulder, and the unit removes it in a regular shoulder to firing position type of move.

I'm shooting to have whatever gun that is not being used appear on the units back.  How is the problem?

I found a command in the command reference to check a units ammo remaining, but like I said I am still new to scripting so I think I am far from perfecting this.  So keep the ideas coming!

Thanks

Blip
...NIGHT WALKER....

Kammak

  • Guest
Re:Adding multiple Rifles to a unit
« Reply #7 on: 27 Apr 2004, 00:52:15 »
Personally I still think it is easier to make a new config and define the weapons you want as both a primary and a secondary, then you could carry both in your inventory, and your ammo would work as normal.  Your primary would always show on your back...but when you switch to the secondary it would appear in your hands.

Solves your ammo problems and keeps the existing inventory system intact.

Maclav

  • Guest
Re:Adding multiple Rifles to a unit
« Reply #8 on: 07 May 2004, 17:34:27 »
Which version do I have to have for this script to work?? I`ve got the 1.46 and it doesn`t work. When I tried to make my own scrpt with actionpl= player addaction ["Do something","something.sqs"], it worked, but when I mixed two actions (when 1 is available, hte ther 1 is not), several actions appeared in the menu.

Dubieman

  • Guest
Re:Adding multiple Rifles to a unit
« Reply #9 on: 07 May 2004, 19:52:41 »
Sorry Blip I gotta use commas more effectively! (Sole purpose of english class :))

I meant that would the unit be carrying his reg rifle in hand and one on back. Like the LAW thing but replace that with extra rifle.

My other view would be with two diff weapons a M21 and M4. Nothing appears on your back and you can choose which one you want and it appears in hand. Like many 1st and third person game platform shooters. (Wow where is Duke Nukem holding a shotgun, M4, sniper rifle, bazooka, and a .50 rifle? Not anywhere comfortable I should guess.) :o

Like I said this already been done before. I just need some time to come up with some info and pics.

EDIT: This search function is pissing me off, I know this was talked about and made before! It has to be somewhere! :P
« Last Edit: 07 May 2004, 20:11:32 by GuiltyRoachKilla »

Offline Blip

  • Members
  • *
  • ...Old OFP FART...
Re:Adding multiple Rifles to a unit
« Reply #10 on: 09 May 2004, 07:50:21 »
Sweet I was hoping this subject would keep going.

Maclav-  I have v1.9, but I don't know enough to tell you if the version matters.
Post the two scripts that your using so we can take a look at them and see if anybody can help. (The only thing I can think of is that your not removing one action when you add the other.)
 
GRK-
Ya english isn't my strong point either.

Right now we have the Duke Nukem think going on with this script.  So ya the unit is pulling the other rifle out of nowhere, with a new set of ammo to I might add.

If you find that other thread covering this topic I would love to see it.

As for putting one rifle in hand, and the other on the units back.  I think we might have  to take  Kammak's advice and edit the config.cpp

Later-

Blip
...NIGHT WALKER....

Offline Blip

  • Members
  • *
  • ...Old OFP FART...
Re:Adding multiple Rifles to a unit
« Reply #11 on: 26 Oct 2004, 07:15:18 »
Alright I am reviving an old topic started awhile back.

Had a thought.

Could we camcreate weapons in the init.sqs and call them like gun1 and gun2.  Then immediately give the player gun1 at the start.  Then use the scripts above to switch between gun1 and gun2.  If this works, it should solve the ammo problem we hit earlier.

Let me know what you guys think,

Blip  :joystick:
...NIGHT WALKER....

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Adding multiple Rifles to a unit
« Reply #12 on: 26 Oct 2004, 16:31:42 »
Some WWII mod has made this type of thing... Too bad it is not released yet... :(

Now, I don't really understand how camCreating the weapon would help in any way... And the camCreate idea is not so good alltogether...
The weapon would be created to a specified position at the same pose as it was modelled in O2...
So if you figured it could be camCreated on the back of the soldier, it won't work... The weapon would be hanging on the soldiers back in the same pose as when it's held with hands..

And you still would need to remove/add magazines via scripting and would have the ammo problem...

Quote
Personally I still think it is easier to make a new config and define the weapons you want as both a primary and a secondary, then you could carry both in your inventory, and your ammo would work as normal.  Your primary would always show on your back...but when you switch to the secondary it would appear in your hands.
Afaik this won't work...
Handguns are not secondary weapons, they are handguns...
Defining a rifle as handgun will make it behave like a handgun, so your M21 would be held like Glock...
Of course I can be wrong, but I think if it could be done like this it would've been done ages ago...
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline sim

  • Members
  • *
  • Hot! Real hot! Damn Hot!
Re:Adding multiple Rifles to a unit
« Reply #13 on: 26 Oct 2004, 16:45:40 »
Quote
Some WWII mod has made this type of thing... Too bad it is not released yet...  :(

WW2EC is working on a config so you can carry to rifles, here is a pic attached.  :)

sim
« Last Edit: 26 Oct 2004, 16:46:26 by sim »
The Unsung Campaign Team Leader

Offline Blip

  • Members
  • *
  • ...Old OFP FART...
Re:Adding multiple Rifles to a unit
« Reply #14 on: 26 Oct 2004, 17:42:43 »
Hey all-

That mod is just what I was hoping for.  Any idea when it will be out?

Thanks,

Blip :joystick:
...NIGHT WALKER....