1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How do you make an attack unparry-able?

Discussion in 'Scripts' started by greatguys1, Oct 25, 2017.

  1. greatguys1

    greatguys1 Active Adventurer Developer Warriors of the North

    279
    34
    Apr 20, 2013
    Yes
    Trying to have a monster self destruct, however, sometimes the explosion is parried. It'd be silly to keep it that way.

    Also will things get all messed up if I add semicolons after stuff, like:
    setvard MYTHING 1337;

    It's a habit to add that already, but I don't want to get out of that habit.
     
  2. Kanta

    Kanta Active Adventurer

    293
    36
    Jan 24, 2013
    Level 45 Zauberei Basher
    ms_swamp
    "Magic" damage isn't parryable at all if I am correct. But I hope you don't plan on making this self destructing explosion beetle levels of strong...

    You can parry pretty much every other self destructing explosion, which seems quite fair to me.
     
  3. greatguys1

    greatguys1 Active Adventurer Developer Warriors of the North

    279
    34
    Apr 20, 2013
    Yes
    Eh, the point of it is to recognize the animation when it'll self destruct, and flee, or kill it before it does. It's not gonna insta-splode like the beetles. I'd hardly wanna do magic damage explosions though.
     
  4. Kanta

    Kanta Active Adventurer

    293
    36
    Jan 24, 2013
    Level 45 Zauberei Basher
    ms_swamp
    Yeah I suppose that's fair. It's the same for the bombers and the bloats in the mines. I don't really know anything about scripting NPC's for MS:C but when you kill one of the previously mentioned enemies it kind of looks like they (someone people correct me if I'm wrong) create another entity for the self destruct sequence? Maybe whatever does the explosion could just have a ludicrously high parry rating.
     
  5. greatguys1

    greatguys1 Active Adventurer Developer Warriors of the North

    279
    34
    Apr 20, 2013
    Yes
    It creates client side effects, sometimes tempents, and scans radius, being the explosion distance, then applies damage and force. I wrote a base for a self destruct 'cuz I couldn't find one when wanting to do the self destruct for my monster.
    Code:
    //Explosion base by greatguys1
    
    //Cutomizable vars
    // const EXPLOSION_DISTANCE [num] default: 120 "The radius of the explosion"
    // const EXPLOSION_DAMAGE [num] default: 300 "How much damage will the explosion do"
    // const EXPLOSION_DAMAGE_FALLOFF [0-1] default: 0.2 "How much less damage will do from the center; 1 will do no damage at the very edge of the radius.
    // const EXPLOSION_FORCE [num] default: 300 "How much force people caught in the radius will be pushed"
    // const EXPLOSION_TYPE [damage type] default: blunt "Which element to use when damaging enemies
    //
    // const EXPLOSION_SFX ["<effect script>"] default: "effects/sfx_explode" "Which effect script to use when doing an explosion. If set to none, it will do no effects."
    // const EXPLOSION_SFX_PARAM1 [<effect parameter>] default: EXPLOSION_DISTANCE "A parameter for the effect."
    // const EXPLOSION_SFX_PARAM2-9 [<effect parameter>] default: none "A parameter for the effect."
    
    {
        const EXPLOSION_DISTANCE 120
        const EXPLOSION_DAMAGE 300
        const EXPLOSION_DAMAGE_FALLOFF 0.2
        const EXPLOSION_FORCE 300
        const EXPLOSION_TYPE blunt
    
        const EXPLOSION_SFX "effects/sfx_explode"
        const EXPLOSION_SFX_PARAM1 EXPLOSION_DISTANCE
        const EXPLOSION_SFX_PARAM2 none
        const EXPLOSION_SFX_PARAM3 none
        const EXPLOSION_SFX_PARAM4 none
        const EXPLOSION_SFX_PARAM5 none
        const EXPLOSION_SFX_PARAM6 none
        const EXPLOSION_SFX_PARAM7 none
        const EXPLOSION_SFX_PARAM8 none
        const EXPLOSION_SFX_PARAM9 none
    
        setvard EXPLODING 0
    }
    
    { game_precache
    
        precachefile EXPLOSION_SFX
    }
    
    { do_explode
    
        setvard EXPLODING 1
    
        if ( EXPLOSION_DAMAGE != 0 )
        {
            xdodamage $get(ent_me,origin) EXPLOSION_DISTANCE EXPLOSION_DAMAGE EXPLOSION_DAMAGE_FALLOFF ent_me ent_me none EXPLOSION_TYPE//<target|(src_origin)> <range|aoe|(dest_origin)|direct> <damage> <cth|fall_off> <attacker> <inflciter> <skill|none> <dmg_type> [flag_string]
        }
    
        if ( EXPLOSION_SFX isnot none )
        {
            clientevent new all EXPLOSION_SFX $get(ent_me,origin) EXPLOSION_SFX_PARAM1 EXPLOSION_SFX_PARAM2 EXPLOSION_SFX_PARAM3 EXPLOSION_SFX_PARAM4 EXPLOSION_SFX_PARAM5 EXPLOSION_SFX_PARAM6 EXPLOSION_SFX_PARAM7 EXPLOSION_SFX_PARAM8 EXPLOSION_SFX_PARAM9
        }
    }
    
    { game_damaged_other //PARAM1 = Target hit PARAM2 = dmg
    
        if ( EXPLODING )
        {
            if ( EXPLOSION_FORCE != 0 )
            {
                local L_YAW $angles($get(ent_me,origin),$get(PARAM1,origin))
                //addvelocity PARAM2 $relvel($vec(0,L_REPEL_YAW,0),$vec(0,500,100)) //From monsters/wyrm_fire
    
                addvelocity PARAM1 $relvel($vec(0,L_YAW,0),$vec(0,EXPLOSION_FORCE,$math(divide,EXPLOSION_FORCE,1.3)))
                setvard EXPLODING 0
            }
        }
    }
    
    In the parent script, you can adjust those consts to your needs by redeclaring them, and when you call "do_explode" from the parent script, it'll create an explosion based off of what you set those consts to.
     
    Last edited: Oct 27, 2017
  6. Thothie

    Thothie Administrator Staff Member Administrator Moderator Developer

    15,079
    54
    Apr 8, 2005
    psycho-oligist
    lost
    magic, target, fire, poison, lightning, cold, and any damage type suffixed with _effect cannot be parried, though the applier maybe, in some cases. _effect and target also cannot be blocked by shields (though they can still reduce the damage). 2h swords cannot parry those or magic damage types.

    To avoid "mysterious pushing" use the dmgevent:xxx parameter on xdodamage rather than "game_damaged_other". eg:
    Code:
    xdodamage BEAM_DEST AOE_BEAM DMG_BEAM 0.01 ent_me ent_me none dark_effect dmgevent:beam
    [...]
    { beam_dodamage //<same params as game_dodamage>
        if PARAM1
        if $get(PARAM2,relationship,ent_me) equals enemy
        applyeffect PARAM2 DOT_EFFECT_SCRIPT 5.0 $get(ent_me,id) DOT_DMG
        applyeffect PARAM2 effects/effect_stun 8.0 0 1 $get(ent_me,id)
    }
    
    Ensures only the beam xdodamage causes this effect. The old methodology of setting and resetting a flag predates xdodamage and isn't reliable, as
    game_damaged_other can apply to multiple targets in the same frame.

    This is reminding me I want to have a "warning telegraph" AOE client effect that's adjustable... Sadly, there's no function to put a nice red circle on the ground that's reliable, unless the ground is perfectly flat. *might* be possible to work out with a lighting effect though.
     
  7. greatguys1

    greatguys1 Active Adventurer Developer Warriors of the North

    279
    34
    Apr 20, 2013
    Yes
    Didn't realize this was an option. I'll change that script up a bit, thanks.
     

Share This Page