////////////////Gauntlet Control///////////////////////

[FUNCTION F_CHECKGAUNTLETPLAYERS]
FORCLIENTS 340
	IF (!(STRCMPI(<REGION.NAME>,Doom Gauntlet))) && (!(<ISGM>))
	LOCAL.PLAYERS ++
	ENDIF
ENDFOR
RETURN <dLOCAL.PLAYERS>

[FUNCTION DOOM_HASTHISPLAYER_INSIDE]
FOR <TAG0.TOTALPLAYERS>
	IF (<TAG0.PLAYER.<dLOCAL._FOR>> == <ARGN1>)
	RETURN 1
	ENDIF
ENDFOR
RETURN 0

[FUNCTION F_RESETDOOMGAUNTLET]
FORINSTANCES i_doom_gauntlet_floor
TRY VAR.LESSERBOSS.<TAG0.LESSERBOSS>=-1
	FOR <TAG0.TOTALPLAYERS>
	TRY TAG.PLAYER.<dLOCAL._FOR>=
	ENDFOR
TAG.TOTALPLAYERS
TAG.3PLAYERTIER
REF1=<TAG0.PENTAGRAM.UID>
REF1.REMOVE
TAG.PENTAGRAM.UID
REF2=<TAG0.DOOR1>
REF3=<TAG0.DOOR2>
REF2.TYPE=T_DOOR_LOCKED
REF2.COLOR=00
	IF (<REF2.TIMER> != -1)
	REF2.TIMERD=1
	ENDIF
REF3.TYPE=T_DOOR_LOCKED
REF3.COLOR=00
	IF (<REF3.TIMER> != -1)
	REF3.TIMERD=1
	ENDIF
	IF (<TAG0.LESSERBOSS> == C_DARKNIGHT_CREEPER)
	VAR.LESSERBOSS.C_DARKNIGHT_CREEPER=0
	REF2.COLOR=0676
	REF3.COLOR=0676
	ENDIF
ENDFOR

[ITEMDEF i_doom_gauntlet_floor]
ID=01822
NAME=Doom

ON=@Create
COLOR=0482
ATTR=ATTR_MOVE_NEVER

ON=@Step
IF (<SRC.ISPLAYER>)
	IF (<VAR0.LESSERBOSS.<TAG0.LESSERBOSS>> == -1)
	RETURN 1
	ELIF (<DOOM_HASTHISPLAYER_INSIDE <SRC>>)
	SRC.GO <TAG0.GOP>
	ELSE
	TAG0.TOTALPLAYERS ++
	TRY TAG.PLAYER.<dTAG0.TOTALPLAYERS>=<SRC>
	TAG0.3PLAYERTIER ++
		IF (<TAG0.3PLAYERTIER> >= 3) || (<TAG0.TOTALPLAYERS> == 1)
		SERV.NEWNPC=<TAG0.LESSERBOSS>
		NEW.P=<TAG0.LESSERBOSS.P>
		NEW.HOME=<NEW.P>
		NEW.HOMEDIST=12
		NEW.UPDATEX
		TRY VAR0.LESSERBOSS.<TAG0.LESSERBOSS>=<EVAL <VAR0.LESSERBOSS.<TAG0.LESSERBOSS>>+1>
		NEW.EVENTS +e_doom_lesser_boss
		NEW.TAG.DOOMFLOOR=<UID>
			IF (<TAG0.TOTALPLAYERS> != 1)
			TAG.3PLAYERTIER
			ENDIF
		ENDIF
	SRC.GO <TAG0.GOP>
	ENDIF
ELSE
	IF (<VAR0.LESSERBOSS.<TAG0.LESSERBOSS>> != -1)
	SRC.GO <TAG0.GOP>
	ENDIF
ENDIF

[ITEMDEF i_doom_darkfather_nopass_floor]
ID=01822
NAME=Dark Father won't pass this point

ON=@Create
COLOR=0482
ATTR=ATTR_MOVE_NEVER|ATTR_INVIS

ON=@Step
IF (!(<SRC.ISPLAYER>))
	IF (<SRC.BASEID> == c_dark_father)
	SRC.GO 423,430,-1,3
	ENDIF
ENDIF

[ITEMDEF i_doom_gauntlet_logout]
ID=i_memory
TYPE=T_EQ_SCRIPT
NAME=Doom Gauntlet Logout Timer

ON=@Timer
CONT.GO 432,334,-1,3
REMOVE
RETURN 1

[EOF]