Author Topic: How to edit/add new weapon perks?  (Read 4804 times)

How to edit/add new weapon perks?
« on: June 14, 2012, 03:34:51 pm »
Is there any way to edit or add new weapon perks (Penetrate, Knockback etc.)? I've searched over every file that I thought it can be coded - and nothing. I'm not talking about adding existing ones to the weapon, that's clear - but where can I increase/decrease effects of weapon perks or code new such special abilities?

Re: How to edit/add new weapon perks?
« Reply #1 on: June 14, 2012, 04:43:47 pm »
Combat.fos

JovankaB

  • Guest
Re: How to edit/add new weapon perks?
« Reply #2 on: June 14, 2012, 04:47:06 pm »
For a new perk:

1. Define new perk name in _defines.fos. Value must be unique number (not taken by any other weapon perk) in a range 1-255. 0 means no perk.

Code: [Select]
// Item perks
#define WEAPON_PERK_LONG_RANGE                   ( 1 )
#define WEAPON_PERK_ACCURATE                     ( 2 )
#define WEAPON_PERK_PENETRATE                    ( 3 )
#define WEAPON_PERK_KNOCKBACK                    ( 4 )
#define WEAPON_PERK_SCOPE_RANGE                  ( 5 )
#define WEAPON_PERK_FAST_RELOAD                  ( 6 )
#define WEAPON_PERK_NIGHT_SIGHT                  ( 7 )
#define WEAPON_PERK_FLAMEBOY                     ( 8 )
#define WEAPON_PERK_ENHANCED_KNOCKOUT            ( 9 )

The name should start with "WEAPON_PERK_" just like those above, because that's where the Object Editor takes them from. Then you can use the Object Editor to set the new weapon perk. In scripts you should also use the name. For the existing effects, search for "Weapon_Perk" in fos files. These things aren't in one place but most should be in combat.fos.
« Last Edit: June 14, 2012, 06:44:52 pm by JovankaB »

Re: How to edit/add new weapon perks?
« Reply #3 on: June 14, 2012, 11:36:56 pm »
Ach, thanks. I thought it works different, but now it's quite clear. I've seen and understood that _defines & proto part, but it seems that if I'd like to edit anything it's time to seriously start learning ASC ;)

JovankaB

  • Guest
Re: How to edit/add new weapon perks?
« Reply #4 on: June 15, 2012, 03:23:58 am »
Just to edit effects of existing perks, like changing

Code: [Select]
if( weaponPerk == WEAPON_PERK_ACCURATE )
            baseToHit += 20;
to
Code: [Select]
if( weaponPerk == WEAPON_PERK_ACCURATE )
            baseToHit += 50;

you don't need any serious AngelScript knowledge, only a searching skill and
understanding basics of any scripting. I use "find in files" option in Notepad++ :)

Re: How to edit/add new weapon perks?
« Reply #5 on: June 15, 2012, 10:08:38 am »
you don't need any serious AngelScript knowledge, only a searching skill and
understanding basics of any scripting. I use "find in files" option in Notepad++ :)
Yup, half of Fonline servers admins with 0 players, doing like that *))