Hello and welcome to PHPHelp,
do you use pseudo code to plan a project?
if reputation points >= x then NPC attack (class, function or procedure call)
or player enters arena: switch case reputation points NPCattack, default ignore
place a life staus for each character (class, function or procedure)
load and track the life status for each character throughout a level
if life status x (dead) then drop_loot (class, function or procedure call)
not too difficult in theory but coding it is a different story.
maybe search for open source examples will help.
PHP Help has alot of experienced and wise members. maybe someone has more to say.