I honestly don't know if this worked for you before but to me this is REALLY jumbled. I'm going to give you corrected code and then you can ask questions on the changes I made.
////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "DungeonKey1", "DungeonDoor", "UnlockDungeon", true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
void UnlockDungeon(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Dungeondoor", false, true);
PlaySoundAtEntity("", "unlock_door", "Dungeondoor", 0, false);
RemoveItem("DungeonKey1");
}
void ActivateMonster (string &in item)
{
SetEntityActive("DungeonGrunt", true);
AddEnemyPatrolNode("DungeonGrunt", "PathNodeArea_1", 0, "idle");
AddEnemyPatrolNode("DungeonGrunt", "PathNodeArea_2", 0, "idle");
AddTimer("",30,"DeactivateMonster");
}
void DeactivateMonster (string &in asTimer)
{
SetEntityActive("DungeonGrunt", false);
AddTimer("",10,"ChangeMap"); //I'm not sure what the timer is for, but it needs a function callback. So I made it activate the map change
}
void ChangeMap(string &in asTimer)
{
ChangeMap("Test2.map," "PlayerStartArea_2", "", "");
}
I'm pretty sure this should work, just make sure everything in your level editor is named correctly.
*EDIT*
Someone beat me to it >.<