MajorBlunderbuss 3 Posted September 10, 2018 Hello mates, I hope this is the right place to come to, cause I'm about to get chronical headaches from trying to solve this problem by myself. The last couple of days I'm spending some of my time overhaulin' a version of DUWS (Dynamic Universal War System), and most of the time everything worked like a charm. But right now I'm not able to find a solution for this problem I've ran into. To make my issue more clear, I'd like to be a little bit more specific, so maybe my helping hand is able to fully understand. In DUWS - I guess many of you know this mission - you are able to buy vehicles, units, squads etc. Since I'm reworking some parts of DUWS Unofficial from scratch - esspecially the units, vehicles and squads -, the one who made it in the first place delivered a very nice template for the things I wanted to do. The unofficial version of DUWS has build in mod support, like for RHS Escalation, etc. I have expanded this, by adding in support for some other mods like "Global Mobilization", "BWMod" and "FFAA" . You can play it vanilla, or with those mods. If you have the mods, you can buy the units and vehicles of those factions, if not, a little hint will pop up, telling you that the mod is missing - this is done by checking if the requested unit is available in the first place. Here is a little insight of how it looks for requested foot soldiers: Spoiler // Machinegunner MG5 Tropentarn cost 4 case 53: { if (commandpointsblu1 >= 4) then { if (isClass(configFile >> "CfgVehicles" >> "BWA3_MachineGunner_MG5_Tropen")) then { hint "Unit ready !"; commandpointsblu1 = commandpointsblu1 - 4; ctrlSetText [1000, format["%1",commandpointsblu1]]; _group = group player ; "BWA3_MachineGunner_MG5_Tropen" createUnit [_spawnpos, _group, "if (revive_activated == 2) then {[this] execvm 'ais_injury\init_ais.sqf'}; if (player_fatigue == 0) then {this enablefatigue false};", _skill, "private"] ; } else { hint "BWMod not installed!"; }; } else { hint "Not enough command points"; }; }; The same goes for vehicles, of course... BUT... here comes my problem: I'm not able to get it to work for requested mod squads - like a fireteam, or a tank platoon. I mean I'm able to get the mod squads working of course, I can buy them and they are fully functional, but I want the game to check if this squad is available in the first place. Otherwise you will pay credits for nothing if the needed mod isn't installed. And since I'm planning to release this version someday, I really want to get this fixed and implemented. And here is a little insight of how it is defined for squads: (Original, only changed the squad and the faction) Spoiler // Fireteam Tropentarn cost 8 case 23: { _cost = 8; _grouptype = (configFile >> "CfgGroups" >> "West" >> "BWA3_Faction_Tropen" >> "Infantry" >> "BWA3_InfTeam"); if (commandpointsblu1 >= _cost) then { _group = [_spawnPos, WEST, _grouptype, [], [], blufor_ai_skill] call BIS_fnc_spawnGroup; player hcsetgroup [_group,""]; commandpointsblu1 = commandpointsblu1 - _cost; ctrlSetText [1000, format["%1",commandpointsblu1]]; DUWS_number_fireteam = DUWS_number_fireteam + 1; _group setGroupId [format["Fireteam %1",DUWS_number_fireteam]]; hint "Squad ready !\nAccess it with [L.CTRL - SPACE]"; } else { hint "Not enough command points"; }; }; }; It's really driving me crazy. I'm no professional programmer, sure, I've learned and catched many things by myself, and I already tried to solve it by myself, but after many failed attempts I can't think of anything else then asking for help, cause I'm running out of ideas. If some mighty coding paladin would be so kind to point me in the right direction, or even take this template above me and make it functioning, I'd really, really appreciate it. I just want it to work like it works for units and vehicles, and I'm sure this is possible. But I can't figure it out. Well, enough said. Have a nice day folks, hope to hear from you! Regards, MajorBlunderbuss. Share this post Link to post Share on other sites
Larrow 2820 Posted September 10, 2018 Surely its the same as your first example, instead checking whether the group class exists. // Fireteam Tropentarn cost 8 case 23 : { _cost = 8; _grouptype = (configFile >> "CfgGroups" >> "West" >> "BWA3_Faction_Tropen" >> "Infantry" >> "BWA3_InfTeam"); if (commandpointsblu1 >= _cost) then { if ( isClass _grouptype ) then { _group = [_spawnPos, WEST, _grouptype, [], [], blufor_ai_skill] call BIS_fnc_spawnGroup; player hcsetgroup [_group,""]; commandpointsblu1 = commandpointsblu1 - _cost; ctrlSetText [1000, format["%1",commandpointsblu1]]; DUWS_number_fireteam = DUWS_number_fireteam + 1; _group setGroupId [format["Fireteam %1",DUWS_number_fireteam]]; hint "Squad ready !\nAccess it with [L.CTRL - SPACE]"; }else{ hint "BWA3 group not installed!"; }; }else{ hint "Not enough command points"; }; }; I have never looked inside DUWS and been a while since I played it, but wouldn't it be better to not allow the option to buy units/vehicles/groups from addons that are missing in the first place? Rather than give someone the option and then say OH sorry you cannot have that How is the ability to buy presented to the user? by ui menu or addAction? 2 Share this post Link to post Share on other sites
MajorBlunderbuss 3 Posted September 10, 2018 Hello friend! I actually couldn't find any sleep, so I've checked if someone already replied to my question - and here you are, surprise! I literally kicked myself out of the bed to see if I can get the stuff you gave me running, cause this issue really frustrated me. So I have copy pasted it, made some minor adjustments. Started the game, tried it, didn't work. Adjusted again, tried again, didn't work again. Then, shortly before I was giving up hope, I recognized that I accidently deleted the bottom "};", cause when I copy pasted it, everything shifted back by four digits, and I thought that the bottom "};" isn't needed since I already had one. Then I manually shifted everything forward by 4 digits without deleting it, and... TADAA! It actually really worked! You have done me a great service, for that I really thank you. I really appreciate it, seriously! To answer your question: You can choose all the units, vehicles and squads in an UI, seperated from each other. One selection for units, one for vehicles and one for squads. You can scroll up and down when you're in there, and all the vanilla and mod units are arranged one above the other. Very simple example: Spoiler UNITS PLEASE SELECT __________FACTION 1__________ Rifleman (2C) Grenadier (3CP) Sniper (4CP) __________FACTION 2__________ Rifleman (2CP) Grenadier (3CP) Sniper (4CP) __________FACTION 3__________ Rifleman (2CP) Grenadier (3CP) Sniper (4CP) Same goes for vehicles, etc. The main reason I implemented more factions is diversity. The guy who made DUWS Unofficial already implemented support for some little RHS content. I expanded this aswell, and added the other factions I mentioned, some of their important stuff, their units, vehicles and so on. You can play it vanilla, or with mods - it doesn't matter. Since DUWS's missions.sqm only contains the playable vanilla characters, while all the stuff you can buy is only an option and not a must, you now at least have the option to play with different stuff, without having to completely rewrite the whole mission for one specific faction. The NATO leads so to speak, while all the other armys are available if wanted. I put much effort in it to make it look good, play well, feel pleasent etc. And it's fun - the road is the goal, right? Well, that's it for now. I really need to get some sleep. But again, I can't thank you enough! Saved my sanity. Enjoy your time friend! Regards, MajorBlunderbuss. Share this post Link to post Share on other sites