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
How do I make an enemy spawn when the player enters a script area?
Austums Offline
Member

Posts: 60
Threads: 11
Joined: Mar 2011
Reputation: 0
#2
RE: How do I make an enemy spawn when the player enters a script area?

First make a script area, name it whatever you want.

In your script file under OnStart, put this

AddEntityCollideCallback("Player", "Monster_1", "MonsterFunc1", true, 1);

"Monster_1" is the name of my script area. Change it to whatever yours is called.
"MonsterFunc1" is the name of the function we're going to use later.

Oh, I forgot. Make sure the enemy is "disabled" in the editor. Do this by clicking on the enemy and finding the box called "Active" and click it if it's checked.

Once all that is done, add this to your script

void MonsterFunc1(string &in asParent, string &in asChild, int alState)
{
  SetEntityActive("servant_grunt_1", true);
}

MonsterFunc1 is the name of your function. The string stuff is just randomness and I don't know what they do, but you need them, lol

Replace the name of "servant_grunt_1" with whatever you named your grunt. Voila. Your enemy should appear when you walk into the area script ~_^
(This post was last modified: 04-04-2011, 12:14 AM by Austums.)
04-04-2011, 12:14 AM
Find


Messages In This Thread
RE: How do I make an enemy spawn when the player enters a script area? - by Austums - 04-04-2011, 12:14 AM



Users browsing this thread: 1 Guest(s)