Problems compiling weapons code

IL-2 Modding help (not 3D modding):
Forum rules
IL-2 Modding help (not 3D and mapping help).
Post Reply
User avatar
PA_Yren
FM Modding Master
Posts: 414
Joined: Thu Sep 01, 2016 10:03 am

Problems compiling weapons code

Post by PA_Yren » Mon Jan 29, 2018 12:28 pm

Hi all, the cleverest ones.

I'm trying to compile weapons java files, but every time it fails and weapons are not shown on weapons list. I think my failure is only a matter of casting in compiler (eclipse).

In example:

BombGunMk7

Code: Select all

package com.maddox.il2.objects.weapons;

import com.maddox.rts.Property;

// Referenced classes of package com.maddox.il2.objects.weapons:
//            BombGun

public class BombGunMk7 extends BombGun
{

    public BombGunMk7()
    {
    }

    static 
    {
        Class class1 = com.maddox.il2.objects.weapons.BombGunMk7.class;
        Property.set(class1, "bulletClass", com.maddox.il2.objects.weapons.BombMk7.class);
        Property.set(class1, "bullets", 1);
        Property.set(class1, "shotFreq", 0.05F);
        Property.set(class1, "external", 1);
        Property.set(class1, "sound", "weapon.bombgun");
        Property.set(class1, "newEffect", 1);
    }
}
BombMk7

Code: Select all

// Decompiled by DJ v3.10.10.93 Copyright 2007 Atanas Neshkov  Date: 09/10/2017 14:48:22
// Home Page: http://members.fortunecity.com/neshkov/dj.html  http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   BombMk7.java

package com.maddox.il2.objects.weapons;

import com.maddox.il2.engine.ActorMesh;
import com.maddox.rts.Property;

// Referenced classes of package com.maddox.il2.objects.weapons:
//            Bomb

public class BombMk7 extends Bomb
{

    public BombMk7()
    {
    }

    public void start()
    {
        setMesh("3DO/Arms/Mk7/mono_open.sim");
        super.start();
    }

    static 
    {
        Class class1 = com.maddox.il2.objects.weapons.BombMk7.class;
        Property.set(class1, "mesh", "3DO/Arms/Mk7/mono.sim");
        Property.set(class1, "radius", 3200F);
        Property.set(class1, "power", 8000000F);
        Property.set(class1, "powerType", 0);
        Property.set(class1, "kalibr", 1.0F);
        Property.set(class1, "massa", 764F);
        Property.set(class1, "sound", "weapon.bomb_big");
        Property.set(class1, "newEffect", 1);
        Property.set(class1, "nuke", 1);
        Property.set(class1, "fuze", ((Object) (new Object[] {
            com.maddox.il2.objects.weapons.Fuze_M115.class
        })));
    }
}
if I change something in this file, compile and execute... Bomb Mk7 is not shown on GUI arming.

Can anyone add some light to me... I'm a little dumb... :oops:
Last edited by PA_Yren on Mon Jan 29, 2018 2:34 pm, edited 1 time in total.
User avatar
ton414
Site Admin/FM Team
Posts: 1099
Joined: Wed Jun 08, 2016 10:55 pm

Re: Problems compiling weapons code

Post by ton414 » Mon Jan 29, 2018 12:52 pm

Do not worry, it's a very common mistake, there was even a thread about it, you forgot to include: Property.set(class1, "bulletClass",(Object)BombMk7.class); in BombGunMk7, it is mandatory for any weapon, be it droptank, etc.

Code: Select all

package com.maddox.il2.objects.weapons;

import com.maddox.rts.Property;

public class BombGunMk7 extends BombGun
{

    public BombGunMk7()
    {
    }

    static 
    {
        Class class1 = BombGunMk7.class;
        Property.set(class1, "bulletClass",(Object)BombMk7.class);
        Property.set(class1, "bullets", 1);
        Property.set(class1, "shotFreq", 0.05F);
        Property.set(class1, "external", 1);
        Property.set(class1, "sound", "weapon.bombgun");
        Property.set(class1, "newEffect", 1);
    }
}
Image
User avatar
PA_Yren
FM Modding Master
Posts: 414
Joined: Thu Sep 01, 2016 10:03 am

Re: Problems compiling weapons code

Post by PA_Yren » Mon Jan 29, 2018 2:33 pm

Many thanks, Ton!!!!
Post Reply

Return to “Modding Help (not 3D)”

Who is online

Users browsing this forum: No registered users and 9 guests