Jump to content
Sign in to follow this  
Macser_old

Ofp:Apc Turret problems

Recommended Posts

I've managed to get this Apc's turret

to move via userAction based animations.

apc1xa2.jpg

From the position you see it in now to a position directly

behind.But after the animations have been called

the turret seems to lose functionality.The gunner can still

turn and fire.The "zasleh" selection moves and shows

and so too does the pointer.But the turret itself is locked

in the last position of the animation.The position you see it in

above.

Is this an inherent problem with animating turrets?

If so is there another way around this?

I don't see anything wrong in the config,but here's the

relevant section anyway:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class animturret

{

type=rotation;

animperiod=2;

selection= MainTurret;

axis=MturretAxis;

angle0= 0;

angle1= -1.5708;

};

};

class UserActions

{

class Turretretract

{

displayname = "Retract main turret";

position = "Pos TSwitch";

radius = 5;

condition = "this AnimationPhase""AnimTurret"" <= 0.5";

Statement = "this animate [""AnimTurret"",1]";

};

class TurretDeploy

{

displayname = "Deploy main turret";

position = "Pos TSwitch";

radius = 5;

condition = "this AnimationPhase""AnimTurret"" >= 0.5";

Statement = "this animate [""AnimTurret"",0]";

};

};

Any help is greatly appreciated.

Macser.

Share this post


Link to post
Share on other sites

Let me start by saying, That vehicle is my all time favourite ScFi vehicle, except maybe the drop-ship from the same movie smile_o.gif

Second, pretty sure from memory that a turret could never be part of a animation in OFP .... because bits didn't work correctly. Pretty sure no one solved the problem, and I can't think of any released addons were an animated turret worked.

Share this post


Link to post
Share on other sites

Gnat's correct - you can't (config-wise) animate the turret.

One thing you could do is to have two turrets in the model - one is the 'firing' turret, and is defined as normal in the config. The other one is the 'stowable' turret - this is the one that animates up and down.

What you'd then have to do is define each of these turrets as a hiddenselection, and then setObjectTexture on them at the appropriate time. You'll also need to add and remove the weapon that the turret uses to stop the turret from firing when it looks like it's stowed. In pseudocode:

Turret Down to Turret Up.sqs -

Animate the stowable turret into the upright position.

Hide the stowable turret.

Draw in the firing turret.

Add the turret weapon to the addon.

And:

Turret Up to Turret Down.sqs -

Remove the turret's weapon from the APC

Hide the firing turret

Draw in the stowable turret

Animate the stowable turret into the down position.

A similar effect can be seen on the Falklands GPMG bunkers - when there's no gunner present, the gun itself is shown in a 'stowed' (free) position.

Share this post


Link to post
Share on other sites

Gentlemen,

Thank you both for your replies.

@[Aps]Gnat

one of my faves too.It's got an excellent look,

despite being completely unrealistic,functionally.

I knew it was goin to be a headache gettin it

up n runnin.So far,modelling it was the easy part.

smile_o.gif

With regard to the turret losing functionality,

I suspected that might be the case,as the

turret is already a named selection.I just

got false hope when I saw it working.

smile_o.gif

@Footmunch

I had indeed been thinking along the lines

of a false turret,hidden and revealed as

needed,via script.If I can get that working

I'll be happy.

I'll make an attempt at scripting this animation,

but it's not one of my strong suits.Do you think

it can only be achieved with two seperate

scripts?Or would it get too messy trying to do

everything in one?

Share this post


Link to post
Share on other sites
I'll make an attempt at scripting this animation, but it's not one of my strong suits.Do you think it can only be achieved with two seperate scripts? Or would it get too messy trying to do everything in one?

ok thumbs-up.gif :

class Animations

Quote[/b] ]

class Animations

{

class MG34T_125

{

type="rotation";

animPeriod=0.005;

selection="MG34T_125";

axis="MG34T_axis";

angle0=0;

angle1=-2.96705973;

};

};

class UserActions

Quote[/b] ]

class UserActions

{

class DismountMG34T

{

displayName="Dismount MG34T";

position="MG34T_axis";

radius=1;

condition="gunner this == player && this animationPhase ""MG34T_125"" < 0.5";

statement="[this] exec ""\Burner_Hetzer\Events\dismount.sqs"";this animate [""MG34T_125"", 1];";

};

class MountMG34T

{

displayName="Mount MG34T";

position="MG34T_axis";

radius=5;

condition="this animationPhase ""MG34T_125"" >= 0.5 && (player in this)";

statement="[this] exec ""\Burner_Hetzer\Events\mount.sqs"";this animate [""MG34T_125"", 0]";

};

};

/* condition="This!=Player"; action only to be available via the command menu (6)*/

/* condition="This==Player"; action available to the player (and not the AI via the command menu)*/

/*condition="True"; available to the AI via the command menu (6) and the player via the action menu*/

dismount.sqs

Quote[/b] ]

_truck = _this select 0

_truck setBehaviour "AWARE"

_truck removeweapon "B45_MG34TmAI"

removeallweapons _truck

_gunner = gunner _truck

removeallweapons _gunner

_gunner addmagazine "B45_MG34Tmag"

_gunner addmagazine "B45_MG34Tmag"

_gunner addmagazine "B45_MG34Tmag"

_gunner addweapon "B45_MG34T"

_truck groupChat "The Mg34t has been dismounted !!"

exit

mount.sqs

Quote[/b] ]

_truck2 = _this select 0

_gunner = gunner _truck2

removeallweapons _gunner

~3

_truck2 setBehaviour "AWARE"

if (_truck2 ammo "B45_MG34TmAI" >= 1) then {goto "nocheater"} else {goto "rearm"}

#nocheater

removeallweapons _truck2

#rearm

_truck2 sideChat "rearm !"

_truck2 addweapon "B45_MG34TmAI"

~10

_truck2 setBehaviour "COMBAT"

~10

_truck2 groupChat "The Mg34t has been mounted !"

exit

PICS: the MG34T_125 selection the MG34T_axis axis

CLIP (my own rundumsfeuer turret ingame): SIZE: 6 MB -FFDSHOW codec- http://en.wikipedia.org/wiki/Ffdshow

The rundumsfeuer addon in action

Share this post


Link to post
Share on other sites

Hello Walker,

Well,I can see you're animating

a selection,but it looks like the

turret is the selection.

There's no sign of setObjecttexure.

So how is it functioning after animation?

Were you trying to explain how to "de-activate"

the turret when needed?

Forgive my lack of scripting knowledge,It's probably

quite obvious what you're tryin to say.

It's just I'm more modeller than scripter.

smile_o.gif

Looks excellent btw.

Share this post


Link to post
Share on other sites

1) Well,I can see you're animating a selection,but it looks like the turret is the selection.

Yup that's smile_o.gif Removing the weapon classes from the vehicle, the crew cannot rotate the turret, then once stopped u can animate that using the animation class.

2) There's no sign of setObjecttexure. So how is it functioning after animation?

Quote[/b] ]

ag_smith

Posted: Jan. 02 2006,11:57

setObjectTexture does NOT work over the network in MP games. Please do not use it unless you really have to. Using different p3d models for variants is much better. Plus there's a problem with SP savegames, as mentioned by hardrock, set textures are not saved and then you're gonna end up with transparent model after loading the game.

WWIIEC US pack 1.1 beta patch

- a selection manager, used to correct the bug of set object texture. Without that script, if you save a game and reload it, all the textures set by setobjectexture would disapear. This system corrects that, with a maximum delay of 10 seconds to reset the textures after your reload the game.

The Animations doesnt work fine in SP, like set object textures are set to nothing after you save/reload the game but that doesnt change the fact that the animations works fine in MP smile_o.gif

3) Were you trying to explain how to "de-activate" the turret when needed?

Modify and add that on ur mission.sqm

Quote[/b] ]

class Vehicles

{

items=2;

class Item0

{

position[]={5016.163574,10.692349,5047.851563};

azimut=270.000000;

id=1;

side="WEST";

vehicle="ur_APC_class";

skill=0.600000;

text="apc1";

markers[]={};

};

};

class Sensors

{

items=4;

class Item0

{

position[]={5009.244629,7.481754,5083.252930};

a=0.000000;

b=0.000000;

activationBy="ALPHA";

repeating=1;

age="UNKNOWN";

text="Mount apc !";

name="openapc1";

expCond="apc1 animationPhase ""MG34T_125"" < 0.5";

expActiv="apc1 animate [""MG34T_125"", 1]";

class Effects

{

};

synchronizations[]={};

};

class Item1

{

position[]={5017.100586,7.305157,5083.252930};

a=0.000000;

b=0.000000;

activationBy="ALPHA";

repeating=1;

age="UNKNOWN";

text="Dismount apc ! apc 1";

name="closeapc1";

expCond="apc1 animationPhase ""MG34T_125"" >= 0.5";

expActiv="apc1 animate [""MG34T_125"", 0]";

class Effects

{

};

synchronizations[]={};

};

};

};

Share this post


Link to post
Share on other sites

Hello again AtstWalker,

Thanks for your patience.

I understand what you're saying

about the SetObjectTexture command

not working with SP savegames.

But I'm trying to keep scripting to a

minimum.Mostly,because I'm not very

good with it. smile_o.gif

Based on what I've learned from you and

Footmunch.I can get the turret visually to look

the way I want using a couple of scripts.

I can also prevent it from firing during the

animations,and return it's firing capabability when

it finishes.

Now,I'm aware that SetObjectTexture

messes up,because the texture would have

to be reloaded after a savegame.Or else it

would be transparent.But what if the texture

was already present on the model,in a different

part?Something that's not a hidden selection.

Could that get around the bug?

Or would I still need something like that

"selection manager",described in your last post?

Thanks.

Share this post


Link to post
Share on other sites

yep i'm sorry, using that SetObjectTexture u still need the manager script to avoid the reloading bug sad_o.gif

Share this post


Link to post
Share on other sites

Eh,I'm not sure if I'm missing something,

but I've just tried reloading a save game

point.Just out of curiosity.

And strangely enough,my textures are there,

after the load.Granted the animation is reset,

but the hidden selections don't remain in a

hidden state.They react exactly as supposed to.

So despite the use of SetObjectTexture,I've

reloaded a single player save game,without

any unwanted after effects.Was I misunderstanding

something of the setObjectTexture bug?

Just so you know,I'm using the texture

in question on another part of the vehicle.In an area

that can't be seen.An area that's not a hiddenselection.

Perhaps this does help after all?

The point is,it works. smile_o.gif

Here's my scripting,as it is stands.

TurretUp.sqs:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_apc =_this select 0

_apc say "TurretWindUp"

_apc animate ["animTurret",1]

~3

_apc setobjecttexture [1,""];

_apc setobjecttexture [2,"\M577Apc\Turret.pac"];

_apc animate ["animturret2",1]

~2

_apc setobjecttexture [2,""];

_apc setobjecttexture [0,"\M577Apc\Turret.pac"];

_apc setbehaviour "Combat"

_apc addweapon "browning"

exit

TurretDown.sqs:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_apc=_this select 0

_apc say "TurretWindDown"

_apc setbehaviour "safe"

_apc removeweapon "browning"

_apc setobjecttexture [0,""];

_apc setobjecttexture [2,"\M577Apc\Turret.pac"];

_apc animate ["animturret2",0]

~2

_apc setobjecttexture [2,""];

_apc setobjecttexture [1,"\M577Apc\Turret.pac"];

_apc animate ["animTurret",0]

exit

I also use a small "setup" script via the init eventhandler,

to get the texture loaded on startup,and remove the

weapon from the vehicle.

Visually the scripts perform their task,with a few small

snags.But I think that can be sorted with some tweaking.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×