Home   Help Search Login Register  

Author Topic: good code + good code = bad code? (in .cpps)  (Read 1428 times)

0 Members and 1 Guest are viewing this topic.

Offline remcen

  • Contributing Member
  • **
  • a.k.a. hottentotten_mike
    • IM:UC
good code + good code = bad code? (in .cpps)
« on: 16 Aug 2006, 14:22:59 »
one of my soldier model makes ofp crash when i insert the unit in the mission editor and hit preview. ofp crashes on loading, not a milisecond after rendering the model.

first i thought that it might be a model issue, so i triangulated all non-planar faces (should have done that anyway :P) - the problem remained. then i exchanged all proxies cos that worked once in the past with a different model. problem still remained. then i thought that it might be the config cos i once deleted all animations in the config and bingo - i saved the config with the anims, deleted them and saved the file as new config.cpp. no problems any more. then i deleted the config, renamed the old one to config.cpp again, and remarked the animations of the single units and tested them separately.
strangely the crash only happened when my first unit had the anims, for all other models they work fine. more strangely i can't find any syntax error or something in the anim code of this units, and even more strangely it's simply a copy of all other animations - in the config and in the model. they all use the same code and selections in the model, but only in one model this leads to unstability.  ???

Code: [Select]
class CfgVehicles
{
   class All{};
   class AllVehicles:All{};
   class Land:AllVehicles{};
   class Man:Land{};
   class Soldier:Man{};
   class SoldierWB:Soldier{};
   class imuc_ussf: SoldierWB
   {
hiddenselections[]={"sunglasses","sunglasses_glass","bloodpatch"};
    accuracy="3.00000000";
    weapons[]={"throw","put", "SJB_TOS_M4_AIMPOINT_SD", "SJB_TOS_Colt1911", "nvgoggles", "binocular"};
magazines[]={"SJB_TOS_M4_SD_mag", "SJB_TOS_M4_SD_mag", "SJB_TOS_M4_SD_mag", "SJB_TOS_M4_SD_mag", "SJB_TOS_M4_SD_mag", "SJB_TOS_M4_SD_mag", "SJB_TOS_Colt1911_Mag", "SJB_TOS_Colt1911_Mag", "SJB_TOS_Colt1911_Mag", "SJB_TOS_Colt1911_Mag", "Smokeshell", "Smokeshell", "Handgrenade", "Handgrenade"};
    sensitivity=1.25;
    model="\hm_ussf\ussf.p3d";
    nightVision=1;
    camouflage=0.750000;
    armor=3.400000;
    armorStructural=2.000000;
    armorHead=0.400000;
    armorBody=1.900000;
    armorHands=0.500000;
    armorLegs=0.500000;
    scope=public;
    side=1;
    vehicleclass="IMUC - USSF";
    namesound="blackop";
    displayname="USSF 1";   
    imuc_ussf_wounds

// class animations
//        {
//        class sunglasses
//            {
//            type="rotation";
//            animPeriod=0.01;
//            selection="brain";
//            axis="axis_sunglasses";
//            angle0=0;
//            angle1=2.00000;
//         
//            };
//      };
//
//        class useractions
//        {
//        class takeoff_sunglasses
//                {
//                displayname="Take off sunglasses";
//                position="brain";
//                radius="0.1";
//                condition="this animationphase ""sunglasses"" == 0";
//                statement="this animate [""sunglasses"",1]";
//                };
//            class puton_sunglasses
//                {
//                displayname="Put on sunglasses";
//                position="brain";
//                radius="0.1";
//                condition="this animationphase ""sunglasses"" == 1";
//                statement="this animate [""sunglasses"",0]";
//                };
//      };


    class EventHandlers
      {
        Init="[_this select 0] exec ""\hm_ussf\sc\init.sqs""; [_this select 0] exec ""\facestex2\basefaces.sqs"";";
        };
   };

it works fine like this, but when the remarked code (// ...) is "activated", ofp crashes when previewing the test mission.
we're looking for members: IM:UC MOD

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: good code + good code = bad code? (in .cpps)
« Reply #1 on: 16 Aug 2006, 20:08:42 »
Try removing the " " from the numeric values (radius) on the userActions..

As for what would be wrong with the class animations I have no idea.. ???
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

DanAK47

  • Guest
Re: good code + good code = bad code? (in .cpps)
« Reply #2 on: 17 Aug 2006, 02:19:14 »
Quote
selection="brain";

Check the model for this?

Offline remcen

  • Contributing Member
  • **
  • a.k.a. hottentotten_mike
    • IM:UC
Re: good code + good code = bad code? (in .cpps)
« Reply #3 on: 17 Aug 2006, 11:11:11 »
Quote
selection="brain";

Check the model for this?

yep, that's the little dummy object that rotates in the units' heads. the setobjecttexture of the sunglasses depends on the anim phase of this dummy object.

ok... did some tests:
after deleting the "" from the radian values -> model works in 1st person view, but ofp crashes in 3rd person view
the "brain" selection was initially only in the 2nd res lod. after inserting it into all res lods the model works in 1st person view, and close 3rd person view. when ofp renders the high res lods it still crashes. strange, isn't it? esp. cos this all is no problem in all other models which i didn't alter at all.

//edit: oops.. also the other models make ofp crash when their high res lods are rendered.

//edit2: you might say it's without doubt the models which cause the crashes. far from it: i deleted all animations, useractions and eventhandlers from the config. result was that no unit crashes the game anymore. i placed them on desert island, ran backward until they vanished in the mist and again ran towards them til i was standing right in front of them. no problems at all.
« Last Edit: 17 Aug 2006, 12:48:51 by remcen »
we're looking for members: IM:UC MOD