SphereCommunity
Respawn - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: General Help (/Forum-General-Help)
+--- Thread: Respawn (/Thread-Respawn)



Respawn - larmc20 - 01-13-2014 03:48 AM

Guys. I made animals scripts. it's almost done. But, the problem is when the player DIE the animal goes back to the respawn, where it's killed by the monsters.
I dont want it's going back to respawn. What I have to do?

PHP Code:
[CHARDEF c_poison_mustang]
NAME=Poison Mustang
ID
=c_horse_brown_dk
ICON
=i_pet_horse_brown_dk
ARMOR
=60

DESCRIPTION
=Poison Mustang
SUBSECTION
=Prismas
CATEGORY
=Novos monstros


ON
=@Create
COLOR
=07a5
STR
=60
DEX
=90
INT
=100

Events 
e_hits
SRC
.TAG.SHOWKILLS=1

PARRYING
={20.0 30.0}
MAGICRESISTANCE={30.0 35.0}
TACTICS={35.0 47.0}
WRESTLING={38.0 50.0}
taming=100.0

NPC
=brain_monster

FAME
={9000 10000}
KARMA={-8000 -9999



RE: Respawn - Alaric - 01-13-2014 03:49 AM

If you have custom animal taming, then set "HOME" of the pet -1,-1. Right when you tame it.

56b Prerelease does that by default.


RE: Respawn - XuN - 01-13-2014 03:53 AM

At first you would have to change src.tag.showkills=1 to tag.showkills=1, if the character is created by another obj (char or item).

And you must show us the event e_hits, the problem must be related to it.


RE: Respawn - larmc20 - 01-13-2014 03:55 AM

This event is only a speech
[Events e_hits]

ON=@Click

MESSAGE @0778

I use another Scriptof tame.

PHP Code:
[SKILL 35]
DEFNAME=Skill_Taming
KEY
=Taming
TITLE
=Animal Tamer
PROMPT_MSG
=@0257 Qual animal voce deseja tamar?
DELAY=8.0
STAT_STR
=30
STAT_INT
=40
STAT_DEX
=60
BONUS_STR
=30
BONUS_DEX
=10
BONUS_INT
=60
BONUS_STATS
=20
ADV_RATE
=10.0,200.0,800.0

ON
=@Success
Src
.sfx 0043
src
.events -e_sys_taming

on
=@select

IF !(<SRC.ACTION>=-1)
SRC.sysmessage @0480 Espere.
return 
1
ENDIF
IF <
SRC.FINDLAYER.56>
SRC.sysmessage @0480 Espere.
return 
1
ENDIF

ON=@START

if (<src.targ.karma> <= -800) && (!<src.findid.i_harpa_taming>)
 
SRC.sysmessage @0480 Voce precisa ter o kit Tamingstaff e harpacompleto para tamar este animal.
return 
1
ENDIF

if (<
src.targ.karma> <= -800) && (!<src.findid.I_staff_taming>)
 
SRC.sysmessage @0480 Voce precisa ter o kit Tamingstaff e harpacompleto para tamar este animal.
return 
1
ENDIF

 IF (<
SRC.ACT.ISITEM>)
SRC.SYSMESSAGE @0480 Voce deve domesticar um animal.
return 
1
ENDIF

IF !<
SRC.ACT.TAG.NPC>=0
SRC
.SYSMESSAGE @0480 Voce deve domesticar um animal.
return 
1
ENDIF

IF <
Src.TAMING> < <SRC.ACT.TAMING>
SRC.SYSMESSAGE @0480 Voce nao tem Skill necessaria para tamar esse animal!
return 
1
ENDIF

IF (<eval <
ACT.P.X>+-<SRC.P.X>>>3) || (<eval <SRC.P.X>+-<ACT.P.X>>>3) || (<eval <ACT.P.Y>+-<SRC.P.Y>>>3) || (<eval <SRC.P.Y>+-<ACT.P.Y>>>3)
SRC.SYSMESSAGE @0480 O animal esta muito longe.
RETURN 
1
ENDIF

IF (<
src.targ.MemoryFindType.MEMORY_IPET.LINK>)
SRC.SYSMESSAGE @0480 Este animal ja esta domesticado.
RETURN 
1
ELSE
SRC.CTAG.DOMADOR=<EVAL <SRC.TAMING>/50>+1>
SRC.EVENTS +e_sys_taming
SERV
.NEWITEM i_fix_taming
SERV
.NEW.EQUIP
SERV
.NEW.LINK=<SRC.TARG.SERIAL>
SERV.NEW.TIMER=3
SERV
.NEW.MOREX=<SRC.CTAG.DOMADOR>
DORAND 4
SRC
.SAY @<ACT.ColorBom <src.act.name>
SRC.SAY @<ACT.ColorEu vou cuidar bem de voce
SRC
.SAY @<ACT.ColorEu sempre quiz um <src.act.namecomo voce
SRC
.SAY @<ACT.ColorAqui <src.act.name>
ENDDO
TIMER
=3
RETURN 1
ENDIF

[
EVENTS e_sys_taming]

ON=@SKILLSELECT

ON
=@GETHIT
FINDID
.i_fix_taming.remove
src
.EVENTS -e_sys_taming
    SRC
.SYSMESSAGE @0480 Voce falhou ao tentar domar.

ON=@SPELLEFFECT
FINDID
.i_fix_taming.remove
src
.EVENTS -e_sys_taming
    SRC
.SYSMESSAGE @0480 Voce falhou ao tentar domar.

ON=@USERWARMODE
FINDID
.i_fix_taming.remove
src
.EVENTS -e_sys_taming
    SRC
.SYSMESSAGE @0480 Voce falhou ao tentar domar.


[
ITEMDEF i_fix_taming]
ID=I_MEMORY
NAME
=Tempo Taming
TYPE
=T_EQ_SCRIPT
LAYER
=56

ON
=@TIMER
IF (<MORE1><4)
IF (<eval <
LINK.P.X>+-<CONT.P.X>>>3) || (<eval <CONT.P.X>+-<LINK.P.X>>>3) || (<eval <LINK.P.Y>+-<CONT.P.Y>>>3) || (<eval <CONT.P.Y>+-<LINK.P.Y>>>3)
CONT.SYSMESSAGE @0480 Voce se distanciou muito do animal.
REMOVE
RETURN 1
ENDIF
DORAND 4
Cont
.SAY @<Link.ColorBom <Cont.act.name>
Cont.SAY @<Link.ColorEu vou cuidar bem de voce
Cont
.SAY @<Link.ColorEu sempre desejei um <Cont.act.namecomo voce
Cont
.SAY @<Link.ColorAqui <Cont.act.name>
ENDDO
TIMER
=3
MORE1 
= <MORE1> + 1
RETURN 1
ENDIF
MORE1 0
CONT
.EVENTS -e_sys_taming

if <Eval <Cont.Taming>> < 1000
Cont
.Taming=<Cont.Taming>+0.1
endif

Cont.TAG.CHANCET=<Eval (10-((1000-<Cont.Taming>)/100))+1>
Cont.TAG.PROBABILIDADET=<eval { <Eval <Cont.TAG.CHANCET>> }>


IF (<
CONT.targ.MemoryFindType.MEMORY_IPET.LINK>)
CONT.SYSMESSAGE @0480 Este animal ja esta domesticado.
REMOVE
RETURN 1
ENDIF 

if <Eval <
Cont.TAG0.CHANCET>> == <Eval <Cont.TAG0.PROBABILIDADET>>
SERV.NEWITEM i_memory
NEW.COLOR=042
NEW.LINK=<CONT.UID>
NEW.
CONT=<LINK.UID>
LINK.FLAGS = <LINK.FLAGS> & 08000000
LINK
.ALCHEMY=0
cont
.SYSMESSAGE @0257 Voce conseguiu domesticar <LINK.NAME>.
CONT.CURFOLLOWER += 1
CONT
.TAG.FOLLOW<dCONT.curfollower>=<LINK.UID>
REMOVE
return 1
else
if <Eval <
Cont.Taming>> > <Link.Tag.SKTAMING>
if <Eval <
Cont.TAG0.CHANCET>+1> == <Eval <Cont.TAG0.PROBABILIDADET>>
SERV.NEWITEM i_memory
NEW.COLOR=042
NEW.LINK=<CONT.UID>
NEW.
CONT=<LINK.UID>
LINK.FLAGS = <LINK.FLAGS> & 08000000
LINK
.ALCHEMY=0
cont
.SYSMESSAGE @0257 Voce conseguiu domesticar <LINK.NAME>.
CONT.CURFOLLOWER += 1
CONT
.TAG.FOLLOW<dCONT.curfollower>=<LINK.UID>
REMOVE
return 1
endif
if <Eval <
Cont.TAG0.CHANCET>+2> == <Eval <Cont.TAG0.PROBABILIDADET>>
SERV.NEWITEM i_memory
NEW.COLOR=042
NEW.LINK=<CONT.UID>
NEW.
CONT=<LINK.UID>
LINK.FLAGS = <LINK.FLAGS> & 08000000
LINK
.ALCHEMY=0
cont
.SYSMESSAGE @0257 Voce conseguiu domesticar <LINK.NAME>.
CONT.CURFOLLOWER += 1
CONT
.TAG.FOLLOW<dCONT.curfollower>=<LINK.UID>
REMOVE
return 1
endif
if <Eval <
Cont.TAG0.CHANCET>-1> == <Eval <Cont.TAG0.PROBABILIDADET>>
SERV.NEWITEM i_memory
NEW.COLOR=042
NEW.LINK=<CONT.UID>
NEW.
CONT=<LINK.UID>
LINK.FLAGS = <LINK.FLAGS> & 08000000
LINK
.ALCHEMY=0
cont
.SYSMESSAGE @0257 Voce conseguiu domesticar <LINK.NAME>.
CONT.CURFOLLOWER += 1
CONT
.TAG.FOLLOW<dCONT.curfollower>=<LINK.UID>
REMOVE
return 1
endif
if <Eval <
Cont.TAG0.CHANCET>-2> == <Eval <Cont.TAG0.PROBABILIDADET>>
SERV.NEWITEM i_memory
NEW.COLOR=042
NEW.LINK=<CONT.UID>
NEW.
CONT=<LINK.UID>
LINK.FLAGS = <LINK.FLAGS> & 08000000
LINK
.ALCHEMY=0
cont
.SYSMESSAGE @0257 Voce conseguiu domesticar <LINK.NAME>.
CONT.CURFOLLOWER += 1
CONT
.TAG.FOLLOW<dCONT.curfollower>=<LINK.UID>
REMOVE
return 1
endif
endif
cont.SYSMESSAGE @0480 Voce nao conseguiu domesticar <LINK.NAME>.
CONT.TIMER=-1
CONT
.ACTION=-1
REMOVE
return 1
endif

[Function 
ALTAMING

I don't know setting home..

On=@success
<src.targ.home> = -1,-1

Is this?


RE: Respawn - XuN - 01-13-2014 04:00 AM

Then Alaric's anwser would be the solution, check for homedist or home on tamed npcs (LostNPCTeleport in sphere.ini will teleport them to their home if home.dist > LostNPCTeleport)


RE: Respawn - larmc20 - 01-13-2014 04:08 AM

Thanks. I'll check.

I could create an event to all players.

Just check for me if the HOME.DIST is ok...

[event e_horseback_fix]
ON=@dismount
<argo.home.dist> == -1,-1


RE: Respawn - Alaric - 01-13-2014 04:40 AM

Pet's home is place where the npc sticks around. So, coords.

HOME=coords
HOMEDIST=how far from the home can pet go while wondering

Once you set home to -1,-1 when you tame the npc, you dont have to set it any more. You can also set homedist - I would suggest something around 3 cuz, finding a damn mount when you finally get to your corpse after 20 mins running and then another 10 mins finding your pet which is probably dead, isn't kind of enjoyment.

Code:
on=@success
   src.targ.home=-1,-1

should be ok.

EDIT: Just tried and if home is set -1,-1 then it ignores homedist I guess... NPC goes even further. So, if you don't want them to run away, on=@dismount
argo.home=<argo.p>
argo.homedist=3



RE: Respawn - larmc20 - 01-13-2014 05:13 AM

Thanks