RE: Stephen Rimmer's Alpha Mail Alpha Adventure [WIP with links] 
			 
			
				//////////////////////////// 
// Run when entering map 
void OnEnter() 
{ 
AutoSave(); 
AddEntityCollideCallback("Player", "scarearea1", "startscare", true, 1); 
AddCombineCallback("hammer_and_chipper", "stone_hammer_1", "stone_chipper_1", "CombineHammerAndChipper", true); 
AddUseItemCallback("MeltPadlock", "glass_container_filled", "padlock_worn", "MeltPadlock", true); 
AddUseItemCallback("BreakLock", "stone_hammer_chipper", "padlock_acid_used", "BreakLock", true); 
AddUseItemCallback("", "glassjar", "acid_container_1", "filljar", true); 
AddUseItemCallback("", "servantskey", "headservantroom", "openservantdoor", true); 
SetEntityPlayerInteractCallback("stone_hammer_1", "spawnmen", true); 
} 
 
void openservantdoor(string &in asItem, string &in asEntity) 
{ 
SetSwingDoorLocked("headservantroom", false, true); 
PlaySoundAtEntity("", "unlock_door.snt", "headservantroom", 0, false); 
RemoveItem("servantskey"); 
} 
 
void spawnmen(string &in asParent, string &in asChild, int alState) 
{ 
SetEntityActive("hammergrunt", true); 
AddEnemyPatrolNode("hammergrunt", "headservant", 0.0f, ""); 
AddEnemyPatrolNode("hammergrunt", "headservant_1", 0.0f, ""); 
AddEnemyPatrolNode("hammergrunt", "headservant_2", 0.0f, ""); 
AddEnemyPatrolNode("hammergrunt", "headservant_3", 0.0f, ""); 
AddEnemyPatrolNode("hammergrunt", "headservant_4", 0.0f, ""); 
AddEnemyPatrolNode("hammergrunt", "headservant_5", 0.0f, ""); 
AddEnemyPatrolNode("hammergrunt", "headservant_6", 0.0f, ""); 
AddEnemyPatrolNode("hammergrunt", "headservant_7", 0.0f, ""); 
AddEnemyPatrolNode("hammergrunt", "headservant_8", 0.0f, ""); 
AddEnemyPatrolNode("hammergrunt", "headservant_9", 0.0f, ""); 
CheckPoint("checkhammergrunt", "checkpoint1", "CheckPoint01", "Misc", "servdeath"); 
} 
 
//void CheckPoint01(string &in asName, int alCount) 
//{ 
	//SetPlayerHealth(RandFloat(80,90)); 
	//SetPlayerSanity(RandFloat(40,60)); 
//} 
 
void startscare(string &in asParent, string &in asChild, int alState) 
{ 
AddPropImpulse("scarehammer", 10, 5, -5, "World"); 
GiveSanityDamage(10, true); 
SetLampLit("scarecandle", false, true); 
SetLampLit("scarelantern", false, true); 
SetLanternActive(false, false); 
PlayGuiSound("react_scare", 1.0f); 
} 
 
void CombineHammerAndChipper(string &in asItem) 
{ 
	 
	if(asItem == "stone_hammer_1" && HasItem("stone_chipper_1")){  
	 
		RemoveItem("stone_chipper_1"); 
		RemoveItem("stone_hammer_1"); 
		 
		GiveItem("stone_hammer_chipper", "Puzzle", "stone_hammer_chipper", "stone_hammer_chipper.tga", 0);	 
	} 
	else if(asItem == "stone_chipper_1" && HasItem("stone_hammer_1")){  
		 
		RemoveItem("stone_chipper_1"); 
		RemoveItem("stone_hammer_1"); 
		 
		GiveItem("stone_hammer_chipper", "Puzzle", "stone_hammer_chipper", "stone_hammer_chipper.tga", 0);	 
	} 
} 
 
void MeltPadlock(string &in asItem, string &in asEntity) 
{ 
	SetEntityActive("padlock_worn", false); 
	SetEntityActive("padlock_acid_used", true); 
	RemoveItem(asItem); 
	SetMessage("Levels", "LockWeak", 0); 
} 
 
void filljar(string &in asItem, string &in asEntity) 
{ 
	if(asItem == "glassjar"){ 
		PlaySoundAtEntity("fillbottle", "puzzle_acid_success", asEntity, 1.0f, false); 
		RemoveItem(asItem); 
		GiveItemFromFile("glass_container_filled", "glass_container_filled.ent"); 
		SetMessage("Levels", "AcidInJar", 0); 
	}  
	else if(asItem == "glass_container_filled"){ 
		SetMessage("Levels", "AcidAlreadyInJar", 0); 
	}  
} 
 
void BreakLock(string &in asItem, string &in asEntity) 
{ 
              SetSwingDoorLocked("prisongate1", false, true); 
	SetEntityActive("padlock_acid_used", false); 
	GiveSanityBoostSmall(); 
} 
 
//////////////////////////// 
// Run when leaving map 
void OnLeave() 
{ 
}
			 
			
			
			
		 |