I tried out the changes myself and it works for me, with the one small change I mentioned:
var anilen = global.skelani_animation_length[atkanimation] - 1;
(It's a bit tricky to see since the animation is only 5 frames long, but you can press "Home" to lower the framerate to 10/s)
So the full, working script looks like this:
/// @description psm_melee()
function psm_melee() {
var anilen = global.skelani_animation_length[atkanimation] - 1;
//Physics
if(onground){
player_naturalfriction()
}
player_controls_jump() //Can jump-cancel
player_inertia_x()
player_inertia_y()
player_boundaryclamp()
//Animate, spawn attack
statecntr++
if(statecntr < atkwarmup){
skelani_set_animation(atkanimation,0)
}
else if(statecntr < atkwarmup + atkduration){
skelani_set_animation(atkanimation,anilen*(statecntr-atkwarmup)/atkduration)
}
else if(statecntr == atkwarmup + atkduration){
skelani_set_animation(atkanimation,anilen)
n = instance_create(x,y,atkhitboxobj)
n.image_xscale = skelani_xscale
n.sprite_index = atkhitboxspr
with(n){
player_weapon_get_stat_block_current()
//Heavy attacks are 30% stronger, but only for melee weaposn, so this code is only here.
if(other.atk_isheavy){
rpg_adjust_atk_stat_block_uniformly(1.3,0)
}
//When winded, lower power of attack
if(other.atk_winded){
rpg_adjust_atk_stat_block_uniformly(0.7,0)
}
//When wielding a weapon without proper stats, power is reduced greatly.
var str, dex, int, fth;
str = db_read_stat(itemtype_WEAPON,other.atk_weapon,wd_REQUIREMENT_STR)
dex = db_read_stat(itemtype_WEAPON,other.atk_weapon,wd_REQUIREMENT_DEX)
int = db_read_stat(itemtype_WEAPON,other.atk_weapon,wd_REQUIREMENT_INT)
fth = db_read_stat(itemtype_WEAPON,other.atk_weapon,wd_REQUIREMENT_FTH)
if(!player_meets_requirements(str,dex,int,fth)){
rpg_adjust_atk_stat_block_uniformly(0.1,0)
}
}
n.lifetime = atkduration
n.blockbreaker = player_weapon_get_stat(wd_BLOCKBREAKER)
}
else if(statecntr < atkwarmup + atkduration + atkcooldown){
skelani_set_animation(atkanimation,anilen)
}
else{
state = psm_ordinary
}
//Handle animation with correct hand
player_animate_offhandswap()
//Kneel down when crouching
if(crouching){
skelani_override_crouch()
}
}