Jump to content
  • 0

Configue changing weapons increases damage


Kater

Question


  • Group:  Members
  • Topic Count:  32
  • Topics Per Day:  0.46
  • Content Count:  75
  • Reputation:   0
  • Joined:  04/03/24
  • Last Seen:  

Hello friends, do you know where the adjustment is made so that when attacking and changing weapons, the effect of the changed weapon applies?

famous switch.

Example: Katar blade and exchange for dagger to increase damage

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.01
  • Content Count:  24
  • Reputation:   4
  • Joined:  06/29/22
  • Last Seen:  

So... you want to make it so that when you have a Katar equipped, and you swap to a Dagger, you gain a damage buff?

If you give more details about your intended functionality and your level of technical ability to make code changes I can adjust my response to help you better. For now I'll just throw out some starting points for you to investigate.

I would make a custom status for this by adding an entry in status_db.yml, then setup the status in source by adding it to the `sc_type` enum in status.hpp. You'll also want to export the enum in script_constants.hpp. Where you add a check for the SC to actually increase the damage is up to how you want it to stack. For starters, you can add a check for the SC in `battle_calc_cardfix` (if you want card style damage) or `battle_addmastery` (if you want it to add mastery style attack).

It seems most straightforward to give the player the status somewhere in pc_equipitem (pc.cpp). You have a few options for implementation here. I'm going to say what I think is simplest to get you started then you can improve it through testing.

1) Store a reference near the top of the function to the player's current weapon type, e.g: `int oldweapon = sd->weapontype1`

2) Near the bottom of the function, sometime after sd->weapontype1 gets updated to id->subtype, do a simple check:

if (oldweapon == W_KATAR && sd->weapontype1 == W_DAGGER) {
     sc_start(...)
}

I would throw this right after the assignment happens probably, so around here. Don't forget to brace the unbraced if statement, recompile, and try it out.

Note that if you want this effect to happen for specific daggers as opposed to every dagger, then I would favor an approach that calls a buildin_func through the dagger's Equip Script.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...