Jump to content

[WIP] Upgrading weapons


Recommended Posts

Hello,

 

I started working on a script that allows people to upgrade their weapons when they have an amount of items in their inventory. It is a new written script and is still getting updated (daily). Currently on for vanilla Epoch, but I have plans on making it avaliable for OverPoch servers, which could be an amazing idea.

 

Working?

Relative simple, it uses the 'right click script' by maca. No annoying scroll menu and it only works when u right click on the weapon. 

 

Working on the script:

Checks if u have the required item(s) by using "player_checkAndRemoveItems", thanks raymix <3.

If u have the items, it removes the weapon, then adds the new weapon. 

If item(s) not found, it shows a little message "U don't have the required items (item(s))."

 

Upgradeable weapons:

(Small) list that shows the upgradeable weapons and their required items.

WEAPON (NEEDED) | WEAPON (UPGRADE) | ITEMS REQUIRED

LeeEnfield | M14 Aim | 2x scrap metal

M4A1_Aim | M4A1_Aim_camo | 1x ItemCanvas

M9 | M9SD | PartGeneric x3

M24 | M40A3 | 1x ItemCanvas

MR43 | LeeEnfield | 1x Scrap Metal

M4A1 | M4A1_Aim | 3x scrap metal and 1x glass

 

ETA?

Not really, I'll be updating this script every day. I'll release an alpha version of it, really, really soon. 

 

Download:

https://github.com/Darihon2/WeaponUpgrading (EARLY ACCES, NOT ABLE FOR USE YET).

 

Installation:

Installation:
=
Installing this script is not as normal: "Adding a line to the init.sqf", it's a bit harder and following the steps is adviced *unless knowing what u are doing*
 
1. Open up "ui_selectSlot.sqf" (can be found within ur dayz_code.pbo).
2. Scroll down untill u reach the following piece of code:
"
 
_menu ctrlSetText format[_type,_name];
_menu ctrlSetTextColor [1,0.25,0.25,1];
_menu ctrlSetEventHandler ["ButtonClick",_compile];
};
"
3. Add the following piece of code under it:
"
 
// Add extra context menus
_erc_cfgActions = (missionConfigFile >> "ExtraRc" >> _item);
_erc_numActions = (count _erc_cfgActions);
if (isClass _erc_cfgActions) then {
    for "_j" from 0 to (_erc_numActions - 1) do 
    {
        _menu =  _parent displayCtrl (1600 + _j + _numActions);
        _menu ctrlShow true;
        _config =  (_erc_cfgActions select _j);
        _text =  getText (_config >> "text");
        _script =  getText (_config >> "script");
        _height = _height + (0.025 * safezoneH);
        uiNamespace setVariable ['uiControl', _control];
        _menu ctrlSetText _text;
        _menu ctrlSetEventHandler ["ButtonClick",_script];
    };
};
"
So it should like this:
_menu ctrlSetText format[_type,_name];
_menu ctrlSetTextColor [1,0.25,0.25,1];
_menu ctrlSetEventHandler ["ButtonClick",_compile];
};
// Add extra context menus
_erc_cfgActions = (missionConfigFile >> "ExtraRc" >> _item);
_erc_numActions = (count _erc_cfgActions);
if (isClass _erc_cfgActions) then {
....
"
4. Save ur file and copy it within ur mission folder, and customize in "compiles.sqf" 
"player_selectSlot = path"
5. Save the compiles.sqf and paste the file (extra_rc.hpp) in ur mission folder. 
6. Open up description.ext, scroll down and add "#include "path\extra_rc.hpp" to the end of the file.
7. U are done :)

 

Credits:

Omigaaads - original idea

Maca - Right click script

Helping me when I was stuck:

Lmapper,

Csus,

Raymix,

Halvhjearne

Link to comment
Share on other sites

idk if you didnt see my last post or if you just choose to ignore it, but this has already been done:

 

 

i even made an updated version and showed OmigaaaD but he never updated his version, you are welcome to write a pm and ill give you the scripts i made.

 

... also player_checkAndRemoveItems will only work on epoch since other mods does not have that function by default

Link to comment
Share on other sites

I saw ur post, but as far as I read, that release is (a bit) broken? I'm writing a new script, because I have a bit time to much and I want to do something that has a meaning, so here I am. About the "player_checkAndRemoveItems", should be working fine on OverPoch, right, since it still uses Epoch?

Link to comment
Share on other sites

I saw ur post, but as far as I read, that release is (a bit) broken? I'm writing a new script, because I have a bit time to much and I want to do something that has a meaning, so here I am. About the "player_checkAndRemoveItems", should be working fine on OverPoch, right, since it still uses Epoch?

 

the release is not broken, but some of the scripts to do the change from weapon to weapon is ... however, as i mentioned i already did all that work and made generic files that can be used, if you want to add overwatch weapons to it, it will be quite easy and will only require you to input some new classes in the hpp file and what they should change from / too and what tool/magazine items needed.

 

... and yes ofc player_checkAndRemoveItems will work on overpoch, what im saying is that it is not a function in arma or dayz, so personally i would use a more generic way that would work for any mod / mission.

Link to comment
Share on other sites

the release is not broken, but some of the scripts to do the change from weapon to weapon is ... however, as i mentioned i already did all that work and made generic files that can be used, if you want to add overwatch weapons to it, it will be quite easy and will only require you to input some new classes in the hpp file and what they should change from / too and what tool/magazine items needed.

 

... and yes ofc player_checkAndRemoveItems will work on overpoch, what im saying is that it is not a function in arma or dayz, so personally i would use a more generic way that would work for any mod / mission.

Alright, thanks. At the moment I am only focussing on Epoch, maybe later OverPoch.

 

The original idea belongs Omigaaads.

Your job is more modernization / re-writing of the system.

I think, not to mention the original author of the script - is not respectful.

If I'm honest I didn't knew this script exactly existed, I saw the changelog of the DayZ mod and saw this was implemented and that made me wanna make this script. I added Omigaaads to the "Credits" section :). My excuse.

Link to comment
Share on other sites

LeeEnfield | M14 Aim | 2x scrap metal                                                                                                                                                                                                                                                                                           MR43 | LeeEnfield | 1x Scrap Metal

 

Absolutely different weapons, different magazines.

Link to comment
Share on other sites

Don't worry about "stealing my thunder", I enjoy scripting even though I get a lot of 'critic'. It's great to learn of. I'll move on a bit with my manner of this, but thanks for ur help, tho! Might use that as a backup :). 

 

I appreciate it. 

Link to comment
Share on other sites

  • 2 weeks later...

i dont wanna steal your thunder or anything, but heres what i got so far, so you dont do too much "double" work:

 

my "upgrade" file:

http://pastebin.com/8AcCMZDT

 

my "downgrade" file:

http://pastebin.com/XC2L5wQz

 

my hpp file:

http://pastebin.com/jGMm7K2f

I for one am thankful you stole some thunder, lol. Using a heavily modified OWS myself, but your script looks a lot more clean and tidy, while simplifying a lot of stuff I was trying to figure out myself. Was trying to figure out a way to do something like that by studying player_craftItem.sqf but just wasn't working for me. I'll give this a try a bit later today, and thanks for sharing, will be helpful as reference for other future tasks as well I'm sure.

Link to comment
Share on other sites

  • 1 month later...

i dont wanna steal your thunder or anything, but heres what i got so far, so you dont do too much "double" work:

 

my "upgrade" file:

http://pastebin.com/8AcCMZDT

 

my "downgrade" file:

http://pastebin.com/XC2L5wQz

 

my hpp file:

http://pastebin.com/jGMm7K2f

Would i be right in saying this will apply to any weapon you are holding and make it so you can upgrade/downgrade between any version of that weapon with one script? I have made a modified version of OWS but with plenty of combinations from other scripts and i have like 6-7 sqf's per weapon, if this deals with the upgrading/downgrading of each weapon with one script i'll switch to this and just make a separate set for converting magazines :P

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...