LuneR
-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Downloads
Jobs Available
Server Database
Third-Party Services
Top Guides
Store
Crowdfunding
Posts posted by LuneR
-
-
9 hours ago, Litro Endemic said:
as you copy with addeffect, you should copy it through, addeffect was applied into enemy in skill.c (? did you use rathena old revision) on function `skill_additional_effect`
It's a recent revision (1 month old or so).
I'll take a look into skill.cpp, I wasn't aware that was where the status was actually applied. I'll copy the addeff part and try adjusting the code a bit more. Thanks for your time. -
Hello, fellow rAtheners, I'm trying to create a new bonus based on AddEff, but which relies on prng/prd instead of uniform chance. I followed the guide on rathena/wiki/Adding-New-Bonuses. The idea is using prd to lessen lucky/unlucky streaks. What I'm trying to achieve is basically this: On every hit: if (proc) {reset chance to initial rate} else {increase rate by C}
What I got so far:
1. SP_ADDEFF_PRNG added to map.h2. On pc.h, I added (copied from addeff):
struct s_addeffect_prng {
enum sc_type sc; /// SC type/effect
int rate, C; /// Rate (rate should increase by C everytime a proc fails)
short arrow_rate; /// Arrow rate
unsigned char flag; /// Flag
unsigned int duration; /// Duration the effect applied
};3. status.c, I added sd->addeff_prng.clear(); to the list of sd->addeff.clear(), sd->xyz.clear() etc.
4. pc.c, I copied the original AddEff case and put an extra 0 in the arguments.
case SP_ADDEFF_PRNG: // bonus2 bAddEff_Prng,eff,n;
PC_BONUS_CHK_SC(type2,SP_ADDEFF_PRNG);
pc_bonus_addeff_prng(sd->addeff_prng, (sc_type)type2, sd->state.lr_flag != 2 ? val : 0, sd->state.lr_flag == 2 ? val : 0, 0, 0, 0);
break;5. scripts_constants.h, I added export_constant2("bAddEffPrng", SP_ADDEFF_PRNG); to the parameters list.
6. Finally, again in pc.c, I cloned the AddEff function, then modified it a bit (in bold). I tried some different stuff, no luck:
Spoilerstatic void pc_bonus_addeff_prng(std::vector<s_addeffect_prng> &effect, enum sc_type sc, int rate, int C, short arrow_rate, unsigned char flag, unsigned int duration)
{
if (effect.size() == MAX_PC_BONUS) {
ShowWarning("pc_bonus_addeff: Reached max (%d) number of add effects per character!\n", MAX_PC_BONUS);
return;
}if (!(flag&(ATF_SHORT | ATF_LONG)))
flag |= ATF_SHORT | ATF_LONG; //Default range: both
if (!(flag&(ATF_TARGET | ATF_SELF)))
flag |= ATF_TARGET; //Default target: enemy.
if (!(flag&(ATF_WEAPON | ATF_MAGIC | ATF_MISC)))
flag |= ATF_WEAPON; //Default type: weapon.if (!duration)
duration = (unsigned int)skill_get_time2(status_db.getSkill(sc), 7);for (auto &it : effect) {
if (it.sc == sc && it.flag == flag) {
it.rate = util::safe_addition_cap(it.rate, rate, INT_MAX);
if ((rnd() % 100) < rate) {
it.rate = rate;
}
else {
it.rate = rate + C;
}
it.arrow_rate = util::safe_addition_cap(it.arrow_rate, arrow_rate, (short)SHRT_MAX);
it.duration = umax(it.duration, duration);
return;
}
}struct s_addeffect_prng entry = {};
entry.sc = sc;
entry.rate = rate;
entry.C = rate; // custom, assuming we need a 25% proc chance, C should be around 8.5 -- check prng tables for this.
entry.arrow_rate = arrow_rate;
entry.flag = flag;
entry.duration = duration;effect.push_back(entry);
}The code did compile, but did not produce the intended results. I altered the savage baby card to use the bonus, but it never stunned/froze any monsters at all. I tried adding a message on the added if/else block to check if it was working, but instead of working on hits, it sent the messages when equipping the weapon (and only sent messages on successful procs, never on fails). I also tried looking at battle.c, but couldn't find any 'roll chance for status' sort of stuff there.
What am I doing wrong? Any help would be appreciated.
Request: new item bonuses -- change atkele & defele randomly when attacking/getting attacked
in Source Requests
Posted
Hello, I'd like to request a sc addition. It regards the creation of new item bonuses that change attack element and armor element everytime you attack/get attacked. It'd be just like SP_ATKELE & SP_DEFELE, except instead of a permanent element, it'd be randomly/dynamically changed.
Any help appreciated.