Home   Help Search Login Register  

Author Topic: Cpp: several classAnims defined, only one works  (Read 2201 times)

0 Members and 1 Guest are viewing this topic.

sanam

  • Guest
Cpp: several classAnims defined, only one works
« on: 13 Feb 2004, 05:50:45 »
In my CPP, I've got three anims defined under "classanims" section, and the relevant menu-items do show up in "class Useractions" section; only the first defined useraction will fire the anim; The script accorded to them do fire, I've set "hints" to check. The _this animate MyAnim2 line won't do anything, not even give an error message. Same for MyAnim3

The're all good because I've been checking them individually, it's only that the three of them would only allow one to work.

The only "strange" point about this is that they all address the same selection (I've been trying with specific, triple-named selections) but with each their own "osa_myaxis" memoryLod reference points. It seems they can share the the myarea_area point without problem.

can we define several osa_this in one model ?
Get them to work ?
The model and his CPP doesn't got any other problem.
No error/warnings at anytime.
One CPP covers 5 different models that must shares the anims.
All behaves the same. (At the moment, I've only "spread-out" the several anims accross the models, but that's NOT the aim of the game).

Thanks reading this !

Peacepunk.
« Last Edit: 13 Feb 2004, 05:55:51 by PeacePunk »

Leone

  • Guest
Re:Cpp: several classAnims defined, only one works
« Reply #1 on: 14 Feb 2004, 09:04:37 »
This is a little confusing....maybe some pics or config snippets would help. From what I understand you have 3 different animations all configged for the same selction  :o I can't see how that would work!!

sanam

  • Guest
Re:Cpp: several classAnims defined, only one works
« Reply #2 on: 15 Feb 2004, 01:38:00 »
It's really as simple as I wrrote:
Quote
      ...wheelCircumference=1;

      class Animations
      {
         class myAnim1            / /it's your name for the anim'
         {   
            type="rotation";      // only one referenced type, the rotation type.
            animPeriod=0.3;      // time for the anim
            selection="sel_mySelection1";   // selection for animated object in visible lods
            axis="axe_myAnim1";      // axis defined in P3D memory Lod
            angle0=0;         //for myAnim1, state "0" angle. Begin of the anim or anim at rest.
            angle1=-0.6;         //maybe one can define angle2, angle3, etc... Dunno.
         };
         class myAnim2
         {
            type="rotation";
            animPeriod=0.7;
            selection="sel_mySelection2";
            axis="axe_myAnim2";
            angle0=0;
            angle1=6.283162;
         };   
         class myAnim3
         {
            type="rotation";
            animPeriod=0.2;
            selection="sel_mySelection3";
            axis="axe_myAnim3";
            angle0=0;
            angle1=2;
         };
      };
      class UserActions
      {
         class myAction1            
         {
            displayName = "Action 1";
            position = "area_myActions";
            radius = 1;
            condition = "damage this < 0.2 and player in this";
            statement = "[this] exec ""\My_Addon\myScript1.sqs""";
         };
         class myAction2
         {
            displayName="Action 2";   // name for action menu that appear on-screen
            position="area_myActions";   // memory point for availability of the action
            radius=1;         //  "size" of the memory point, or range of it
            condition="this animationPhase ""myAanim2"" <= 0.9 and player in this";
            statement="[this] exec ""\My_Addon\myScript2.sqs""";   
         };
         class myAction2Opposite
         {
            displayName="Action 2 bis";
            position="area_myActions";
            radius=1;
            condition="this animationPhase ""myAnim2"" > 0.9 and player in this";
            statement="[this] exec ""\My_Addon\myScrip2Opposite.sqs""";
         };
         class myAnim3
         {
            displayName="Action 3";
            position="area_myActions";
            radius=1;
            condition="player in this";
            statement="[this] exec ""\My_Addon\myScript3.sqs""";
         };
//these two last one doesn't contain "_this animate that" lines.
         class myAction4
         {
            displayName = "Action 4";
            position = "Area_myActions";
            radius = 3;
            condition = "damage this < 0.8 and player in this";
            statement = "[this] exec ""\My_Addon\myScript4.sqs""";
         };
         class myAction5
         {
            displayName = "Action 5";
            position = "Area_myActions";
            radius = 3;
            condition = "damage this < 0.1";
            statement = "[this] exec ""\My_Addon\myScript5.sqs""";
         };
      };

      soundEngine[]=...
And the snippets do their "_this animate that" job .

I would be happy to share other samples with people, as these ones does have a conflict between them/

Leone

  • Guest
Re:Cpp: several classAnims defined, only one works
« Reply #3 on: 20 Feb 2004, 17:42:22 »
Hmmm, a bit too complex without seeing the mdel for me.  ???

All I can think of is maybe the problem is that it there are 5 different models?

Oh and this:

Quote
        class myAction2
         {
            condition="this animationPhase ""myAanim2"" <= 0.9 and player in this";

Aanim2

And this:

Quote
        class myAction2Opposite
         
            statement="[this] exec ""\My_Addon\myScrip2Opposite.sqs""";

myScrip(t)2

And maybe try making the radius a bit bigger. Its very easy to miss a 1m area.
« Last Edit: 20 Feb 2004, 17:47:35 by Leone »

sanam

  • Guest
Re:Cpp: several classAnims defined, only one works
« Reply #4 on: 20 Feb 2004, 18:04:38 »
Please do not mind the MisTypo's; they're only there because I've been clarifying the CPP sample by giving new names: A mistypo such as them would have create error messages.

No, no, all of these lines work if and only if they are used one by one.Menu items available, no warnings all good but one at a model... I happen to be able to put two anims per model actually, as this problem doesn't concern scripted only animations. (not rotating osa_stuff anims)

Imagine a house: can't we have several opening doors/closets/whatever ?
A car is the same: do somebody got a sample of a two-working-doors car please ? A plane with several bulbs flickering ? Or retracting gear on multiple axis ?

The addon has being relased by now, but it still a pity to have worked out this and that while not being able to make it available to all of them.

Thanks pals

PeacePunk

Leone

  • Guest
Re:Cpp: several classAnims defined, only one works
« Reply #5 on: 21 Feb 2004, 04:11:28 »
Well I can show you the anim section of the OPGWC HAS (Hardened Aircraft Shelter). The "2 door" version has four user actions with 10 moving sections in all....all very standard stuff though. It's the scripting side of your addon that I don't understand (not being much of a scripter...)

Quote
      class Animations
      {
         class Door_tsd
         {
            type="rotation";
            animPeriod=0.5
            selection="door_sd";
            axis="axis_side";
            angle0=0
            angle1=-1.500000;
         };
         class Door_tbk
         {
            type="rotation";
            animPeriod=0.5
            selection="door_bk";
            axis="axis_door";
            angle0=0
            angle1=-2.000000;
         };
         class Door_mll
         {
            type="rotation";
            animPeriod=9.2;
            selection="door_ll";
            axis="axis_gate_ll";
            angle0=0;
            angle1=-0.08;
         };
         class Door_mlp
         {
            type="rotation";
            animPeriod=9.2;
            selection="door_lp";
            axis="axis_gate_lp";
            angle0=0;
            angle1=-0.11;
         };
         class Door_mpl
         {
            type="rotation";
            animPeriod=9.2;
            selection="door_pl";
            axis="axis_gate_pl";
            angle0=0;
            angle1=0.11;
         };
         class Door_mpp
         {
            type="rotation";
            animPeriod=9.2;
            selection="door_pp";
            axis="axis_gate_pp";
            angle0=0;
            angle1=0.08;
         };
         class Door_mll2
         {
            type="rotation";
            animPeriod=9.2;
            selection="door_ll2";
            axis="axis_gate_ll2";
            angle0=0;
            angle1=-0.08;
         };
         class Door_mlp2
         {
            type="rotation";
            animPeriod=9.2;
            selection="door_lp2";
            axis="axis_gate_lp2";
            angle0=0;
            angle1=-0.11;
         };
         class Door_mpl2
         {
            type="rotation";
            animPeriod=9.2;
            selection="door_pl2";
            axis="axis_gate_pl2";
            angle0=0;
            angle1=0.11;
         };
         class Door_mpp2
         {
            type="rotation";
            animPeriod=9.2;
            selection="door_pp2";
            axis="axis_gate_pp2";
            angle0=0;
            angle1=0.08;
         };
         class HAS2LightsAnim
         {
            type="rotation";
            animperiod=0.0001;
            selection="HAS2Lights";
            axis="axis_HAS2Lights";
            angle0=0;
            angle1=3.14;
         };
      };

      class UserActions
      {
         class OpenDoors1
         {
            displayName="Open Door";
            position="axis_door";
            radius=3.5;
            condition="this animationPhase ""Door_tbk"" < 0.5";
            statement="this say ""ds_AGS_soundWDOpen""; this animate [""Door_tbk"", 1];";
         };
         class CloseDoors1
         {
            displayName="Close Door";
            position="axis_door";
            radius=3.5;
            condition="this animationPhase ""Door_tbk"" >= 0.5";
            statement="this say ""ds_AGS_soundWDClose""; this animate [""Door_tbk"", 0];";
         };
         class OpenDoors2
         {
            displayName="Open Door";
            position="axis_side";
            radius=3.5;
            condition="this animationPhase ""Door_tsd"" < 0.5";
            statement="this say ""ds_AGS_soundWDOpen""; this animate [""Door_tsd"", 1];";
         };
         class CloseDoors2
         {
            displayName="Close Door";
            position="axis_side";
            radius=3.5;
            condition="this animationPhase ""Door_tsd"" >= 0.5";
            statement="this say ""ds_AGS_soundWDClose""; this animate [""Door_tsd"", 0];";
         };
         class OpenGate1
         {
            displayName="Open HAS Front Doors";
            position="pos_gate";
            radius=20;
            condition="this animationPhase ""Door_mll"" < 0.5";
            statement="this say ""ds_AGS_soundHDoor""; this animate [""Door_mll"", 1]; this animate                   [""Door_mlp"", 1]; this animate [""Door_mpl"", 1]; this animate [""Door_mpp"", 1];";
         };
         class CloseGate1
         {
            displayName="Close HAS Front Doors";
            position="pos_gate";
            radius=20;
            condition="this animationPhase ""Door_mll"" >= 0.5";
            statement="this say ""ds_AGS_soundHDoor""; this animate [""Door_mll"", 0]; this animate                   [""Door_mlp"", 0]; this animate [""Door_mpl"", 0]; this animate [""Door_mpp"", 0];";
         };
         class OpenGate2
         {
            displayName="Open HAS Back Doors";
            position="pos_gate2";
            radius=20;
            condition="this animationPhase ""Door_mll2"" < 0.5";
            statement="this say ""ds_AGS_soundHDoor""; this animate [""Door_mll2"", 1]; this animate                   [""Door_mlp2"", 1]; this animate [""Door_mpl2"", 1]; this animate [""Door_mpp2"", 1];";
         };
         class CloseGate2
         {
            displayName="Close HAS Back Doors";
            position="pos_gate2";
            radius=20;
            condition="this animationPhase ""Door_mll2"" >= 0.5";
            statement="this say ""ds_AGS_soundHDoor""; this animate [""Door_mll2"", 0]; this animate                   [""Door_mlp2"", 0]; this animate [""Door_mpl2"", 0]; this animate [""Door_mpp2"", 0];";
         };
      };

Leone

  • Guest
Re:Cpp: several classAnims defined, only one works
« Reply #6 on: 21 Feb 2004, 04:20:14 »
Ahh...just a thought. What is the basic class of your object and do you have any Named Properties in the GeoLOD?

sanam

  • Guest
Re:That's stuff I can work on.
« Reply #7 on: 21 Feb 2004, 12:45:20 »
Thanks for the sample lines: that is Help.

I assume these lines of code do work inGame...
Do not mind the firing-script stuff, it's rather uncomplicated and I do know how to make it work: I'll be at your service if for instance one of your anims needs a Back & forth operation; kind of stuff when you click once and get the anim played forward and then go back to "zero" state, on a timed basis and without having to click twice.
 Easy I say I'll be gladly of any help.

Sample Script lines, assume it's go-for-it && then-go-backwards anim, timed.
Quote
;ScriptAnim trick by PeacePunk

;get argument passed by the [this] lines in the Cpp:
_myObject = _this select 0


;Animate the object to full -to the "1" value
_myObject animate ["AnimFromCPP",1]

;wait
~0.4

;Go back to previous state -to the "0" value
_myObject animate ["AnimFromCPP",0]

;Gerrof
exit


I see a wrning light anim in your code, and also that this anim isn't activated in the useraction class: I can help there.

And now, maybe the trick that kills: It's "JAWA" class...
And I only got component1, 2, ... in the GeoLod, no named properties: the addon is behaving "normal" otherwise.
Please tell me more about it !
« Last Edit: 22 Feb 2004, 00:20:02 by PeacePunk »

Leone

  • Guest
Re:Cpp: several classAnims defined, only one works
« Reply #8 on: 22 Feb 2004, 04:59:15 »
My skills are only with static objects....I've never made a vehicle. So if the object you are making is a vehicle I've got no idea! But anyway...

In the Named Properties section of the GeoLOD there are all sorts of properties that can be put there. I suggest having a search around here for them (there's a list somewhere), or downloading the OFP Demo files and look through them (again have a little search). http://www.dc3d.co.nz/Tutorials/index.htm might also be helpful.

But for statics if you want to have multiple working animations it is best to be basing your object from the "house" class in the config. Then in Named Properties add a new property called "Class" and give it the value "House".

There are many things that can be defined in there, and it is important to know that once it is Binarized, the game will take those values over anything you have written in the config.

As for the warning lights on the HAS....I didn't post the eventhandler (init) section of the config  ;)

Edit: Just realised you are working on a vehicle! Sorry, I really don't know much about that stuff at all  ???

sanam

  • Guest
Re:Cpp: several classAnims defined, only one works
« Reply #9 on: 23 Feb 2004, 02:33:22 »
The Demo files dates back well before the creation of "anims", hence the most sophisticated thing you'll find in a Demo House is the proxy for the stove... :-\

We got the same tutes, as far as I can see... KlinkStuff, goodStuff. I even wrote personnaly to him. Never answered. :(

I can't imagine where a list of geoLod definitions could be waiting for me... I do will unpack some this and that to have a look anyway. And check Brsseb tutes on house as well, but the Brsseb house only got one door.
I'd'like anyway, if it's not too much askin' again, that you give me the names of named definitions, in your GeoLod, that seems to be related to anims, so I give them a try.
Quote
Then in Named Properties add a new property called "Class" and give it the value "House".
:PI don't understand this line, to put it simply. :P

And AArgh you do eventHandlers, apart of following the sames tutes... I though I'll be able to be of some kind of help-in-return. :-[

Thanks a lot -  :) - Cheers -  :) - Bye

PeacePunk.
Do not mind the vehicle stuff. Let's give it a try anyway, shall we ?

Leone

  • Guest
Re:Cpp: several classAnims defined, only one works
« Reply #10 on: 23 Feb 2004, 04:32:45 »
Ok  :)

In O2, if you haven't got a window called "Named Properties" then press ALT+P. Inside it right click and click "New". These properties can be used to do all sorts of things.

http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?s=182e6b325ef6be1612155630aa8cded9;act=ST;f=50;t=29604;hl=named+and+properties

That's a good starting point. It explains most of the values. For statics you can only really have animations with Class = House.

Also you should have a cfgModels section with the animated selections named in there....example:

Quote
class CfgModels
{
   class Default {};
   class Vehicle: Default{};
   class Car: Vehicle{};
   class YOURCAR: car
   {
      sectionsInherit="Vehicle";
      sections[]=
      {
         "Named Selection1","Named Selection2","Named Selection3"      
      };
   };
};

Also there is a config value that goes "animated=1;"

Other than that....maybe send me the p3d in question? I'm a good boy, I won't give it to anyone else  :)

sanam

  • Guest
Re:Cpp: several classAnims defined, only one works
« Reply #11 on: 23 Feb 2004, 06:30:57 »
NamedProperties are quite new to me: if I check "old" demo models, they got not much of them. UAZ for instance got "noShadow" and "canOcclude", that's all. Well there we're no anims at this time anyway.

So this is the Overriding process... Understand . Now. At least.

Prior to send you this or that, I've got to check the CfGModels inheritance process, sure: you got a point on this matter.

Animated=1 is default value for car section, hence no need to "repeat" altough... You never know...

PeacePunk.
If you play "legaWarz" mod, then you can download the addon on my site.
Otherwise I'll have to twist it a bit in order to work In-Game/Out-Mod. But first I'll try myself.

sanam

  • Guest
Re:Cpp: several classAnims defined, only one works
« Reply #12 on: 01 Mar 2004, 16:33:23 »
With valuable help from Mr Leone, I came to sort this out:

In your selections for the classanims section, you can't have an object (a vertice, a set of faces, a primitive, a set of primitives) that belongs to two (or more, for sure) anims defined in the Cpp: this will prevent one if not any of the anims to work.

The query here was for the DoFP_Skateboard, a very funny lightweight LegaWarz addonthat allows the player to perform several acrobatic figures with the vehicle. DoFP member Sqarehead provided the request & scripts; I did the CPP & model, while not knowing why this crazy little stuff didn't gimme all it got; Now I know. Upon release, the acrobatics are spread out to all the available models, so that they offer you different behaviour, but it wasn't the aim of the game.

Conclusion,'till further addition to this great knowledgeBase, is that you can't have an object performing several classAnims animations, either by UserAction nor Script-Fired commands.

One Vertice, One Selection

Thanks Leone,
If we can be of any help do not hesitate.

Peacepunk
« Last Edit: 01 Mar 2004, 16:38:39 by PeacePunk »

Leone

  • Guest
Re:Cpp: several classAnims defined, only one works
« Reply #13 on: 02 Mar 2004, 04:12:21 »
Hey no problem. Glad you managed to track that one down, curious little "feature". Anyway now I'm off for a skate (dude)  :P ;D