Jump to content
Sign in to follow this  
Bomba

Declare new class in mission

Recommended Posts

Is any way to declare custom class for mission without use addons?

I want declare class

class CfgVehicles
{
class US_Patrol_Pack_EP1;
class US_Patrol_Pack_EP1_Medic : US_Patrol_Pack_EP1 {
            displayName = "$STR_MEDICBACKPACK";
            picture = "\images\medicbackpack.paa"
       };
};

I try declare CfgPatches in description.ext, but without any success

configFile >> "CfgVehicles" >> "US_Patrol_Pack_EP1_Medic"

return emtpy string :j:

Share this post


Link to post
Share on other sites

Pretty sure you'd need to put it in a config.cpp and into a seperate PBO. I don't think new classes can be defined via a mission.sqm and/or description.ext

Also, looking at that code, it appears all you're doing is changing the name and the picutre? Whats the point? If you were changing the model or something else important I'd understand the need, but as it stands now can't you simply use the US_Patrol_Pack_EP1 class?

Share this post


Link to post
Share on other sites

I do not want to change existing classes, I want to add a class that inherits from the existing one.

Change the picture and caption is only attributes.

I want to give players additional opportunities if the player has a certain type of backpack. Just check by className

Backpack Medic

Backpack Engineer

Backpack Pilot

Backpack Saboteur

I can store information about the type into object properties of a standard backpack. But the mission (warfare) has already been written and in this case required rewrite a lot of code.

I would like to simply add a new class and not to conduct additional processing, such as when the backpack is passed from player to player

Edited by Bomba

Share this post


Link to post
Share on other sites

I see what you're saying, but you'll still need to do it via a PBO in the addons folder, as I do not beleive what you're attempting to do can be achieved via the mission file itself.

Share this post


Link to post
Share on other sites

ConfigFile is only for config root and that are the "config.cpp" files in addons!

If you want to read Data from "description.ext" you need to use "missionConfigFile"!

BUT!!!! :

If you use:

class CfgVehicles {     
 class US_Patrol_Pack_EP1_Medic  {              
   displayName = "$STR_MEDICBACKPACK";              
   picture = "\images\medicbackpack.paa"         
 }; 
};

you can read the values with

pic = getText (missionconfigfile >> "CfgVehicles" >> "US_PATROL_PACK_EP1_Medic" >> "picture");

but you can't use the unit (so you can not use createunit... "US_PATROL_PACK_EP1_Medic"). If you want to use the unit, you MUST declare them in the config Namespace, so you have to use "Addon" and "config.cpp"

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  

×