OFPEC Forum

Addons & Mods Depot => ArmA - Configs & Scripting => Topic started by: modEmMaik on 13 Apr 2009, 13:18:55

Title: Simple infantry weapon
Post by: modEmMaik on 13 Apr 2009, 13:18:55
Hi all,

in oder to add a Bundeswehr sniper weapon, I modified the M109 model from the BI-weapon samples (http://www.armaholic.com/page.php?id=2804).

The result can be downloaded here (http://www.zshare.net/download/58557144a97e3c5b/). I also added the unbinarized version (optional_files/modem_g82).

As a feature, I have added a reload animation:
Code: [Select]
class modem_g82 : Default {
...
class Animations
{
...
class modem_g82_bolt_action
{
type="translationX"
source="reload";
selection="bolt";
axis="";
memory="false";
animPeriod=0;
minValue=0;
maxValue=0.25;
};
};

This bolt section can be found some of the lower visual LOD's, becauseit is a simple visual animation.

Well, I think this could be used as an example for a simple animation  :)

I you want to release a modified version of this addon, feel free  ;)
Only take care that the original addon can be installed in parallel without interference  :good:

BR,
mike
Title: Re: Simple infantry weapon
Post by: DeanosBeano on 13 Apr 2009, 15:19:17
Very nice Mike thankyou,
 I may use this on a larger Artillery piece sometime in the future, Post as many as these examples as you can ,they make great little turorials.

 
Title: Re: Simple infantry weapon
Post by: modEmMaik on 13 Apr 2009, 15:38:22
Tanks Beano,

But using the reload anim on a tank seems unlikely to be implemented via model.cfg entry. According to ArmA wiki (http://community.bistudio.com/wiki/Model_Config), the reload anim is avilable at weapons only  :weeping:

I used to implement a fire eventhandler function on the T-72 NSV (http://armed-assault.de/downloads/smurfclan-t72a-nsv-v102.html) to simulate the shell ejection, but this tends to be delayed in MP. Better sollution should be to use a game logic, but I have not yet checked this.  :whistle:

Might also be a good sollution to switch these "effects" on and off, because the game logic can be created using an init eventhandler defined in an alternative .bpo, which gives the option to install/use it or not (I did this for a simple tracer implementation, using the cent-tracers (http://www.armaholic.com/page.php?id=1386)).

config.cpp
Code: [Select]
class CfgPatches {

class smurftracers_001 {
units[] = {""};
weapons[] = {};
requiredVersion = 0.108000;
requiredAddons[] = {"Extended_EventHandlers", "cent_tracer"};
};
};

class Extended_Init_EventHandlers {
class All {
smurftracers_001init = "if (isNil 'smurftracers_001xxx') then {smurftracers_001xxx=1; [] execVM ""\smurfctracers\inittracers.sqf"";}";
};
};

inittracers.sqf
Code: [Select]
CENT_SETT_TRACERSETTING = 5;
CENT_SETT_RICO = 1;
CENT_SETT_TRACER = 1;
CENT_SETT_SIZEMOD = 2;

CENT_AUTO=true; // Enable loop
CENT_REFRESH=30; // Sleep time
CENT_PATH="\cent_tracer\"; // Path to take the script from, change to "" if you have the script inside your mission folder
[] execVM (CENT_PATH+"cent_tracer-Init.sqf");
player globalchat "Tracer init done";
Title: Re: Simple infantry weapon
Post by: Gnat on 14 Apr 2009, 14:18:43
Well, reload seems to be usable (in part) on vehicles via a different method. I used it on my released Hydrofoil addon.
Can't say I've tested with static weapons.

BUT, its really tricky getting the "maxValue", its related to number of rounds in a magazine.
Theres a discussion thread on this subject in the BI Forums.

In the CONFIG.CPP
Quote
      class AnimationSources: AnimationSources
      {
         class gunBarrel
         {
            source = "reload";
            weapon = GNT_76a;
         };
      };



Part of MODEL.CFG
Quote
         class main_recoil
         {
            type="translation";
            source="gunBarrel";
            selection="main_recoil";
            begin="recoil_start";
            end="recoil_end";
            initPhase=1;
            memory=1;
            animPeriod =.2;
            sourceAddress = "loop";
            minValue=0;
            maxValue=0.0333;
            offset0=0;
            offset1=1;
          };

... not simple, not perfect visually when the last round of a mag is finished, but at least I avoided using a fired EH.
Title: Re: Simple infantry weapon
Post by: modEmMaik on 14 Apr 2009, 18:42:43
I agree, it is near to perfect. :clap:
Rather simmilar to the ammo belt rotation, where you also limmit the maxvalue to 1/mag-count to get a "floating" ammo belt.

Only issue is that all usable magazines have to have the same size, else you get an alias effect in your animation start/end.
Title: Re: Simple infantry weapon
Post by: DeanosBeano on 14 Apr 2009, 18:58:16
 @ gnat, yes i saw that thread and abused the findings on my challenger MBT tank to set the recoild and a little bit of up movement on the barrel .

 I think a little place where ideas like this can be shared is whats needed , maybe this can be moved to configs and scripting and renamed, to something like useful ideas and snippits

  I have just made a tractor and trailer that works like a charm using use animations , much like the script in your
   V22 gnat this one angles the trailer in accordance with the steering wheel. when i finish it up i will add it here.
   i think it would be good for people who would like to tow them artillery pieces around , they can remain fully functioning and give the appearance of being unattached, although the never will be as we know its impossible , where ai are more than 50m from a human ,the geo lod aint drawn and all workarounds fail.

 
Title: Re: Simple infantry weapon
Post by: modEmMaik on 14 Apr 2009, 23:45:26
... not perfect visually when the last round of a mag is finished, but at least I avoided using a fired EH.

I have just included this into my actual M2 Brad / M6 Linebacker version. I changed the mags to 300 shots each and use following animation:

Code: [Select]
class smurfc_m2a2_MainGunRecoil
{
type="translation";
axis="osa_barrel";
source = "smurfc_m2a2_MainGunReload";
selection="barrel";
animPeriod=0.2;
            sourceAddress = "loop";
minValue=-1.0/(300.0+0.001); // 1.0 / Mag-Size (Bushmaster: 300)
maxValue=0;
memory=1;
initPhase=1;
            offset0=0;
            offset1=1;
};

I think the 1.0/(magsize+0.001) might do the trick, because the animation is correct till the last bullet.

Big Thanks, GNat  ;)

Grrr... I have to revise this statement.. While checking the recoils on a M1 Abrams, the last-shot-effect remains... :(
Title: Re: Simple infantry weapon
Post by: Wolfrug on 15 Apr 2009, 10:26:47
I think a little place where ideas like this can be shared is whats needed , maybe this can be moved to configs and scripting and renamed, to something like useful ideas and snippits

Nice idea - this topic seems to be pretty centered around a single idea though, but you're free to create one of your own and start filling it with interesting info. Just sticky it to put it on the top of the board. :)

Nice work y'all!

Wolfrug out.
Title: Re: Simple infantry weapon
Post by: Gnat on 15 Apr 2009, 13:42:18
I think the 1.0/(magsize+0.001) might do the trick, because the animation is correct till the last bullet.

Good job, sounds like you got it.


Quote from: DeanosBeano
where ai are more than 50m from a human ,the geo lod aint drawn and all workarounds fail.
Well, it fails if its beyond a range (150+) when your looking at it, or fails at a shorter range if your NOT looking at it.
Weird but a pain in the arse. I guess it was BIS's way of giving the CPU a break from dealing with ALL collision detection on a Map.

After my Truck/Trailer experiements years ago on this, I wondered if a script could "catch" the Trailer and roughly script-tow it when its out of visual range, so that when it does return into visual range it will come back together properly. ...... maybe.
Title: Re: Simple infantry weapon
Post by: DeanosBeano on 15 Apr 2009, 18:26:17
Quote
Weird but a pain in the arse. I guess it was BIS's way of giving the CPU a break from dealing with ALL collision detection on a Map.
especially for those who have dampers on there vehicles , this can cause them to flip in the air when they come into range , its also evident with Bis motorbikes . there is a good set of values to prevent it but i never got the time to seriously look into it.

 
Code: [Select]
After my Truck/Trailer experiements years ago on this, I wondered if a script could "catch" the Trailer and roughly script-tow it when its out of visual range, so that when it does return into visual range it will come back together properly. ...... maybe.
 well there is only a problem if you want people to be allowed to un hitch ,for addons that are one unit , with trailer permanently attached you can simply use the v22 idea but using the steerin wheel animation as your base angle and not abs speed and animate the trailer accordingly.

 anyway i look forward to them submarines ;)
Title: Re: Simple infantry weapon
Post by: Gnat on 19 Apr 2009, 15:09:25
anyway i look forward to them submarines ;)

Released ... so play away :D

Yeh, the the animated hitch would be near perfect if you mix at least 2 animations on the pivot, speed and steering wheel.
But what about uneven ground ...... can't see it working well without a script that detects where the land is actually vs truck and pivots the rear up or down.

I see VBS2 has some seriously large Truck-Trailers ingame ... :(
Wonder how they are doing that ......
Title: Re: Simple infantry weapon
Post by: DeanosBeano on 19 Apr 2009, 15:27:13
 you dont need to do anything ,the in game physics should take care of it , simply make sure you have your dampers setup and  land contact  points with nice geometry settings  and the wheels should act natural.

 as you see when i spin it round the trailer wheel lifts off the ground because of the physics as you expect.
 
 http://www.youtube.com/watch?v=aPnOHhLXzvY.

vbs2 does it because they added them vtk tools which gives them a AttachObject command :(


 
 
Title: Re: Simple infantry weapon
Post by: modEmMaik on 19 Apr 2009, 20:54:51
Well, but those dampers can be... tricky  :blink:

I just tried to implement a mountainbike (http://www.zshare.net/download/58822768bcee8965/) and while analysing the motorbikes geo-LOD, I discovered that those dampers are implemented using the support animation (suprising for me..).

So while standing still, those vehicles rest on the geo-LOD objects, while driving, the land contacts. Thus when landcontact touches a stone, the geo-LOD objecs move to the ground and "lift" the whole vehicle.
 :o

p.s.: The original mtb was implemented by rbeni12. I tried to contat him on 14'th Oct 08, but got no reply.
Title: Re: Simple infantry weapon
Post by: DeanosBeano on 19 Apr 2009, 21:48:29
 HaHA ;)
 precisely, we spoke of it earlier . for me its at 50 meters others more, the geo lod is not drawn and so if the amount of travel defined in the suspension and the other things not right, the bikes do cartwheels lol because suddenly the weight is back and the suspension travels down when you are in view  then you luck away and it travels up. . funny as hell to watch but mad as hell if your playing a co-op i guess.

 great job on the bike , had a quick test looks very nice.
Title: Re: Simple infantry weapon
Post by: modEmMaik on 02 May 2009, 17:55:06
While checking a request for Wipman, I created a M9 Beretta replacement including animations for slider, hammer and trigger. Download includes signature and MLOD's.

have fun,
mike

Modem Beretta Replacement (http://www.zshare.net/download/59498630a39892a9/)