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
Enemy spawning at an area
SLAMnesia Offline
Member

Posts: 99
Threads: 39
Joined: May 2011
Reputation: 0
#1
Enemy spawning at an area

Im sure there have been threads similar to this one before, but I've searched with no avail. so heres my problem, its simple and do able i just dont know how:

How do I make an enemy (water lurker) spawn/activate when I enter an area? I also want the player to look at the enemy but not lock the screen on the lurker cuz you'll need to turn and run.
i made the area and lurker heres the names
Area:lurkerspawn
lurker:rawr

any help is 200% appreciated thanks, as you can probably tell im relatively new to this stuff
<3
05-26-2011, 06:25 AM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#2
RE: Enemy spawning at an area

To activate the entity, add a collide callback involving the player and a designated trigger area. Add this function to your OnStart:
AddEntityCollideCallback("Player", "area_trigger_entity", "TriggerFunction", true, 1);

//-------------------------
To make the player look at it, place this function under TriggerFunction:
StartPlayerLookAt("water_lurker", 3.0, 3.0, "LurkerSeen");

//------------------------

Lastly, add a third function, LurkerSeen, and place this function under it:
StopPlayerLookAt();

//------------------------

If you have trouble piecing together your script post another reply, I'll lay out an entire script for you.

(This post was last modified: 05-26-2011, 08:29 AM by palistov.)
05-26-2011, 08:29 AM
Find
xtron Offline
Senior Member

Posts: 402
Threads: 37
Joined: May 2011
Reputation: 2
#3
RE: Enemy spawning at an area

Spoiler below!

void OnStart()
{
AddEntityCollideCallback("Player" , "lurkerspawn" , "spawn_water_lurker" , true , 1);
}

void spawn_water_lurker(string &in asEntity)
{
SetEntityActive("rawr", true);
StartPlayerLookAt("rawr", 10, 50, "");
AddTimer("", 0.5f, "TimerSlamDoor");
}

void TimerSlamDoor(string &in asTimer)
{
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
AddTimer("", 1.0f, "TimerStopLook");
}

void TimerStopLook(string &in asTimer)
{
StopPlayerLookAt();
}


Now. When you enter the "lurkerspawn" area the function "spawn_water_lurker" will get activated and a breathing sound will be played and the lurker named "rawr" will spawn and then your screen will automaticly move and look at "rawr" for 1sec then return to normal.

[Image: 44917299.jpg]Dubstep <3
(This post was last modified: 05-26-2011, 05:58 PM by xtron.)
05-26-2011, 05:58 PM
Find




Users browsing this thread: 1 Guest(s)