Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Making monster go away
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#4
RE: Making monster go away

Right, here we go:

////////////////////////////////
//Run when starting the map
void OnStart()
{
AddEntityCollideCallback("Player", "MonsterActive_Area", "MonsterActive", true, 1); //When the player collides with "MonterActive_Area", run function "MonsterActive". True means delete on use (i.e will only be called once. If you want to go through the monster part again even if you die, switch the false to true and it will call the function every time you enter it.) and the 1 means that it should run the function when you first enter the script area. (-1 is on leave, 0 is both iirc)
AddEntityCollideCallback("Monster", "MonsterGone_Area", "MonsterGone", true, 1); //When the entity "Monster" collides with "MonsterGone_Area", run function MonsterGone. true and 1 are the same as before.
}

void MonsterActive(string &in asParent , string &in asChild , int alState) //Pay extra attention to the part in parentheses, according to the script functions wiki page the AddEntityCollideCallback has a callback syntax of the stuff in parantheses. By adding this to the function you want to call, the first callback will know how to run it. (Or something like that)
{
  SetEntityActive("Monster", true); //Sets the entity "Monster" to active.
  AddEnemyPatrolNode("Monster", "MonsterPath_1", 2, ""); // "Monster" walks to "MonsterPath_1" from his previous position, and stays there for two seconds.
  AddEnemyPatrolNode("Monster", "MonsterPath_2", 2, ""); // "Monster" walks to "MonsterPath_2" from his previous position, and stays there for two seconds.
  AddEnemyPatrolNode("Monster", "MonsterPath_3", 2, ""); // "Monster" walks to "MonsterPath_3" from his previous position, and stays there for two seconds.
  AddEnemyPatrolNode("Monster", "MonsterPath_4", 5, ""); // "Monster" walks to "MonsterPath_4" from his previous position, and stays there for two seconds.
  AddEnemyPatrolNode("Monster", "MonsterPath_5", 5, ""); // "Monster" walks to "MonsterPath_5" from his previous position, and stays there for two seconds. In this case, this path would have to move the monster through the area called "MonsterGone_Area", calling the MonsterGone function.
  PlayGuiSound("enemy/brute/enabled04.ogg", 1.0f); //Plays "enabled04.ogg" with a fade of 1.0f.
}

void monstergone(string &in asParent , string &in asChild , int alState) //Same callback as before - same syntax.
{
FadeEnemyToSmoke("Monster", true); //Fades the monster to smoke. It will be gone forever.
}


That should do it, all the stuff in quotes will need to be named exactly like in the script, so be sure to either switch the names of the entities, paths, areas, etc, to the script names, or vice versa.

"//" Means that it is a comment explaining what each part does, and will not have any effect on the script.

If I didn't mess something up, it should function if you did your part correctly. Good luck! Please respond if you're getting any error and I'll fix it Smile
(This post was last modified: 05-03-2011, 03:44 PM by Roenlond.)
05-03-2011, 03:43 PM
Find


Messages In This Thread
Making monster go away - by Dominic0904 - 05-03-2011, 12:46 PM
RE: Making monster go away - by Roenlond - 05-03-2011, 01:57 PM
RE: Making monster go away - by Dominic0904 - 05-03-2011, 02:01 PM
RE: Making monster go away - by Roenlond - 05-03-2011, 03:43 PM
RE: Making monster go away - by Dominic0904 - 05-03-2011, 11:49 PM



Users browsing this thread: 1 Guest(s)