//****************************************************************************
//SPHERE by : Menasoft ©1997-2000
//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: Sat, Sept 2, 2000 2557-1001 R;338
//

[SPEECH spk_pet]
ON=TRANSFER
IF (<memoryfindtype.memory_war_targ>)
src.sysmessage You can't transfer an animal while it's attacking something.
return 1
ENDIF
IF (<TAG0.SALARY>)
RETURN 1
ENDIF
IF (<ISEVENT.e_animated_dead>) || (<TAG0.NOCONTROL>)
RETURN 1
ENDIF
IF (!(<FLAGS>&STATF_CONJURED))
FINDID.i_pet_rampage.REMOVE
SRC.ANIMALTRANSFER <UID>
ENDIF
RETURN 1

ON=FRIEND
RETURN 1

ON=RELEASE
IF (<ISEVENT.e_animated_dead>) || (<TAG0.NOCONTROL>)
RETURN 1
ENDIF
IF (<TAG0.SALARY>)
RETURN 1
ENDIF

IF (<TAG0.ESCORTED>)
REF1=<FINDID.i_questsys_escorted>
REF2=<REF1.MORE1>
	WHILE (<LOCAL.QUEST> != <REF1.MORE2>)
	LOCAL.QUEST=<REF2.TAG0.QUEST<dLOCAL._WHILE>.ID>
	LOCAL.QUESTRIGHT=<LOCAL._WHILE>
	ENDWHILE
REF2.QUITQUEST <LOCAL.QUESTRIGHT>
RETURN 1
ENDIF

IF (!(<FLAGS>&STATF_CONJURED))
	IF ((<ISEVENT.e_bonded>) && (<FLAGS>&STATF_INVUL))
	SRC.SYSMESSAGE @946,3,1 You can't release a dead bonded animal!
	RETURN 1
	ENDIF
	IF (<memoryfindtype.memory_war_targ>)
	src.sysmessage You can't release a pet that is attacking someone.
	return 1
	ENDIF
TRIGGER @PetDesert
	IF (<TAG0.BONDEDTIME>)
	TAG.BONDEDTIME
	ENDIF
FINDID.i_pet_rampage.REMOVE
RELEASE
RETURN 1
ELSE
RETURN 1
ENDIF

ON=GO
IF (<ISEVENT.e_animated_dead>) || (<TAG0.NOCONTROL>)
RETURN 1
ENDIF
IF (<TAG0.SALARY>)
RETURN 1
ENDIF
IF (<SRC.FLAGS>&STATF_DEAD)
RETURN 1
ENDIF
IF (<BASEID> == c_revenant)
RETURN 1
ENDIF
IF (!(<FLAGS>&STATF_CONJURED))
FLOAT.CONTROLCHANCE=<FLOATVAL (<F_PETCONTROL <REF1>>/100)>
	IF (<FLOAT.CONTROLCHANCE> <= <RANDOMDOUBLE>) && (85 >= <R1,100>)
	MESSAGE @,,2 1043255,<NAME>
	TRIGGER @PetDesert
	RELEASE
	RETURN 1
	ENDIF
ENDIF
FINDID.i_pet_rampage.REMOVE
REMOVEALLMEMS MEMORY_FIGHT
REMOVEALLMEMS MEMORY_WAR_TARG
FLAGS &= ~<DEF.STATF_WAR>
HOME -1,-1

ON=kill
ON=Attack
IF (<TAG0.NOCONTROL>)
RETURN 1
ENDIF
IF (<TAG0.SALARY>)
RETURN 1
ENDIF
IF (<SRC.FLAGS>&STATF_DEAD)
RETURN 1
ENDIF
FINDID.i_pet_rampage.REMOVE
FLAGS |= <DEF.STATF_WAR>

ON=STAY
IF (<ISEVENT.e_animated_dead>) || (<TAG0.NOCONTROL>)
RETURN 1
ENDIF
IF (!(<FLAGS>&STATF_CONJURED))
FLOAT.CONTROLCHANCE=<FLOATVAL (<F_PETCONTROL <REF1>>/100)>
	IF (<FLOAT.CONTROLCHANCE> <= <RANDOMDOUBLE>) && (85 >= <R1,100>)
	MESSAGE @,,2 1043255,<NAME>
	TRIGGER @PetDesert
	RELEASE
	RETURN 1
	ENDIF
ENDIF
FINDID.i_pet_rampage.REMOVE
REMOVEALLMEMS MEMORY_FIGHT
REMOVEALLMEMS MEMORY_WAR_TARG
FLAGS &= ~<DEF.STATF_WAR>
ACTION=064

ON=STOP
IF (<ISEVENT.e_animated_dead>) || (<TAG0.NOCONTROL>)
RETURN 1
ENDIF
IF (!(<FLAGS>&STATF_CONJURED))
FLOAT.CONTROLCHANCE=<FLOATVAL (<F_PETCONTROL <REF1>>/100)>
	IF (<FLOAT.CONTROLCHANCE> <= <RANDOMDOUBLE>) && (85 >= <R1,100>)
	MESSAGE @,,2 1043255,<NAME>
	TRIGGER @PetDesert
	RELEASE
	RETURN 1
	ENDIF
ENDIF
FINDID.i_pet_rampage.REMOVE
REMOVEALLMEMS MEMORY_FIGHT
REMOVEALLMEMS MEMORY_WAR_TARG
FLAGS &= ~<DEF.STATF_WAR>
ACTION=064

ON=DROP
IF (<ISEVENT.e_animated_dead>)
RETURN 1
ENDIF

ON=GUARD ME
IF (<ISEVENT.e_animated_dead>) || (<TAG0.NOCONTROL>)
RETURN 1
ENDIF
IF (!(<FLAGS>&STATF_CONJURED))
FLOAT.CONTROLCHANCE=<FLOATVAL (<F_PETCONTROL <REF1>>/100)>
	IF (<FLOAT.CONTROLCHANCE> <= <RANDOMDOUBLE>) && (85 > <R100>)
	MESSAGE @,,2 1043255,<NAME>
	TRIGGER @PetDesert
	RELEASE
	RETURN 1
	ENDIF
ENDIF
IF (!(<FINDID.i_pet_rampage>))
LOCAL.OLDNEW=<NEW>
SERV.NEWITEM=i_pet_rampage,1,<UID>
NEW.TIMER=1
NEW=<LOCAL.OLDNEW>
ENDIF

ON=GUARD
IF (<ISEVENT.e_animated_dead>) || (<TAG0.NOCONTROL>)
RETURN 1
ENDIF
IF (!(<FLAGS>&STATF_CONJURED))
FLOAT.CONTROLCHANCE=<FLOATVAL (<F_PETCONTROL <REF1>>/100)>
	IF (<FLOAT.CONTROLCHANCE> <= <RANDOMDOUBLE>) && (85 > <R100>)
	MESSAGE @,,2 1043255,<NAME>
	TRIGGER @PetDesert
	RELEASE
	RETURN 1
	ENDIF
ENDIF
IF (!(<FINDID.i_pet_rampage>))
LOCAL.OLDNEW=<NEW>
SERV.NEWITEM=i_pet_rampage,1,<UID>
NEW.TIMER=1
NEW=<LOCAL.OLDNEW>
ENDIF

ON=FOLLOW
ON=COME
IF (<ISEVENT.e_animated_dead>) || (<TAG0.NOCONTROL>)
RETURN 1
ENDIF
IF (!(<FLAGS>&STATF_CONJURED))
FLOAT.CONTROLCHANCE=<FLOATVAL (<F_PETCONTROL <REF1>>/100)>
	IF (<FLOAT.CONTROLCHANCE> <= <RANDOMDOUBLE>) && (85 > <R100>)
	MESSAGE @,,2 1043255,<NAME>
	TRIGGER @PetDesert
	RELEASE
	RETURN 1
	ENDIF
ENDIF
FINDID.i_pet_rampage.REMOVE
REMOVEALLMEMS MEMORY_FIGHT
REMOVEALLMEMS MEMORY_WAR_TARG
FLAGS &= ~<DEF.STATF_WAR>
FACE <SRC.UID>
WALK <DIR>
ACTION=064

[SPEECH spk_hireling]
// Pets that can talk.
ON=ATTACK
ON=BOUGHT
ON=CASH
ON=COME
ON=DEFEND ME
ON=DISMISS
ON=DROP	// "GIVE" ?
ON=DROP ALL
ON=EQUIP
ON=EQUIP ALL
ON=FETCH
ON=FOLLOW
ON=FOLLOW ME

ON=FRIEND
RETURN 1

ON=GET DRESSED
ON=GO
ON=GUARD
ON=GUARD ME
ON=INVENTORY
ON=KILL
ON=PRICE	// may have args ?
ON=RECIEVED
ON=RELEASE
ON=SAMPLES
ON=SPEAK
ON=STATUS
ON=STAY
ON=STAY HERE
ON=STOCK
ON=STOP
ON=SUIT UP
ON=TRANSFER

[SPEECH spk_house_cmds]

[EOF]