Healing fails - Leonidas - 09-04-2013 06:30 PM
Okay so this is the healing script I have. I love it so far and everything works fine, but what im wanting is healing fails, cure poison fails, the higher the healing level, the less chance to fail.
Also, how would I make it so when the players dex gets higher in increments of 10, they heal a little bit faster?
Quote:[ITEMDEF 0e21]
DEFNAME=i_bandage
TYPE=t_eq_script
WEIGHT=0.1
DUPELIST=0ee9
VALUE=7
CATEGORY=Items by Professions
SUBSECTION=Healer
DESCRIPTION=Clean Bandages
ON=@DClick
IF (<SRC.FINDID.i_heal_timer>)
src.sysmessage You must wait before you can heal again!
RETURN 1
ENDIF
IF (<TOPOBJ.UID>!=<SRC.UID>)
SRC.SYSMESSAGEUA 0ac 0 1 1 Bandages must be on you.
ELSE
TARGET Who do you want to Heal?
ENDIF
RETURN 1
ON=@TARGON_CHAR
VAR.HEAL <EVAL <SRC.HEALING>/50>
VAR.ANAT <EVAL <SRC.ANATOMY>/100>
VAR.SUA_COLOR=03
IF !(<SRC.TARG.HITS><<SRC.TARG.STR>) && !(<SRC.TARG.FLAGS>&statf_poisoned) && !(<SRC.TARG.FLAGS>&statf_dead)
RETURN 1
ELSEIF (<SRC.TARG.FLAGS>&statf_poisoned) && (<SRC.HEALING>>30.0)
SRC.TARG.EFFECT 3,i_fx_heal_effect,6,15,1
SRC.SOUND=SND_SPELL_CUre
SRC.TARG.SPELLEFFECT s_cure,1000
SRC.CONSUME i_bandage
SRC.CONSUME i_bandage_bloody
SRC.SYSMESSAGEUA You heal <SRC.TARG.NAME>'s poison.
ELSEIF (<SRC.TARG.FLAGS>&statf_dead) && (<SRC.HEALING>>99.9)
SRC.TARG.RESURRECT
SRC.EMOTE ressurect <SRC.TARG.NAME>
ELSEIF !(<SRC.TARG.FLAGS>&statf_poisoned) && !(<SRC.TARG.FLAGS>&statf_dead) && (<SRC.TARG.HITS><<SRC.TARG.STR>)
IF (<EVAL <SRC.TARG.HITS>+<VAR.HEAL>+<VAR.ANAT>>><SRC.TARG.STR>)
SRC.TARG.HITS=<SRC.TARG.STR>
ELSE
SRC.TARG.HITS=<SRC.TARG.HITS>+<VAR.HEAL>+<VAR.ANAT>
SRC.SYSMESSAGEUA You heal <SRC.TARG.NAME>
ENDIF
ELSE
SRC.SYSMESSAGEUA You're not a good healer enough to resurrect or cure someone.
RETURN 1
ENDIF
SRC.CONSUME i_bandage
SRC.NEWITEM i_bandage_bloody
SRC.ACT.CONT=<SRC.UID>
SRC.NEWITEM i_heal_timer
SRC.ACT.TIMER 6
SRC.ACT.CONT <SRC.UID>
IF (<SRC.HEALING><100.0) && (RAND(25)==1)
SRC.HEALING=<SRC.HEALING>+1
ELSEIF (<SRC.HEALING>>99.9) && (<SRC.HEALING><200.0) && (RAND(50)==1)
SRC.HEALING=<SRC.HEALING>+1
ELSEIF (<SRC.HEALING>>199.9) && (<SRC.HEALING><300.0) && (RAND(75)==1)
SRC.HEALING=<SRC.HEALING>+1
ELSEIF (<SRC.HEALING>>299.9) && (<SRC.HEALING><400.0) && (RAND(100)==1)
SRC.HEALING=<SRC.HEALING>+1
ELSEIF (<SRC.HEALING>>399.9) && (<SRC.HEALING><500.0) && (RAND(150)==1)
SRC.HEALING=<SRC.HEALING>+1
ENDIF
RETURN 1
[ITEMDEF i_heal_timer]
ID=i_worldgem_bit
NAME=Healing Timer
LAYER=layer_special
TYPE=t_eq_script
ON=@CREATE
ATTR=0c
TIMER=6
ON=@TIMER
REMOVE
RETURN 1
Kinda just getting into scripting so don't dog me too hard
RE: Healing fails - Shidhun - 09-06-2013 02:24 AM
You could try something like this :
Code:
[SKILL 17]
DEFNAME=Skill_Healing
KEY=Healing
TITLE=Heilkunde
PROMPT_MSG=@0c4,0,1 Wen willst Du heilen?
DELAY=3.0,2.0
FLAGS=01
ADV_RATE=10.0,285.0,810.0
BONUS_STATS=0
BONUS_STR=0
BONUS_DEX=0
BONUS_INT=0
STAT_STR=0
STAT_DEX=0
STAT_INT=0
ON=@WAIT
RETURN 0
ON=@SELECT
FINDID(i_bandage).DCLICK
RETURN 1
ON=@START
IF (<ISPLAYER>)
//DO the same as bandages and not use the skill?
RETURN 1
ELSE
SAYUA 955,0,0,deu *trying to heal*
ENDIF
RETURN 0
ON=@SUCCESS
IF (<NPC>)
IF (<HITS> < <MAXHITS>)
HITS += <HEALING>/20
IF (<HITS> > <MAXHITS>)
HITS=<MAXHITS>
ENDIF
ENDIF
RETURN 0
ENDIF
RETURN 1
Code:
[ITEMDEF 0e21]
DEFNAME=i_bandage
NAME=Bandagen
RESOURCES=i_cloth
TYPE=T_BANDAGE
WEIGHT=.1
DYE=1
VALUE=1
DUPELIST=0ee9
ON=@DClick
SRC.SYSMESSAGEUA 0c4,0,0,deu Whom do you want to heal?
TARGET
RETURN 1
ON=@TARGON_CHAR
SRC.ACTION -1
IF !(<SRC.RESTEST 1 i_bandage>)
SRC.SYSMESSAGEUA 0c4,0,0,deu You need bandages to heal somebody!
RETURN 1
ELSEIF (<SRC.TAG0.Healing>)
SRC.SYSMESSAGEUA 0c4,0,0,deu You haven't finished your previous healing attempt!
RETURN 1
ELSEIF (<SRC.TARG.DISTANCE> > 4)
SRC.SYSMESSAGEUA 0c4,0,0,deu You are to far away from <SRC.TARG.ANAME> for healing!
RETURN 1
ELSEIF !(<SRC.TARG.CANSEELOS>)
SRC.SYSMESSAGEUA 0c4,0,0,deu You have to be able to see <SRC.TARG.ANAME> for healing !
RETURN 1
ELSEIF (<SRC.TARG.FLAGS>&02)
SRC.SYSMESSAGEUA 0c4,0,0,deu <SRC.TARG.ANAME> is a ghost, you can not help using a bandage.
IF (<SRC.HEALING> >= 950)
SRC.SYSMESSAGEUA 0c4,0,0,deu If you find the corpse of <SRC.TARG.ANAME>, you might be able to ress him.
ENDIF
RETURN 1
ELSEIF (<src.targ.flags>&04000000)
SRC.SYSMESSAGEUA 0c4,0,0,deu You can't heal summoned creatures!
RETURN 1
ELSE
IF ((<SRC.TARG.HITS> < <SRC.TARG.MAXHITS>)||(<SRC.TARG.FLAGS>&0400080))
IF ((<SRC.DISPID> == c_man)||(<SRC.DISPID> == c_woman)||(<SRC.DISPID> == c_elf_male)||(<SRC.DISPID> == c_elf_female))
SRC.ANIM 19
ELSE
SRC.ANIM 6
ENDIF
IF (<SRC.FINDLAYER(1)>)
SRC.FINDLAYER(1).UNEQUIP
ENDIF
IF (<SRC.FINDLAYER(2)>)
SRC.FINDLAYER(2).UNEQUIP
ENDIF
IF (<AMOUNT> > 1)
AMOUNT -= 1
UPDATE
ELSE
REMOVE
ENDIF
NEWITEM i_mem_healing
NEW.LINK=<SRC.TARG.UID>
SRC.EQUIP <NEW>
RETURN 1
ELSE
SRC.SYSMESSAGEUA 0c4,0,0,deu The Target is at full health!
RETURN 1
ENDIF
ENDIF
RETURN 1
ON=@TARGON_ITEM
IF !(<SRC.TARG.ID>==02006) //Corpse
SRC.SYSMESSAGEUA 0c4,0,0,deu That cant' be resurrected!
RETURN 1
ELSEIF !(<AMOUNT> > 9)
SRC.SYSMESSAGEUA 0c4,0,0,deu You don't have enough bandages to bring someone back to life!
RETURN 1
ELSEIF (<SRC.TAG0.Healing>)
SRC.SYSMESSAGEUA 0c4,0,0,deu You haven't finished your previous healing attempt!
RETURN 1
ELSEIF (<SRC.TARG.DISTANCE> > 4)
SRC.SYSMESSAGEUA 0c4,0,0,deu You are to far away!
RETURN 1
ELSEIF !(<SRC.TARG.CANSEELOS>)
SRC.SYSMESSAGEUA 0c4,0,0,deu You need to be able to actually see<SRC.TARG.LINK.ANAME> !
RETURN 1
ELSEIF !(<SRC.TARG.LINK.FLAGS>&02)
SRC.SYSMESSAGEUA 38,0,0,deu The Player has allready been resurrected.
RETURN 1
ELSE
IF (<SRC.FINDLAYER(1)>)
SRC.FINDLAYER(1).UNEQUIP
ENDIF
IF (<SRC.FINDLAYER(2)>)
SRC.FINDLAYER(2).UNEQUIP
ENDIF
IF (<SRC.TAG0.PLOT1> & 0100)||(<SRC.FLAGS>&0400)
SRC.ANIM 7
ELSE
SRC.ANIM=32
ENDIF
IF (<AMOUNT> > 10)
AMOUNT -= 10
UPDATE
ELSE
REMOVE
ENDIF
NEWITEM=i_mem_healing
SRC.EQUIP <NEW>
NEW.LINK=<SRC.TARG.UID>
RETURN 1
ENDIF
RETURN 1
ON=@TARGON_GROUND
SRC.SYSMESSAGEUA 0c4,0,0,deu What exactly do you want to heal?!?
RETURN 1
Code:
[ITEMDEF i_mem_healing]
ID=i_memory
TYPE=t_eq_script
LAYER=53
NAME=Healing
ON=@EQUIP
ATTR=attr_decay
//How much is healed?
IF ((RAND(50)+RAND(50)) < 20) //Failchance
MORE1 -1
TIMER=2
ELSE
MORE1=<EVAL ((<SRC.HEALING>/60) + {0 ((<SRC.ANATOMY>/200) + (<SRC.HEALING>/70))} + 10 )>
TIMER={2 3}
ENDIF
IF (<LINK.NPC>)&&(<SRC.VETERINARY> = 1000)
TIMERF -= {5 10}
ENDIF
SRC.TAG.Healing=1
ON=@UNEQUIP
SRC.TAG.Healing=
ON=@TIMER
IF (<LINK.UID>)
CONT.ACTION -1
IF (<LINK.ISCHAR>)
IF !((<LINK.HITS> < <LINK.MAXHITS>)||(<LINK.FLAGS>&0400080))
CONT.SYSMESSAGEUA 0c4,0,0,deu <LINK.ANAME> is allready at full health!
REMOVE
RETURN 1
ENDIF
IF !(<LINK.NPC>)||(<LINK.NPC>==2)
IF !(<LINK.UID> == <CONT.UID>)
IF (<MORE1> <= 0)
CONT.SYSMESSAGEUA 0c4,0,0,deu You fail at healing <LINK.ANAME> .
LINK.SYSMESSAGEUA 0c4,0,0,deu <CONT.ANAME> tries to heal you, but fails.
IF ({1 10} > 2)
NEWITEM=i_bandage_bloody
CONT.BOUNCE <NEW.UID>
ENDIF
//Skillgain @fail
CONT.SKILLGAIN Healing 1
REMOVE
RETURN 0
ELSE
LOCAL.Diff=<EVAL (100*(<LINK.MAXHITS>-<LINK.HITS>))/<LINK.MAXHITS>>
IF ((<CONT.HEALING> >= {750 1200}) && (<LINK.FLAGS>&0400000))
LINK.FINDLAYER(49).REMOVE
CONT.SYSMESSAGEUA 0c4,0,0,deu Du remove <LINK.ANAME>s hallucinations.
LOCAL.Diff += 20
ENDIF
IF ((<CONT.HEALING> >= {500 1200}) && (<LINK.FLAGS>&080))
LINK.FINDLAYER(42).REMOVE
CONT.SYSMESSAGEUA 0c4,0,0,deu You cure <LINK.ANAME> from the poison.
LOCAL.Diff += 10
ENDIF
IF ({1 10} > 2)
NEWITEM=i_bandage_bloody
CONT.BOUNCE <NEW.UID>
ENDIF
//Skillgain @success
CONT.SKILLGAIN Healing <LOCAL.Diff>
CONT.SKILLGAIN Anatomy <LOCAL.Diff>
IF (<LINK.HITS> < <LINK.MAXHITS>)
LINK.HITS += <MORE1>
IF (<LINK.HITS> > <LINK.MAXHITS>)
LINK.HITS=<LINK.MAXHITS>
ENDIF
CONT.SYSMESSAGEUA 0c4,0,0,deu You heal <LINK.ANAME>.
ENDIF
LINK.SYSMESSAGEUA 0c4,0,0,deu <CONT.ANAME> is healing you.
REMOVE
RETURN 0
ENDIF
ELSE
IF (<MORE1> <= 0)
CONT.SYSMESSAGEUA 0c4,0,0,deu You fail healing yourself.
IF ({1 10} > 2)
NEWITEM=i_bandage_bloody
CONT.BOUNCE <NEW.UID>
ENDIF
//Skillgain @fail
CONT.SKILLGAIN Healing 1
REMOVE
RETURN 0
ELSE
LOCAL.Diff=<EVAL (100*(<LINK.MAXHITS>-<LINK.HITS>))/<LINK.MAXHITS>>
IF ((<CONT.HEALING> >= {750 1200}) && (<CONT.FLAGS>&0400000))
CONT.FINDLAYER(49).REMOVE
CONT.SYSMESSAGEUA 0c4,0,0,deu You remove the hallucinating effects.
LOCAL.Diff += 20
ENDIF
IF ((<CONT.HEALING> >= {500 1200}) && (<CONT.FLAGS>&080))
CONT.FINDLAYER(42).REMOVE
CONT.SYSMESSAGEUA 0c4,0,0,deu You cure yourself from poison.
LOCAL.Diff += 10
ENDIF
IF ({1 10} > 2)
NEWITEM=i_bandage_bloody
CONT.BOUNCE <NEW.UID>
ENDIF
//Skillgain @success
CONT.SKILLGAIN Healing <LOCAL.Diff>
CONT.SKILLGAIN Anatomy <LOCAL.Diff>
IF (<CONT.HITS> < <CONT.MAXHITS>)
CONT.HITS += <MORE1>
IF (<CONT.HITS> > <CONT.MAXHITS>)
CONT.HITS=<CONT.MAXHITS>
ENDIF
CONT.SYSMESSAGEUA 0c4,0,0,deu You heal yourself.
ENDIF
REMOVE
RETURN 0
ENDIF
ENDIF
ELSE
IF (<MORE1> <= 0)
CONT.SYSMESSAGEUA 0c4,0,0,deu Your attempt toheal <LINK.ANAME> fails.
IF ({1 10} > 2)
NEWITEM=i_bandage_bloody
CONT.BOUNCE <NEW.UID>
ENDIF
//VetGain @fail
CONT.SKILLGAIN VETERINARY 1
REMOVE
RETURN 0
ELSE
MORE1=<EVAL ((<CONT.VETERINARY>/50) + {(<CONT.VETERINARY>/100) ((<CONT.ANIMALLORE>/200) + (<CONT.VETERINARY>/50))} + 10)>
LOCAL.Diff=<EVAL (100*(<LINK.MAXHITS>-<LINK.HITS>))/<LINK.MAXHITS>>
IF ((<CONT.VETERINARY> >= {750 1200}) && (<LINK.FLAGS>&0400000))
LINK.FINDLAYER(49).REMOVE
CONT.SYSMESSAGEUA 0c4,0,0,deu You remove <LINK.ANAME>s hallucinations.
LOCAL.Diff += 20
ENDIF
IF ((<CONT.VETERINARY> >= {500 1200}) && (<LINK.FLAGS>&080))
LINK.FINDLAYER(42).REMOVE
CONT.SYSMESSAGEUA 0c4,0,0,deu You cure <LINK.ANAME> from the poison.
LOCAL.Diff += 10
ENDIF
IF (<LINK.HITS> < <LINK.MAXHITS>)
LINK.HITS += <MORE1>
IF (<LINK.HITS> > <LINK.MAXHITS>)
LINK.HITS=<LINK.MAXHITS>
ENDIF
CONT.SYSMESSAGEUA 0c4,0,0,deu You heal <LINK.ANAME>.
ENDIF
IF ({1 10} > 2)
NEWITEM=i_bandage_bloody
CONT.BOUNCE <NEW.UID>
ENDIF
//VetGain bei Erfolg
IF (<CONT.TAG0.xpsys.barde>&0100000)
LOCAL.Diff += {10 20}
ENDIF
CONT.SKILLGAIN VETERINARY <LOCAL.Diff>
CONT.SKILLGAIN ANIMALLORE <LOCAL.Diff>
REMOVE
RETURN 0
ENDIF
ENDIF
//Resurrect
ELSEIF (<CONT.Healing> < 950)
CONT.SYSMESSAGEUA 0c4,0,0,deu You are doing your best, but fail.
IF !(<LINK.LINK.TAG0.Corpse>)
CONT.SKILLGAIN Healing 50
LINK.LINK.TAG.Corpse=<LINK>
LINK.LINK.SYSMESSAGEUA 55,0,0,deu <CONT.ANAME> hat gerade deinen Körper mit Bandagen behandelt.
ENDIF
NEWITEM=i_bandage_bloody
NEW.AMOUNT={6 10}
CONT.BOUNCE <NEW.UID>
REMOVE
RETURN 1
ELSEIF (<CONT.HEALING> >= {950 (1100 - (<CONT.ANATOMY>/20))})
CONT.SYSMESSAGEUA 0c4,0,0,deu you are resurrecting <LINK.LINK.ANAME> .
NEWITEM=i_bandage_bloody
NEW.AMOUNT=<EVAL {6 10}>
CONT.BOUNCE <NEW.UID>
//Gain für Ressen
CONT.SKILLGAIN Healing 90
LINK.LINK.GO <LINK.P>
LINK.LINK.RESURRECT
REMOVE
RETURN 0
ELSE
IF !(<LINK.LINK.TAG0.Corpse>)
CONT.SKILLGAIN Healing 50
LINK.LINK.TAG.Corpse=<LINK>
CONT.SYSMESSAGEUA 0c4,0,0,deu You fail resurrecting <LINK.LINK.ANAME> , but are taking care of some wounds.
LINK.LINK.SYSMESSAGEUA 55,0,0,deu <CONT.ANAME> has tried to resurrect you.
ELSE
CONT.SYSMESSAGEUA 0c4,0,0,deu You fail resurrecting <LINK.LINK.ANAME> !
LINK.LINK.SYSMESSAGEUA 0c4,0,0,deu <CONT.ANAME> tries to resurrect you, but fails!
ENDIF
NEWITEM=i_bandage_bloody
NEW.AMOUNT={6 10}
CONT.BOUNCE <NEW.UID>
REMOVE
RETURN 1
ENDIF
ENDIF
REMOVE
RETURN 1
This way, you can use the normale Actdiffs from the skill-Def
|