The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hmm. Issues with this script
Author Message
sayter
Apprentice
*

Posts: 2
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Sep 2013
Reputation: 0



Post: #1
Hmm. Issues with this script
Hey all. I took a break a long time ago from scripting and the like.

Long story short, I broke a script and could not determine what was going on.

It worked fine, but something got screwed along the way.

It's using an older combat system, and the gist of it is this: Doing/taking damage does not seem to function properly anymore.

Im curious if anyones eyes can pick up what the error might be.

Im unsure if its @gethit, or @hit, or tied to the defense functions.

ENTIRE script is below, to make it easier in a way. Nothing will be omitted this way. Apologies for the length.

Hopefully someone can figure it out... I've run out of ideas. Damage "can" be done, but almost never. I've had a character fighting an Ogre with 100 wrestling and anatomy for about 2 hours. He's still alive.Down 80 hp, but alive. Should have taken seconds, as he is naked and unarmed with 0 wrestling.

It uses a script someone else designed, but is heavily modified.

also unsure of who's original script this is. It's heavily modified though




Code:
//**************************************************************************
//SPHERE by : Menasoft ©1997-2004
//www.sphereserver.com
// All SPHERE script files and formats are copyright Menasoft & Partners.
// This file may be freely edited for personal use, but may not be distributed
// in whole or in part, in any format without express written permission from
// Menasoft & Partners.  All donations and contributions
// become the property of Menasoft & Partners.
//****************************************************************************
// FILE LAST UPDATED: Friday, August 18, 2006
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Basic AoS-Style Combat System,
//according to informations found on stratics (http://uo.stratics.com/content/arms-armor/combat.php)
//Featuring some OSI magic items' properties, Damage types and Resistances:
//
//Magic Item properties:
//To set them you only have to set the relevant tag, you can set them indifferently on weapon or on character
//Swing Speed Increase (tag.SwingSpeedIncrease): % increase attack speed
//Hit Chance Increase (tag.HitChanceIncrease): % increase hit chance
//hithcance decrease (tag.hitchancedecreat): % lower hit chance
//Defense Chance Increase (tag.DefenseChanceIncrease) note: this can be set both on shields and weapons: % decrease attacker's hit chance
//Damage Increase (tag.DamageIncrease): % increase damage
//Damage Decrease (tag.DamageDecrease): % lower damage

//added by me
//Life Leech = LIFELEECH
//Mana Leech = MANALEECH
//Stam Leech = STAMLEECH
//Dispel = TAG.HITDISPEL=1
//Fireball = TAG.HITFIREBALL=<R2,40>
//Harm = TAG.HITHARM=<R2,40>
//Lightning = TAG.HITLIGHTNING=<R2,40>
//Magic Arrow = TAG.MAGICARROW=<R2,40>

//All the others AOS property can be easily scripted as separate events, using the new triggers included in this system.
//


//New triggers:
//@Parry (shields/weapons): fires whenever the item is used to succesfully parry a blow. Setting VAR.RETURN 1 will nullify the parry. (SRC=the attacker, CONT=the player who parried, default object=the item)
//@DamageCalc (weapons and chars): fires after the damage and damage type calculation, but before any reduction. VAR.ARGN1 is the damage. Note that herein you can modify the damage type converters, accessing SRC.TAG.TEMP_xDAMAGE, where x can be one of the five damage types (PHYSICAL, FIRE, COLD, ENERGY, POISON). (SRC=the attacked, default object=the attacker or the weapon with this trigger)
//@DamageAbsorb (chars): fires after the damage absorption. VAR.ARGN1 is the damage, setting it to 0 will nullify the attack (SRC=the attacker, default=the attacked)
//For example, one could use @DamageCalc on a weapon to script the "Hit Life Leech" property using something like this:
//[TYPEDEF e_hit_life_leech]
//ON=@DamageCalc
//IF (RAND(100)<<TAG0.HIT_LIFE_LEECH>)
//    CONT.HITS += <EVAL (<VAR.ARGN1>*30)/100>
//ENDIF
//
//Damage types:
//These can be set on chars and/or on weapons (if char has a weapon equipped it uses weapon's dam types, otherwise it uses char's):
//TAG.PhysicalDamage
//TAG.FireDamage
//TAG.ColdDamage
//TAG.PoisonDamage
//TAG.EnergyDamage
//Their sum should be 100, but they work fine also if their sum is greater or lower, in which case the char would deal more or less damage.
//
//Resistances:
//These must be set on chars. Every piece of armor should add its resistance to the char's total
//MODAR (that is physical resistance, since we don't have resphysical... don't care about it, since the old AR is not used in this system)
//RESFIRE
//RESCOLD
//RESPOISON
//RESENERGY
//Each resistance is capped at 70. You can easily modify this cap inside the f_cs_damageabsorption function
//
//NOTE: damage calculations are balanced for shards with aos weapon damage, if you use this combat system without editing standard sphere weapons damage expect very high damage.
//
//KNOWN ISSUES:
// - weapons and armors don't get damaged
// - poison doesn't get applied (but it's good this way, since in AoS you have to use the Infectious strike ability to poison a target)
/////////////////////////////////////////////////////////////////////////
//Support functions

[FUNCTION min]
RETURN <QVAL <ARGN1> < <ARGN2>? <ARGN1> : <ARGN2>>

[FUNCTION max]
RETURN <QVAL <ARGN2> < <ARGN1>? <ARGN1> : <ARGN2>>

[FUNCTION percent]
RETURN <EVAL (<ARGN1>*<ARGN2>)/100>

[FUNCTION IsWeapon]
IF ((<LAYER>==1) || (<LAYER>==2)) && (<DAM>)
    RETURN 1
ENDIF
RETURN 0


/////////////////////////////////////////////////////////////////////////
//AosDamage function
//With this function you can easily make it so spells and other effects use the resistance system
//Usage: AOSDAMAGE <DAM> <PHYS> <FIRE> <COLD> <POIS> <ENER> <SOURCE>
//dam=the raw damage to deal, phys/fire/cold/pois/ener=the percent of this kind of damage to deal, source=the source of the damage (defaults to src)
//Example: AOSDAMAGE 100 25 0 25 40 10 <SRC.UID> (this would deal 25% physical, 25% cold, 40% poison and 10% energy damage)
//If you want to deal 100% dam of a type, you can more simply do:
//AOSDAMAGE <DAM> <DAMTYPE> <SOURCE>
//where damtype is the physical / fire / cold / poison / energy (they are defname, as you can see below)
//Example: AOSDAMAGE 50 fire <SRC.UID> (this would deal 100% fire damage)
//If you don't specify a dam type, the damage won't be reduced
//Note: this functions isn't used in the combat system

[DEFNAME aos_damtypes]
physical    0efff0000
fire        0efff0001
cold        0efff0002
poison    0efff0003
energy    0efff0004

[FUNCTION AOSDamage]
LOCAL.DAM=<STRARG <ARGS>>
ARGS=<STREAT <ARGS>>
LOCAL.PHYSICAL=<STRARG <ARGS>>
IF (<LOCAL.PHYSICAL>&0efff0000)
    DOSWITCH (<LOCAL.PHYSICAL>&~0efff0000)
    TAG.TEMP_PHYSICALDAM=100
    TAG.TEMP_FIREDAM=100
    TAG.TEMP_COLDDAM=100
    TAG.TEMP_POISONDAM=100
    TAG.TEMP_ENERGYDAM=100
    ENDDO
    ARGS=<STREAT <ARGS>>
    LOCAL.SOURCE=<STRARG <ARGS>>
    DAMAGE <LOCAL.DAM> 0 <LOCAL.SOURCE>
ELSE
    TAG.TEMP_PHYSICALDAM=<LOCAL.PHYSICAL>
    ARGS=<STREAT <ARGS>>
    TAG.TEMP_FIREDAM=<STRARG <ARGS>>
    ARGS=<STREAT <ARGS>>
    TAG.TEMP_COLDDAM=<STRARG <ARGS>>
    ARGS=<STREAT <ARGS>>
    TAG.TEMP_POISONDAM=<STRARG <ARGS>>
    ARGS=<STREAT <ARGS>>
    TAG.TEMP_ENERGYDAM=<STRARG <ARGS>>
    ARGS=<STREAT <ARGS>>
    LOCAL.SOURCE=<STRARG <ARGS>>
    DAMAGE <LOCAL.DAM> 0 <LOCAL.SOURCE>
ENDIF

/////////////////////////////////////////////////////////////////////////
//Combat System functions

[FUNCTION f_cs_attackspeed]
OBJ=<ARGN1>
IF (<ACTION>!=skill_wrestling) && (<OBJ.SPEED>)
    LOCAL.SPEED=<EVAL (((70000/((<dex>+100)*<OBJ.SPEED>))/4)*50)-5>
ELSE
    //LOCAL.SPEED=<EVAL (((80000/((<dex>+100)*50))/4)*10)-5> ************ORIGINAL CODE  --> new variables slightly different
    LOCAL.SPEED=<eval (((80000/((<dex>+100)*50))/4)*10)-5> //perhaps try Dex instead of Stam?
ENDIF
LOCAL.SwingSpeedIncrease=<OBJ.TAG0.SwingSpeedIncrease>+<TAG0.SwingSpeedIncrease>
IF (<LOCAL.SwingSpeedIncrease>)
    LOCAL.SPEED -= <Percent <LOCAL.SwingSpeedIncrease>, <LOCAL.SPEED>>
ENDIF
//attack speed is capped at 1.0 sec originally. ive edited it to 0.4 to see what happens
RETURN <Max <LOCAL.SPEED>,0.4>


[FUNCTION f_cs_chancetohit]
LOCAL.ATKSKILL=<I.<SERV.SKILL.<ACTION>.KEY>>
IF (<SRC.ACTION>==skill_swordsmanship) || (<SRC.ACTION>==skill_macefighting) || (<SRC.ACTION>==skill_fencing)
    LOCAL.DEFSKILL=<SRC.<SERV.SKILL.<SRC.ACTION>.KEY>>
ELSE
    LOCAL.DEFSKILL=<SRC.WRESTLING>
ENDIF
OBJ=<ARGN1>
//both hit and def increase are capped at 100%
LOCAL.HitChanceIncrease=<OBJ.TAG0.HitChanceIncrease>+<TAG0.HitChanceIncrease>+-<tag0.hitchancedecrease>+-<obj.tag0.hitchancedecrease>
LOCAL.ATK=<EVAL (<LOCAL.ATKSKILL>+200)*(100+<Min <LOCAL.HitChanceIncrease>,100>)>
LOCAL.DefenseChanceIncrease=<SRC.FINDLAYER.1.TAG0.DefenseChanceIncrease>+<SRC.FINDLAYER.2.TAG0.DefenseChanceIncrease>+<SRC.TAG0.DefenseChanceIncrease>+-<SRC.FINDLAYER.2.TAG0.DefenseChanceDecrease>
LOCAL.DEF=<EVAL (<LOCAL.DEFSKILL>+200)*((100+<Min <LOCAL.DefenseChanceIncrease>,100>)*2)>
LOCAL.CHANCE=<Max <EVAL (<LOCAL.ATK>*1000)/<LOCAL.DEF>>,2.0>
SKILLGAIN <SERV.SKILL.<ACTION>.KEY> 1
IF (RAND(1000)<<LOCAL.CHANCE>)
    RETURN 0
ELSE
    RETURN -10
ENDIF

[FUNCTION f_cs_chancetoblock]

//***********************************************************
//STandard Shield Parry Chance
//***********************************************************
IF (<FINDLAYER.2.TYPE>==t_shield)
    LOCAL.CHANCE=<Max <EVAL (<PARRYING>-<constitution>)/4>,2.0>
ELSE

//***********************************************************
//One Handed Weapon Parry Chance
//***********************************************************
IF (<FINDLAYER.1.ISWEAPON>) //one handed
LOCAL.NEW=(<PARRYING>*<constitution>)/48000

//***********************************************************
//2-handed Weapon Parry Chance
//***********************************************************
ELSEIF (<FINDLAYER.2.ISWEAPON>) //2 handed
LOCAL.NEW=(<PARRYING>*<constitution>)/41140

//***********************************************************
//Unarmed Parry Chance
//***********************************************************
else
  if (<eval <tag0.martialartist>>==1)  //***Are they a martial artist? If so, give bonus
  local.new=(<parrying>*<wrestling>)/48000    
  else
  local.new=0   //(<parrying>*100>)/48000  //general unarmed parry chance is essentially 0.    
  endif
ENDIF

//***********************************************************
//GM Skill gives them a higher chance to parry, in general
//***********************************************************
IF (<PARRYING>>=100.0) //|| (<constitution>>=100.0)
LOCAL.NEW += 5.0
ENDIF

LOCAL.LEGACY=<EVAL <PARRYING>/80>

//***********************************************************
//High skill gives bonuses to parry chance
//***********************************************************
IF (<PARRYING>>=100.0)
LOCAL.LEGACY += 5.0
ENDIF

LOCAL.CHANCE +=<Max <LOCAL.NEW>, <LOCAL.LEGACY>>   //***now we compute the overall chance, here
ENDIF

//***********************************************************
//High dex gives bonuses. Low dex imparts a penalty to parry.
//***********************************************************
IF (<DEX><80)  
LOCAL.DEXMOD=80-<DEX>
LOCAL.CHANCE -= (<LOCAL.CHANCE>*<LOCAL.DEXMOD>)/100
ENDIF

//***********************************************************
//Hunter Dancing Spear Technique
//***********************************************************
if (<findlayer.2.baseid>==i_spear) || (<findlayer.2.baseid>==i_spear_short) || (<findlayer.2.baseid>==i_pike) || (<findlayer.2.baseid>==i_staff_bladed) && (<eval <tag.talent_dancingspeartechnique>> >=1)
LOCAL.new=(<survival>*<awareness>)/48000  
endif
  
//***********************************************************
//Hunter Bow Parry
//***********************************************************
if !(<eval <tag0.hunter>>==1) //if player is NOT primary profession "Hunter", they cannot parry with bows
  IF (<findlayer.1.type>==t_weapon_xbow) || (<findlayer.1.type>==t_weapon_bow) || (<findlayer.2.type>==t_weapon_xbow) || (<findlayer.2.type>==t_weapon_bow)
  LOCAL.CHANCE=0
  ENDIF
endif

RETURN <LOCAL.CHANCE>


[FUNCTION f_cs_calculatedamage]
OBJ=<ARGN1>
LOCAL.TACTICS=<EVAL <TACTICS>/16>
IF (<TACTICS>>=100.0)
    LOCAL.TACTICS += 6
ENDIF
LOCAL.ANATOMY=<EVAL (<ANATOMY>/2.0)+5>
SKILLGAIN anatomy 10
IF (<OBJ.TYPE>==t_weapon_axe)
    LOCAL.LUMBERJACKING=<EVAL <LUMBERJACKING>/5.0>
    IF (<LUMBERJACKING>>=100.0)
        LOCAL.LUMBERJACKING += 10
    ENDIF
ENDIF
LOCAL.STR=<EVAL (<STR>*3)/10>
IF (<STR>>=100)
    LOCAL.STR += 5
ENDIF

IF (<ARGN1>)//is the target using a weapon?
    LOCAL.DAMAGE=<EVAL RAND(<OBJ.DAM>)>
    //***************************
    // MARTIAL ARTS WEAPONS
    //***************************
    if !(<npc>)
      if (<tag0.martialartsbonus>)
        if (<eval <obj.tag.mabonus>>==1)
          local.damage=<local.damage>+<eval <tag0.martialartsbonus>>
            endif
      endif
    endif
    //***************************
    // SPECIALIZATION
    //***************************
    if (<tag0.specialize_swords>)
    local.damage=<local.damage>+<eval <tag0.swordbonus>>
    endif
    if (<tag0.specialize_fencing>)
    local.damage=<local.damage>+<eval <tag0.fencingbonus>>
    endif
    if (<tag0.specialize_maces>)
    local.damage=<local.damage>+<eval <tag0.macebonus>>
    endif
    if (<tag0.specialize_axes>)
    local.damage=<local.damage>+<eval <tag0.axebonus>>
    endif
    if (<tag0.specialize_bows>)
    local.damage=<local.damage>+<eval <tag0.bowbonus>>
    endif
    if (<tag0.specialize_xbows>)
    local.damage=<local.damage>+<eval <tag0.xbowbonus>>
    endif
    if (<tag0.specialize_knives>)
    local.damage=<local.damage>+<eval <tag0.knivesbonus>>
    endif
    if (<tag0.specialize_staves>)
    local.damage=<local.damage>+<eval <tag0.stavesbonus>>
    endif
    

    //**************************
    //CRITICAL STRIKE
    //**************************
    LOCAL.CRITICALDAMAGEPOWER=<eval <str>/4>
    IF (<eval <tactics>*<anatomy>/60000>) > (<R100> +- <eval <tag0.criticalstrike>>)
    local.critamount=<eval <local.damage>+<eval <local.damage>/2> + <eval <r10>>>
    local.damage=<local.damage>+<eval <local.critamount>>
    sysmessage @098 You inflict <eval <local.critamount>> extra damage from a critical strike!
    sfx 0525
    healmorale 3
    if (<eval <tag0.morale>> > <eval <tag0.maxmorale>>)
    tag0.morale=tag0.maxmorale
        endif
        
        //**************************
    //SPECIAL ATTACKS/TALENTS
    //**************************
        if !<ISEMPTY <tag.special>>  //this only fires if the power is activated. when it runs, it deactives, so it must be
        CALL <tag.special>_attack
        endif
        
ELSE
    IF (<DAM>)//or is it an NPC attacking>?
    LOCAL.DAMAGE=<EVAL RAND(<DAM>)>
    LOCAL.WRESTLINGBONUS=<Eval <wrestling>/200>
    IF (<wrestling>>=100.0)
    LOCAL.wrestling += 10
    ENDIF
    ELSE //or are we fighting with wrestling?
    LOCAL.WRESTLINGBONUS=<Eval <wrestling>/200>
    IF (<wrestling>>=100.0)
    LOCAL.wrestling += 10
    ENDIF
        //*******************************
    // MARTIAL ARTS (UNARMED) DAMAGE
    //*******************************
    LOCAL.DAMAGE=<EVAL RAND(1,4)>+<eval <tag0.martialartsbonus>>+<eval <tag0.wildshapeclawbonus>>+<eval <local.wrestlingbonus>/2>//add martial arts bonus to damage, so wrestling doesnt suck ass.
    //**************************
    //CRITICAL STRIKE
    //**************************
    LOCAL.CRITICALDAMAGEPOWER=<eval <str>/4>
    IF (<eval <tactics>*<anatomy>/60000>) > (<R100> +- <eval <tag0.criticalstrike>>)
    local.damage=<local.damage>+<local.damage>/2 + <r10> + <local.wrestlingbonus>//<local.criticaldamagepower>
    sysmessage @098 You do <eval <local.damage>+<local.criticaldamagepower>> from a critical strike!
    sfx 0525
    healmorale 1
        endif    
    ENDIF    
        //**************************
    //SPECIAL ATTACK
    //**************************    
    if !<ISEMPTY <tag.special>>  //this only fires if the power is activated. when it runs, it deactives, so it must be
    CALL <tag.special>_attack
    endif

ENDIF

//tag.damageincrease is capped at 200%
LOCAL.DamageIncrease=<Min <EVAL <OBJ.TAG0.DamageIncrease>+<TAG0.DamageIncrease>>,200>
LOCAL.DamageDecrease=<Min <EVAL <OBJ.TAG0.DamageDecrease>+-<TAG0.DamageDecrease>>,200>
LOCAL.BONUSDAMAGE=<EVAL (<local.spearbonus>+<LOCAL.TACTICS>+<LOCAL.ANATOMY>+<LOCAL.LUMBERJACKING>+<LOCAL.STR>+<LOCAL.HORSEPOWER>+<LOCAL.DamageIncrease>+-<LOCAL.Damagedecrease>)>
LOCAL.DAMAGE += <Percent <LOCAL.BONUSDAMAGE>, <LOCAL.DAMAGE>>
LOCAL.DAMAGE +=<obj.tag0.keenedge>//keenedge is magic prop for dmg + on weapon, added on every attack with it
local.damage -=<local.spc>  // Thunderclap Strike damage reduction
if (<tactics> < 1000) && !(<r6>)
SKILLGAIN tactics 1
endif
if (<anatomy> < 1000)
  if !(<r4>)
  SKILLGAIN anatomy 1
  endif
endif

RETURN <LOCAL.DAMAGE>




[FUNCTION f_cs_damageabsorption]
IF (<TAG0.TEMP_PHYSICALDAM>)//apply CON damage soak bonus, but only for PHYSICAL damage
    LOCAL.DAM  += <EVAL (<ARGN1>*<TAG0.TEMP_PHYSICALDAM>*(<Max <EVAL 100-<MODAR>>,10>))/10000>
ENDIF
IF (<TAG0.TEMP_FIREDAM>)
    LOCAL.DAM += <EVAL (<ARGN1>*<TAG0.TEMP_FIREDAM>*(<Max <EVAL 100-<RESFIRE>>,10>))/10000>
ENDIF
IF (<TAG0.TEMP_COLDDAM>)
    LOCAL.DAM += <EVAL (<ARGN1>*<TAG0.TEMP_COLDDAM>*(<Max <EVAL 100-<RESCOLD>>,10>))/10000>
ENDIF
IF (<TAG0.TEMP_POISONDAM>)
    LOCAL.DAM += <EVAL (<ARGN1>*<TAG0.TEMP_POISONDAM>*(<Max <EVAL 100-<RESPOISON>>,10>))/10000>
ENDIF
IF (<TAG0.TEMP_ENERGYDAM>)
    LOCAL.DAM += <EVAL (<ARGN1>*<TAG0.TEMP_ENERGYDAM>*(<Max <EVAL 100-<RESENERGY>>,10>))/10000>
ENDIF

RETURN <LOCAL.DAM>


//ROL SPECIALS (COMBAT FUNCTIONS)
[FUNCTION f_fear]
if (<eval <src.tag0.morale>> < 1)
  if !(<src.restest 1 i_fear_timer>)
  serv.newitem i_fear_timer
  new.more1=<eval <str>+20>//duration
  new.more2=<eval <tag0.fear>*4>//effect
  new.equip <uid>
  endif
else
src.tag.morale=<eval <eval <src.tag0.morale>>+-<eval <tag0.fear>>>
endif
if (<eval <tag0.fear>> >=1)
src.sysmessage @033 <eval <src.tag0.morale>> / <eval <src.tag0.maxmorale>> morale
endif

[ITEMDEF i_fear_timer]
NAME=fear timer
ID=01d8c
TYPE=t_eq_script
LAYER=30
WEIGHT=0
ON=@CREATE
  ATTR=04002
ON=@EQUIP
  ATTR=04002
  CONT.sysmessage @025,3,1 you are gripped by fear!!!
  CONT.tag.hitchanceincrease=<Eval <cont.tag0.hitchanceincrease>>-<more2>
  cont.tag.defensechanceincrease=<Eval <cont.tag0.defensechanceincrease>>-<more2>
  TIMER=<more1>
  
ON=@TIMER
     CONT.SYSMESSAGE @025,3,1  You are no longer afraid of your foe.
     cont.tag.morale=<eval <cont.tag0.maxmorale>>/4
     cont.sysmessage @033 You regain 25% of your morale.
     CONT.tag.hitchanceincrease=<Eval <cont.tag0.hitchanceincrease>>+<more2>
     cont.tag.defensechanceincrease=<Eval <cont.tag0.defensechanceincrease>>+<more2>
     REMOVE





[FUNCTION f_counterstrike]
if (<distance> < 2)
IF (<src.tactics> > 500)
  IF (<eval <src.tactics>*<src.awareness>/80000>) > (<R400> +- <eval <src.tag0.counterstrike>> +- <eval <src.luck>/100>)
  damage  <eval <eval <src.dex>/10>+<r1,6>+<Eval <src.tag0.talent_cheapshot>>> <def0.physical> <src.uid>
  src.sysmessage @098 You counter attack for <Eval <eval <src.tag0.counterstrike>> + <eval <src.dex>/10>> damage.
  src.sfx 051e
  endif
endif
endif



[FUNCTION f_furioushammer]
local.hitpain=<eval <src.tag0.talent_furioushammer>>
IF (<src.ACTION>==skill_wrestling) && (<eval <src.tag.talent_furioushammer>> >=1) && (<stamina> >=10)
  IF (<eval <src.dex>/10> * <eval <src.wrestling>/10> /100) > (<R170> +- <eval <src.tag0.talent_furioushammer>> +- <eval <src.luck>/100>)
  stamina -=10
  src.moveback <local.hitpain>
  src.sysmessage @025,3,1 You have been stunned by a powerful blow.
  src.sound 0144
  serv.newitem i_parablow_timer
  new.equip <src.uid>
  forchars 1
  if !(<uid>==<obj.uid>) || (<FLAGS>==<FLAGS>&02000000) || (<KILLS>>5)
  damage <r1,8>,<def0.physical>,<obj.uid>
  effect 3,i_Fx_smoke,15,15,15,0,0
  endif
  endfor
  endif
endif

[FUNCTION f_ragingbull]
IF (<eval <src.tag.talent_ragingbull>> >=1) && (<stamina> >=15) && !(<restest 1 i_mem_ragingbull>)
local.hitpain=<eval <src.tag0.talent_ragingbull>>
  IF (<eval <src.dex>/10> * <eval <src.wrestling>/10> /100) > (<R170> +- <eval <src.tag0.talent_tigerclaw>> +- <eval <src.luck>/100>)
  stamina -=15
  newitem i_mem_ragingbull
  new.equip
  src.sysmessage @098 You take a hit, and swiftly step into Raging Bull Style.
  src.sfx 051c
  return 0
  endif
else
return 0
endif

[FUNCTION f_tigerclaw]
local.hitpain=<eval <src.tag0.talent_tigerclaw>+<eval <src.str>/40>>
IF (<src.ACTION>==skill_wrestling) && (<eval <src.tag.talent_tigerclaw>> >=1) && (<stamina> >=5)
  IF (<eval <src.dex>/10> * <eval <src.wrestling>/10> /100) > (<R170> +- <eval <src.tag0.talent_tigerclaw>> +- <eval <src.luck>/100>)
  src.stamina -= <eval <local.hitpain>>
  stamina -=5
  src.sysmessage @098 You strike with a tigerclaw for <eval <local.hitpain>> stamina damage.
  src.sfx 051c
  endif
endif

[FUNCTION f_razorfang]
if (<eval <src.tag0.talent_razorfang>> ==1)
local.hitpain=<r1,3>
endif
if (<eval <src.tag0.talent_razorfang>> ==2)
local.hitpain=<r1,4>
endif
if (<eval <src.tag0.talent_razorfang>> ==3)
local.hitpain=<r1,6>
endif
if (<eval <src.tag0.talent_razorfang>> ==4)
local.hitpain=<r1,8>
endif
if (<eval <src.tag0.talent_razorfang>> ==5)
local.hitpain=<r1,10>
endif
if (<eval <src.tag0.talent_razorfang>> ==6)
local.hitpain=<r1,12>
endif
if (<eval <src.tag0.talent_razorfang>> ==7)
local.hitpain=<r1,20>
endif
IF (<src.ACTION>==skill_wrestling) && (<eval <src.tag.talent_razorfang>> >=1)
  IF (<eval <src.dex>/10> * <eval <src.wildshaping>/10> /100) > (<R170> +- <eval <src.tag0.talent_razorfang>> +- <eval <src.luck>/100>)
  damage <local.hitpain> <def0.physical> <src.uid>
  src.sysmessage @098 You strike with a bite for <eval <local.hitpain>> damage.
  src.sfx 051c
  endif
endif


[FUNCTION f_shieldbash]
local.hitpain=<eval <src.tag0.shieldbash>+<eval <src.str>/40>>
IF (<SRC.FINDLAYER.2.TYPE>==t_shield)
IF (<src.parrying> > 450) && (<src.tactics> > 450) && (<src.awareness> >250)
  IF (<eval <src.str>/10> * <eval <src.parrying>/10> /100) > (<R170> +- <eval <src.tag0.shieldbash>> +- <eval <src.luck>/100>)
  damage <local.hitpain> <def0.physical> <src.uid>
  src.sysmessage @098 You bash with your shield for <eval <local.hitpain>> damage.
  src.sfx 051c
  endif
endif
endif


[FUNCTION f_dodging]
IF (<eval <dex>/10> * <eval <awareness>/10> /100) > (<R400> +- <eval <tag0.dodge>> +- <eval <luck>/100>)
sysmessage @098 You dodge the attack!
DORAND 3
sfx 0512
sfx 1317
sfx 1298
ENDDO
if (<eval <tag0.troubador>>) // Troubador Profession talent
hits=<hits>+<r1,6>
endif
f_riposte
return 1
endif


[FUNCTION f_riposte]
if (<distance> < 2) && (<eval <src.tag.talent_riposte>> >=1)
IF (<src.fencing> > 500)
  IF (<eval <src.fencing>*<src.awareness>/80000>) > (<R400> +- <eval <src.tag0.talent_riposte>> +- <eval <src.luck>/100>)
  damage  <eval <src.tag.talent_riposte>+<r1,3>> <def0.physical> <src.uid>
  src.sysmessage @098 You riposte for <Eval <eval <src.tag0.counterstrike>> + <eval <src.dex>/10>> damage.
  src.sfx 051e
  endif
endif
endif


/////////////////////////////////////////////////////////////////////////
//***********************************************************************
//Combat System main event - apply this to players & monsters

[EVENTS e_aos_cs]
//NPC casting Wall of Stone
ON=@SPELLCAST
if <npc>
IF (<SERV.SPELL.<ARGN1>.FLAGS> & spellflag_field)
ACTP=<SRC.P>
ENDIF
RETURN 0
endif

on=@death
FORCHARMEMORYTYPE MEMORY_FIGHT
color |= <def0.memory_harmedby>
ENDFOR

ON=@SKILLSTART //This allows regular update of true stat values. hp, etc.
IF <NPC>==0
    UPDATESTATS_NEW
ENDIF

ON=@USERSTATS  //This allows regular update of true stat values. hp, etc.  
IF <NPC>==0
IF <VAR0.U_STATS>!=1
    UPDATESTATS_NEW
ENDIF
ENDIF

on=@ITEMCLIENTTOOLTIP   //This is required for the main tooltip functions
VAR.TOOLTIP=
OBJ=<ARGO.UID>
OBJ.TRIGGER @Tooltip
IF !<ISEMPTY <VAR.TOOLTIP>>
addcliloc 1042971,<VAR.TOOLTIP>
ENDIF
VAR.TOOLTIP=


//***************SPECIAL***************************
//*** Fired when a character MISSES an attack
on=@hitmiss
//remove special attack
//tag.special=
//*
if !(<r4>)
  IF (<stamina>) > 1
  stamina -= 1
  ENDIF
endif


//* Here we apply stamina penalties, etc.
//*************************************************


ON=@hittry  
if (<src.stamina>) < 0   //make sure we dont have below 0 stamina
  src.stamina=0
endif

if (<src.mana>) < 0   //make sure we dont have below 0 stamina
  src.mana=0
endif

if !(<src.tag0.morale>)
  src.tag.morale=0
endif

if (<eval <src.tag0.morale>> < 0) //make sure morale isnt at negative values
  src.tag0.morale=0
endif

//***** attack speed
ARGN1=<f_cs_attackspeed <ARGO.UID>>
ACTDIFF=<f_cs_chancetohit <ARGO.UID>>


ON=@HIT
healmorale 1

if (<eval <tag0.resting>>==1)
  rest
  tag0.override.regenval_2 =<eval <tag.override.regenval_2>> -2
  sysmessage @044 You leave your resting state.
  tag.resting=
endif

//************ Hunter Talent - Savage Might
if (<eval <tag.talent_savagemight>> >=1)
  if (<findlayer.1.baseid>=i_spear) || (<findlayer.1.baseid>==i_bow) || (<findlayer.2.baseid>=i_spear) || (<findlayer.2.baseid>==i_bow)
  local.spearbonus=<r1,3>+<eval <tag.talent_savagemight>>
  //sysmessage @044 Savage Might Bonus Damage = <eval <local.spearbonus>>
  endif
endif
//************

//***MORALE BOOST
if !(<r5>)
  healmorale 1
endif
//***************

//*****PARRYING *********
// check for weapon or shield to parry attack
local.bigval=<eval <SRC.f_cs_chancetoblock>+<r10,300>>
local.smallval=<r1200>

//***BOWS can't parry unless you have the correct talent.
IF (<src.findlayer.1.type>==t_weapon_xbow) || (<src.findlayer.1.type>==t_weapon_bow) || (<src.findlayer.2.type>==t_weapon_xbow) || (<src.findlayer.2.type>==t_weapon_bow)
  if !(<eval <src.tag.hunter>>)
    return 1
  endif
  if !(<src.findlayer.1.baseid>==i_throwing_dagger) || !(<src.findlayer.1.baseid>==i_throwing_dagger_shadow) || !(<src.findlayer.1.baseid>==i_throwing_axe) && !(<eval <src.tag.talent_shadowwarrior>>)
    return 1
  endif
elseif (<SRC.FINDLAYER.1>) || (<SRC.FINDLAYER.2>)
  IF (<local.bigval> > <local.smallval>)
    IF (<SRC.FINDLAYER.2.TYPE>==t_shield) || (<SRC.FINDLAYER.2.ISWEAPON>)
      SRC.TRYSRC <UID> FINDLAYER.2.TRIGGER=@Parry
    ELSEIF (<SRC.FINDLAYER.1.ISWEAPON>)
      SRC.TRYSRC <UID> FINDLAYER.1.TRIGGER=@Parry
    ENDIF
    IF !(<VAR0.RETURN>) //this can be set inside the @Parry trigger
    SRC.SYSMESSAGE @092 You parry the blow.
    src.SKILLGAIN parrying 10
    DORAND 6
    SRC.SOUND 0146
    SRC.SOUND 0142
    SRC.SOUND 0520
    SRC.SOUND 05bd
    SRC.SOUND 052f
    SRC.SOUND 056
    ENDDO    
    SRC.ANIM 30
    healmorale {1,3}
    SKILLGAIN tactics 10
      if (<eval <src.tag0.talent_dancingspeartechnique>>==1) //Hunter bonus parry damage
        aosdamage <eval <src.tag0.talent_dancingspeartechnique>> <def0.physical> <src.uid>
      endif
    return 1
    debug
     ENDIF
  ENDIF
ENDIF
IF (<SRC.FINDLAYER.2.baseid>==i_spear) || (<SRC.FINDLAYER.2.baseid>==i_pike) || (<SRC.FINDLAYER.1.baseid>==i_spear) || (<SRC.FINDLAYER.1.baseid>==i_pike) && (<eval <src.tag0.hunter>>==1)
  src.skillgain survival 10
endif


//***CALCULATE DAMAGE
ARGN1=<f_cs_calculatedamage <ARGO.UID>>
VAR.ARGN1=<ARGN1>    //this is passed to trigger calls

//******************************
// Begin RoL specials     These fire automatically, based on player abilities or circumstances
//******************************
f_counterstrike //anyone, but primarily warrior
f_shieldbash //warrior
f_tigerclaw //martial artist
f_furioushammer//martialartist
f_razorfang //wildshaper
f_fear //all characters

if (<awareness> < 1000) && !(<r6>)
skillgain awareness 10
endif

//*******************************************************************
IF (<ARGO.UID>)//use dam types from weapons or from char?
    SRC.TAG.TEMP_PHYSICALDAM=<ARGO.TAG0.PhysicalDamage>
    SRC.TAG.TEMP_FIREDAM=<ARGO.TAG0.FireDamage>
    SRC.TAG.TEMP_COLDDAM=<ARGO.TAG0.ColdDamage>
    SRC.TAG.TEMP_POISONDAM=<ARGO.TAG0.PoisonDamage>
    SRC.TAG.TEMP_ENERGYDAM=<ARGO.TAG0.EnergyDamage>
    TRY UID.<ARGO.UID>.TRIGGER=@DamageCalc            //src = attacked, [] = weapon, cont = attacker
ELSE
    SRC.TAG.TEMP_PHYSICALDAM=<TAG0.PhysicalDamage>
    SRC.TAG.TEMP_FIREDAM=<TAG0.FireDamage>
    SRC.TAG.TEMP_COLDDAM=<TAG0.ColdDamage>
    SRC.TAG.TEMP_POISONDAM=<TAG0.PoisonDamage>
    SRC.TAG.TEMP_ENERGYDAM=<TAG0.EnergyDamage>
ENDIF

TRIGGER=@DamageCalc            //src = attacked, [] = attacker
ARGN1=<VAR.ARGN1> +- <eval <src.tag0.spelldamagereduction>>//Reduced dmg from spells
//********************************************************************************​*****
if (<eval <src.tag0.spelldamagereduction>>)
  src.sysmessage You blocked <eval <src.tag0.spelldamagereduction>> damage from the hit.
endif


SKILLGAIN anatomy 10


//*********************HP/STAM/MANA LEECH
IF (RAND(100)<<TAG0.LIFELEECH>)
  if (<hits> < <maxhits>)
    HITS += <EVAL (<VAR.ARGN1>*30)/100>
    hpvamp
  endif
ENDIF
IF (RAND(100)<<TAG0.STAMLEECH>)
  if (<stam> < <maxstam>)
    STAM += <EVAL (<VAR.ARGN1>*30)/100>
    stamvamp
  endif
ENDIF
IF (RAND(100)<<TAG0.MANALEECH>)
  if (<mana> < <maxmana>)
    MANA += <EVAL (<VAR.ARGN1>*30)/100>
    manavamp
  endif
ENDIF


ON=@GETHIT
f_ragingbull
if (<eval <tag0.resting>>==1)
  rest
  tag0.override.regenval_2 =<eval <tag.override.regenval_2>> -2
  tag.resting=
  sysmessage @044 You leave your resting state.
endif

//********************************warrior damage mitigation
IF (<eval <TAG0.warrior>> >=1)
  argn1 =<eval <argn1> - <eval <constitution>/120>>  //max of 8ish if they get to 100%. 120 is 10.
endif

//****************************************MAGIC BARRIER
if (<eval <tag0.barrierhp>> >=1) && !(<eval <src.tag0.barrierbreak>>)//can character or attack ignore barrier? if not, the barrier protects completely.
  TAG.BARRIERHP=<eval <tag0.barrierhp> +-<ARGN1>>
    if (<eval <tag0.barrierhp>> <=0)
      SYSMESSAGE @012,3,1 Your magic barrier was destroyed.
    endif
  EFFECT=3,i_reflect_dmg,6,15,1 // Sparkle effect
  argn1=0
  sfx 1469
  return 0
endif
    
    
//********Reflect Damage
IF (<eval <TAG0.DAMAGERETURN>> >=1)
  local.refvalue=<eval ((<ARGN1>*<eval <TAG0.DAMAGERETURN>>)/100)>
    if (<local.refvalue> < 1)
      local.refvalue=1//allways do at LEAST 1 damage, so its not useless to noobs vs weak monsters.
    endif
  src.DAMAGE <Eval <local.refvalue>+1> <def0.physical> <UID>
  battleup2
  //sysmessage You reflect <Eval <local.refvalue>+1> damage back at your attacker!
  if <restest 1 i_lashing_timer> //**Are they a Shadow Warrior using Lashing Darkness talent?
    src.blindfx
    sfx 552
  endif
ENDIF

//************************STAMINA LOSS****************************************************************
IF (<stamina>) > 1
stamina -= 1
ENDIF

if (<src.stamina>) < 0
src.stamina=0
endif




//******************REMOVE SPECIAL EFFECTS************************
//Invigorate cancels if the player gets hit.
if (<restest 1 i_invigorate_timer>)
  if (<eval <tag0.invigcount>>==0)
  consume 1 i_invigorate_timer
  tag.invigcount=
  sysmessage @077,3,1 Your heroic aura has been broken.
  else
  tag.invigcount=<eval <tag0.invigcount>>+-<argn1>
  endif
endif

IF (<TAG0.TEMP_PHYSICALDAM>) || (<TAG0.TEMP_FIREDAM>) || (<TAG0.TEMP_COLDDAM>) || (<TAG0.TEMP_POISONDAM>) || (<TAG0.TEMP_ENERGYDAM>)
  IF (<FLAGS>&04)
    FINDID.i_rune_paralyze.REMOVE
    FINDID.i_rune_paralyze_field.REMOVE
    FLAGS &= ~04
  ENDIF
ARGN1=<f_cs_damageabsorption <ARGN1>>
VAR.ARGN1=<ARGN1>
TRIGGER=@DamageAbsorb            //src = attacker, [] = attacked
ELSE
  ARGN1=<VAR.ARGN1>
  TAG.TEMP_PHYSICALDAM
  TAG.TEMP_FIREDAM
  TAG.TEMP_COLDDAM
  TAG.TEMP_POISONDAM
  TAG.TEMP_ENERGYDAM
  ARGN2=1 //set damage flags=dam_god to avoid default armor reduction
ENDIF

//**************check constitution
if (<constitution> < 1000)
SKILLGAIN constitution 10
endif
f_dodging

//**** ADD BLEEDING WHEN HIT
if !(<NPC>)
CreateDamageBlood
endif

//*****MAGIC RESISTANCE FIX SECTION*******
ON=@SPELLEFFECT
//magic reflection fix
IF (<FLAGS>&statf_reflection) && !(<SRC.UID>==<UID>)
IF (<SERV.SPELL.<ARGN1>.FLAGS>&spellflag_harm) || (<ARGN1>==41) //dispel
FLAGS &= ~statf_reflection
FINDID.i_rune_magic_reflection.REMOVE
EFFECT 3 i_fx_bless_effect, 16, 16
IF (<SRC.FLAGS>&statf_reflection) //double reflection
  SRC.FLAGS &= ~statf_reflection
  SRC.FINDID.i_rune_magic_reflection.REMOVE
  SRC.EFFECT 3 i_fx_bless_effect, 16, 16
ELSE
  SRC.SPELLEFFECT <ARGN1>, <ARGN2>
ENDIF
RETURN 1
ENDIF
ENDIF

//***************the actual resist check
IF (<SERV.SPELL.<ARGN1>.FLAGS>&spellflag_resist)
LOCAL.RESIST=<EVAL <MAGICRESISTANCE>-((<SRC.channeling>*<SpellCircle <ARGN1>>)/20)>
IF (<LOCAL.RESIST>>RAND(1000))
SYSMESSAGE You feel yourself resisting magical energy.
SRC.SYSMESSAGE <NAME> resists the spell.
ARGN3 -= RAND(<MAGICRESISTANCE>/6,<MAGICRESISTANCE>/4)
ELSE
ARGN3 -= RAND(0,<MAGICRESISTANCE>/7)
ENDIF
ENDIF
RETURN 2

[FUNCTION spellcircle] //argn1=spell number
IF (<ARGN1>>=1) && (<ARGN1><=64) //only with default (mage) spells
RETURN <EVAL ((<ARGN1>-1)/8)+1>
ELSE
RETURN 1
ENDIF

//***************************************************
//***************************************************
//***************************************************
//***************************************************
//***************************************************
//MAGIC ITEM PROPERTIES
//***************************************************
//***************************************************
//***************************************************
//***************************************************
//***************************************************
//--------------------------
// SPECIAL ABILITIES
//--------------------------


[TYPEDEF T_USEBESTWEAPONSKILL]
ON=@Equip
IF (<SRC.SWORDSMANSHIP> > <SRC.FENCING>) && (<SRC.SWORDSMANSHIP> > <SRC.MACEFIGHTING>)
TAG.OVERRIDE_SKILL=41
ELIF (<SRC.FENCING> > <SRC.SWORDSMANSHIP>) && (<SRC.FENCING> > <SRC.MACEFIGHTING>)
TAG.OVERRIDE_SKILL=43
ELIF (<SRC.MACEFIGHTING> > <SRC.SWORDSMANSHIP>) && (<SRC.MACEFIGHTING> > <SRC.FENCING>)
TAG.OVERRIDE_SKILL=42
ENDIF

[TYPEDEF T_hpmax]
ON=@Equip
if (<tag0.identified>)
IF (<tag0.maxhits>)
SRC.modhits += <eval <TAG0.maxhits>>
ENDIF
else
return 0
endif

ON=@UnEquip
if (<tag0.identified>)
IF (<tag0.maxhits>)
SRC.modhits -= <eval <TAG0.maxhits>>
ENDIF
else
return 0
endif

[TYPEDEF T_stammax]
ON=@Equip
if (<tag0.identified>)
IF (<tag0.maxstam>)
SRC.modstam += <TAG0.maxstam>
ENDIF
else
return 0
endif

ON=@UnEquip
if (<tag0.identified>)
IF (<tag0.maxstam>)
SRC.modstam -= <TAG0.maxstam>
ENDIF
else
return 0
endif

[TYPEDEF T_manamax]
ON=@Equip
if (<tag0.identified>)
IF (<tag0.maxmana>)
SRC.modmana += <TAG0.maxmana>
ENDIF
else
return 0
endif

ON=@UnEquip
if (<tag0.identified>)
IF (<tag0.maxmana>)
SRC.modmana -= <TAG0.maxmana>
ENDIF
else
return 0
endif

[TYPEDEF T_strmax]
ON=@Equip
if (<tag0.identified>)
IF (<TAG0.strup>)
SRC.modstr += <TAG0.strup>
ENDIF
else
return 0
endif

ON=@UnEquip
if (<tag0.identified>)
IF (<TAG0.strup>)
SRC.modstr -= <TAG0.strup>
ENDIF
else
return 0
endif

[TYPEDEF T_dexmax]
ON=@Equip
if (<tag0.identified>)
IF (<TAG0.dexup>)
SRC.moddex += <TAG0.dexup>
ENDIF
else
return 0
endif

ON=@UnEquip
if (<tag0.identified>)
IF (<TAG0.dexup>)
SRC.moddex -= <TAG0.dexup>
ENDIF
else
return 0
endif

[TYPEDEF T_intmax]
ON=@Equip
if (<tag0.identified>)
IF (<TAG0.intup>)
SRC.modint += <TAG0.intup>
ENDIF
else
return 0
endif

ON=@UnEquip
if (<tag0.identified>)
IF (<TAG0.intup>)
SRC.modint -= <TAG0.intup>
ENDIF
else
return 0
endif


//NOTE**************************
//tag.override.regen is regen SPEED increase
//override.regenval is regen AMOUNT increase

[TYPEDEF t_regenhp]
on=@equip
if (<tag0.identified>)
IF (<tag0.regenhp>)
src.tag.override.regenval_0=<eval <src.tag0.override.regenval_0>> + <eval <tag0.regenhp>>
src.TAG.OVERRIDE.REGENval_0 +=<tag0.regenhp>
endif
else
return 0
endif

on=@unequip
if (<tag0.identified>)
IF (<tag0.regenhp>)
src.tag.override.regenval_0=<eval <src.tag0.override.regenval_0>> - <eval <tag0.regenhp>>
src.TAG.OVERRIDE.REGENval_0 -=<tag0.regenhp>
endif
else
return 0
endif

[TYPEDEF t_regenstam]
on=@equip
if (<tag0.identified>)
src.tag.override.regenval_2=<eval <src.tag0.override.regenval_2>> + <eval <tag0.regenstam>>
IF (<tag0.regenstam>)
src.TAG.OVERRIDE.REGENval_2 +=<Eval <tag0.regenstam>>
endif
else
return 0
endif

on=@unequip
if (<tag0.identified>)
IF (<tag0.regenstam>)
src.tag.override.regenval_2=<eval <src.tag0.override.regenval_2>> - <eval <tag0.regenstam>>
src.TAG.OVERRIDE.REGENval_2 -=<eval <tag0.regenstam>>
endif
else
return 0
endif

[TYPEDEF t_regenmana]
on=@equip
if (<tag0.identified>)
IF (<tag0.regenmana>)
src.tag.override.regenval_1=<eval <src.tag0.override.regen_1>> + <eval <tag0.regenmana>>
src.TAG.OVERRIDE.REGENval_1 +=<tag0.regenmana>val
endif
else
return 0
endif

on=@unequip
if (<tag0.identified>)
IF (<tag0.regenmana>)
src.tag.override.regenval_1=<eval <src.tag0.override.regenval_1>> - <eval <tag0.regenmana>>
src.TAG.OVERRIDE.REGENval_1 -=<tag0.regenmana>
endif
else
return 0
endif

[TYPEDEF T_barrier]
ON=@dclick
if (<tag0.identified>)
if !<src.tag.barrierhp>
    if <hitpoints> >=5
    HITS -=<R1,8>
    SRC.tag0.barrierhp += <TAG0.barrierhp>
    src.events +e_barrier
    src.sysmessage @036,3,1 You activate a <eval <tag0.barrierhp>> hitpoint magic barrier, sapping durability from the item.
    src.update
    SRC.EFFECT=3,i_FX_glow_spike,6,15,1 // Sparkle effect
    return 0
    else
    src.sysmessage @036,3,1 That item is too damaged to enable a barrier.
    return 0
    endif
return 0
else
src.sysmessage @036,3,1 You already have a barrier activated.
return 0
endif
else
return 0
endif

[TYPEDEF t_shieldmastery]
on=@equip
if (<tag0.identified>)
src.parrying +=<tag0.shieldmastery>
else
return 0
endif

on=@unequip
if (<tag0.identified>)
src.parrying -=<tag0.shieldmastery>
else
return 0
endif

[TYPEDEF t_conBonus]
on=@equip
if (<tag0.identified>)
src.constitution +=<tag0.conBonus>
else
return 0
endif

on=@unequip
if (<tag0.identified>)
src.constitution -=<tag0.conBonus>
else
return 0
endif


[TYPEDEF e_slayergroupie]
on=@Equip
if (<tag0.identified>)
src.events +e_slayerhit
src.tag.slayergroup=<tag0.slayergroup>
else
return 0
endif

on=@UnEquip
if (<tag0.identified>)
src.events -e_slayerhit
src.tag.slayergroup
else
return 0
endif

[EVENTS e_slayerhit]
on=@hit
//if (<tag0.identified>)
IF !(<SRC.ISPLAYER>)
IF !(<ISEMPTY <obj.TAG0.SLAYERGROUP>>)
IF (STRMATCH(*<SRC.BASEID>*,<DEF.<obj.TAG0.SLAYERGROUP>_SLAYER>))
ARGN1 *= 2
SRC.EFFECT 3,i_fx_glow,16,20
ENDIF
ENDIF
ENDIF
//else
//return 0
//endif

[TYPEDEF e_moraleincrease]
ON=@Equip
if (<tag0.identified>)
SRC.TAG.maxmorale += <eval <TAG0.moraleincrease>>
else
return 0
endif

ON=@UnEquip
if (<tag0.identified>)
SRC.TAG.maxmorale -= <Eval <TAG0.moraleincrease>>
else
return 0
endif

[TYPEDEF e_peityincrease]
ON=@Equip
if (<tag0.identified>)
SRC.TAG.maxpeity += <eval <TAG0.peityincrease>>
SRC.TAG.peitybonus += <eval <TAG0.peitybonus>>
else
return 0
endif

ON=@UnEquip
if (<tag0.identified>)
SRC.TAG.maxpeity -= <Eval <TAG0.peityincrease>>
SRC.TAG.peitybonus -= <eval <tag0.peitybonus>>
else
return 0
endif


[TYPEDEF e_definc]
ON=@Equip
if (<tag0.identified>)
IF (<TAG0.defensechanceincrease>)
SRC.TAG0.defensechanceincrease += <TAG0.defensechanceincrease>
ENDIF
else
return 0
endif

[TYPEDEF e_defdec]
ON=@Equip
if (<tag0.identified>)
IF (<TAG0.defensechancedecrease>)
SRC.TAG0.defensechanceincrease -= <TAG0.defensechancedecrease>
ENDIF
else
return 0
endif

[TYPEDEF e_hitinc]
ON=@Equip
if (<tag0.identified>)
IF (<TAG0.hitchanceincrease>)
SRC.TAG0.hitchanceincrease += <TAG0.hitchanceincrease>
ENDIF
else
return 0
endif

[TYPEDEF e_hitdec]
ON=@Equip
if (<tag0.identified>)
IF (<TAG0.hitchancedecrease>)
SRC.TAG0.hitchanceincrease -= <TAG0.hitchancedecrease>
ENDIF
else
return 0
endif


[TYPEDEF e_dmginc]
ON=@Equip
if (<tag0.identified>)
IF (<TAG0.damageincrease>)
SRC.TAG0.damageincrease += <TAG0.hitchanceincrease>
ENDIF
else
return 0
endif

[TYPEDEF e_dmgdec]
ON=@Equip
if (<tag0.identified>)
IF (<TAG0.damagedecrease>)
SRC.TAG0.damageincrease -= <TAG0.hitchancedecrease>
ENDIF
else
return 0
endif


[TYPEDEF e_shieldbashincrease]
ON=@Equip
if (<tag0.identified>)
IF (<TAG0.shieldbashincrease>)
SRC.TAG0.shieldbash += <TAG0.shieldbashincrease>
ENDIF
else
return 0
endif

ON=@UnEquip
if (<tag0.identified>)
IF (<TAG0.shieldbashincrease>)
SRC.TAG0.shieldbash -= <TAG0.shieldbashincrease>
IF !(<SRC.TAG0.shieldbashincrease>)
SRC.TAG.shieldbashincrease
ENDIF
ENDIF
else
return 0
endif

[TYPEDEF e_keenedge]  //damage calc for this is in combatsystem above
ON=@Equip
IF (<TAG0.keenedge>)
SRC.TAG0.keenedge += <TAG0.keenedge>
ENDIF

ON=@UnEquip
IF (<TAG0.keenedge>)
SRC.TAG0.keenedge -= <TAG0.keenedge>
IF !(<SRC.TAG0.keenedge>)
SRC.TAG.keenedge
ENDIF
ENDIF


[TYPEDEF e_lifeleech]
ON=@Equip
if (<tag0.identified>)
IF (<TAG0.LIFELEECH>)
SRC.TAG0.LIFELEECH += <TAG0.LIFELEECH>
ENDIF
else
return 0
endif

ON=@UnEquip
if (<tag0.identified>)
IF (<TAG0.LIFELEECH>)
SRC.TAG0.LIFELEECH -= <TAG0.LIFELEECH>
IF !(<SRC.TAG0.LIFELEECH>)
SRC.TAG.LIFELEECH
ENDIF
ENDIF
else
return 0
endif

[TYPEDEF e_manaleech]
ON=@Equip
if (<tag0.identified>)
IF (<TAG0.MANALEECH>)
SRC.TAG0.MANALEECH += <TAG0.MANALEECH>
ENDIF
else
return 0
endif

ON=@UnEquip
if (<tag0.identified>)
IF (<TAG0.MANALEECH>)
SRC.TAG0.MANALEECH -= <TAG0.MANALEECH>
IF !(<SRC.TAG0.MANALEECH>)
SRC.TAG.MANALEECH
ENDIF
ENDIF
else
return 0
endif

[TYPEDEF e_fearbonus]
ON=@Equip
if (<tag0.identified>)
IF (<TAG0.fear>)
SRC.TAG0.fear += <TAG0.fear>
ENDIF
else
return 0
endif

ON=@UnEquip
if (<tag0.identified>)
IF (<TAG0.fear>)
SRC.TAG0.fear -= <TAG0.fear>
IF !(<SRC.TAG0.fear>)
SRC.TAG.fear
ENDIF
ENDIF
else
return 0
endif


[TYPEDEF e_stammyleech]
ON=@Equip
if (<tag0.identified>)
IF (<TAG0.STAMLEECH>)
SRC.TAG0.STAMLEECH += <TAG0.STAMLEECH>
ENDIF
else
return 0
endif

ON=@UnEquip
if (<tag0.identified>)
IF (<TAG0.STAMLEECH>)
SRC.TAG0.STAMLEECH -= <TAG0.STAMLEECH>
IF !(<SRC.TAG0.STAMLEECH>)
SRC.TAG.STAMLEECH
ENDIF
ENDIF
else
return 0
endif

[TYPEDEF e_burndmg]
on=@damagecalc
if (<tag0.identified>)
IF (<R<TAG0.HITFIREBALL>> >= <R100>)
src.effect 3,i_fx_field_fire_ns,16,20
src.AOSDAMAGE <tag0.burnstr> <def0.fire> <uid>
src.sfx 857
ENDIF
else
return 0
endif

[TYPEDEF e_zapdmg]
on=@damagecalc
if (<tag0.identified>)
IF (<R<TAG0.HITLIGHTNING>> >= <R100>)
src.zappyzap
src.AOSDAMAGE <r1,3> <def0.energy> <uid>
src.sfx 1471
ENDIF
else
return 0
endif

[TYPEDEF e_colddmg]
on=@damagecalc
if (<tag0.identified>)
IF (<R<TAG0.HITCOLD>> >= <R100>)
//src.effect 3,i_fx_glow2,16,20
src.blueburst
src.AOSDAMAGE <tag0.coldstr> <def0.cold> <uid>
src.sfx 513
ENDIF
else
return 0
endif

[TYPEDEF e_harmdmg]
on=@damagecalc
if (<tag0.identified>)
IF (<R<TAG0.HITHARM>> >= <R100>)
//SRC.SPELLEFFECT S_HARM,<R200,700>,<UID>
src.AOSDAMAGE <tag0.harmstr> <def0.poison> <uid>
src.greenburst
src.sfx 497
ENDIF
else
return 0
endif

[TYPEDEF e_paralyzedmg]
on=@damagecalc
if (<tag0.identified>)
IF (<R<TAG0.HITPARALYZE>> >= <R100>)
SRC.SPELLEFFECT S_PARALYZE,1000,<UID>
src.greensparkles
src.sfx 497
ENDIF
else
return 0
endif

[TYPEDEF e_dispeldmg]
on=@damagecalc
if (<tag0.identified>)
IF (<TAG0.HITDISPEL>)
IF (<R50> >= <R100>)
SRC.SPELLEFFECT S_DISPEL,100.0,<UID>
ENDIF
ENDIF
else
return 0
endif

[TYPEDEF T_ELFS_ONLY]
ON=@EquipTest
IF (<SRC.BODY> != C_ELF_MALE) && (<SRC.BODY> != C_ELF_FEMALE) && (<SRC.ISPLAYER>)
SRC.SYSMESSAGE @946,3,1 Only elves may use this item.
RETURN 1
ENDIF

ON=@ClientToolTip
SRC.ADDCLILOC 1075086

[TYPEDEF T_DAMAGERETURN]
ON=@Equip
if (<tag0.identified>)
IF (<TAG0.DAMAGERETURN>)
SRC.TAG0.DAMAGERETURN += <TAG0.DAMAGERETURN>
ENDIF
else
return 0
endif

ON=@UnEquip
if (<tag0.identified>)
IF (<TAG0.DAMAGERETURN>)
SRC.TAG0.DAMAGERETURN -= <TAG0.DAMAGERETURN>
IF !(<SRC.TAG0.DAMAGERETURN>)
SRC.TAG.DAMAGERETURN=
ENDIF
ENDIF
else
return 0
endif

[TYPEDEF e_arrowdmg]
on=@damagecalc
if (<tag0.identified>)
IF (<TAG0.MAGICARROW>)
IF (<R<TAG0.MAGICARROW>> >= <R100>)
SRC.SPELLEFFECT s_magic_arrow,<R250,700>,<UID>
ENDIF
ENDIF
else
return 0
endif

[TYPEDEF t_nighteyes]
on=@dclick
if (<tag0.identified>)
src.SPELLEFFECT=s_night_sight 1000
//src.effect 3,i_fx_bless,16,20
src.sfx 483
more2=<more2>+-{1 3}
else
return 0
endif


[TYPEDEF t_dblstrike]
on=@equip
src.events +e_dblstrike

on=@unequip
src.events -e_dblstrike

[events e_dblstrike]
on=@hittry
events -e_dblstrike
ARGN1 = 1


[typedef t_reflectshield]
//(SRC=the attacker, CONT=the player who parried, default object=the item)
on=@parry
src.aosdamage <r1,8> <var.physical> <cont.uid>



//***Set on bows to make them drop stamina 1 per shot, as if to exhaust from drawing back the string. This is a detriment made necessary
//due to their great range and adequately painful damage ratio.

[events e_bowon]
on=@hittry
if (<stamina> >=1)
stamina -=<eval <tag0.bowdrain> +1>
endif
if (<stamina> <=0)
stamina=0
endif



    
[ITEMDEF i_ssarrow]
name=new arrow
id=i_arrow
NAME=special arrow%s
TYPE=T_WEAPON_ARROW
RESOURCES=1 i_arrow_shaft, 1 i_feather
REPLICATE=1
SKILLMAKE=1.0 BOWCRAFT
WEIGHT=0.1

on=@fire
TAG.OVERRIDE.AMMOTYPE
local.bonus=<eval rand(1, 10)>
    argn1=<serv.itemdef(i_fire).baseid>
    argn2=021
    argn3=01
    sysmessage You landed a critical strike on your target, causing <dlocal.bonus> extra damage!
    act.damage <local.bonus> 0 <uid>
    


[PLEVEL 1]
torch

[function torch]
if !(<restest 1 i_torch>)
newitem i_torch
new.equip
new.dclick
endif



//<------------------------------------------------------------------------------------->
//< No Usage --------------------------------------------------------------------------->
//<------------------------------------------------------------------------------------->
[FUNCTION CreateDamageBlood]
IF (RAND(2)==0) && (<BLOODCOLOR> >= 0)
   SERV.NEWITEM=0122a
   NEW.DispID={0122a 1 0122b 1 0122c 1 0122d 1 0122e 1 0122f 1}
   NEW.P=<P>
   NEW.ATTR=attr_decay
   NEW.COLOR=<BLOODCOLOR>
   NEW.TIMER={2 20}
ENDIF
(This post was last modified: 09-09-2013 05:40 AM by Mordaunt.)
09-09-2013 04:50 AM
Find all posts by this user Like Post Quote this message in a reply
amonvangrell
Banned

Posts: 337
Likes Given: 17
Likes Received: 32 in 20 posts
Joined: Aug 2012

britannia shard

Post: #2
RE: Hmm. Issues with this script
too complicate to me, but a tip, use
Code:
[code]
to separate your script from the post.
09-09-2013 05:19 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #3
RE: Hmm. Issues with this script
Difficult to read through that Shock

Anyway, does the ogre has tag0.physicaldamage set on him ?

Looks like there is no (or at least i can't find it) @DamageCalc function for characters fighting unarmed.

Also i think that the function for firing custom trigger uses a different syntax now
09-09-2013 05:21 AM
Find all posts by this user Like Post Quote this message in a reply
sayter
Apprentice
*

Posts: 2
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Sep 2013
Reputation: 0



Post: #4
RE: Hmm. Issues with this script
Yea, it's a rather long script. I'm using an older version of sphere, and a client to suit that version. Offhand I cannot recall, but it worked without a hitch a long while back. I did a change shortly before I got involved in other stuff in life and didn't have time to do this stuff anymore... and then poof, broken.

Not sure what I last changed, though I am not seeing significant errors firing on the console. None related to this , at least, beyond a few missing functions I haven't written yet which are called.

As for the physicaldamage tag... yea, they all do. I've tested unarmed, armed, and magic etc. It's melee/unarmed causing the issue for certain. My custom magic works wonderfully. Aggravating when you find a bug like this.

Code:
IF (<DAM>)//or is it an NPC attacking>?
    LOCAL.DAMAGE=<EVAL RAND(<DAM>)>
    LOCAL.WRESTLINGBONUS=<Eval <wrestling>/200>
    IF (<wrestling>>=100.0)
    LOCAL.wrestling += 10
    ENDIF
    ELSE //or are we fighting with wrestling?
    LOCAL.WRESTLINGBONUS=<Eval <wrestling>/200>
    IF (<wrestling>>=100.0)
    LOCAL.wrestling += 10
    ENDIF

That's the bit for NPCs attacking (wrestling/unarmed) so that isn't the issue. Additionally , this affects players as well as NPCs, but it isn't as noticable. When 14 ogres gang up on a 0 stat noob and dont hurt it enough to kill it, that is indicative of a problem for sure Smile
(This post was last modified: 09-20-2013 09:58 AM by sayter.)
09-20-2013 09:53 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 2 Guest(s)