07-03-2012, 08:12 PM
It seems simple, but for-the-love-of-god I just CAN'T get it to work. It's delaying my map and pisses me off. I just want a script area set to active when I pick up a rod. Here's my script.
void OnPickup(string &in asEntity, string &in type)
{
if(asEntity == "usekey")
{
StopPlayerLookAt();
}
else if(asEntity == "rod_2")
{
SetEntityActive("spawnmonster", true);
AddEntityCollideCallback("Player", "spawnmonster", "activatethegrunt", true, 1);
}
}
void activatethegrunt(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_4", true);
AddEnemyPatrolNode("servant_grunt_4", "PathNodeArea_13", 0.001, "");
AddEnemyPatrolNode("servant_grunt_4", "PathNodeArea_14", 0.001, "");
AddEnemyPatrolNode("servant_grunt_4", "PathNodeArea_15", 0.001, "");
AddEnemyPatrolNode("servant_grunt_4", "PathNodeArea_16", 0.001, "");
AddEnemyPatrolNode("servant_grunt_4", "PathNodeArea_17", 0.001, "");
}
The rod is called rod_2, the script area is called spawnmonster and is set inactive, the monster is called servant_grunt_4 and the pathnodes have the right name. And yes, the name of the map and the .hps are the same.
void OnPickup(string &in asEntity, string &in type)
{
if(asEntity == "usekey")
{
StopPlayerLookAt();
}
else if(asEntity == "rod_2")
{
SetEntityActive("spawnmonster", true);
AddEntityCollideCallback("Player", "spawnmonster", "activatethegrunt", true, 1);
}
}
void activatethegrunt(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_4", true);
AddEnemyPatrolNode("servant_grunt_4", "PathNodeArea_13", 0.001, "");
AddEnemyPatrolNode("servant_grunt_4", "PathNodeArea_14", 0.001, "");
AddEnemyPatrolNode("servant_grunt_4", "PathNodeArea_15", 0.001, "");
AddEnemyPatrolNode("servant_grunt_4", "PathNodeArea_16", 0.001, "");
AddEnemyPatrolNode("servant_grunt_4", "PathNodeArea_17", 0.001, "");
}
The rod is called rod_2, the script area is called spawnmonster and is set inactive, the monster is called servant_grunt_4 and the pathnodes have the right name. And yes, the name of the map and the .hps are the same.