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
Spawning entity where player is looking
Topsu Offline
Junior Member

Posts: 12
Threads: 3
Joined: Mar 2012
Reputation: 0
#1
Spawning entity where player is looking

Is there any way to do something like this:

Players walks throught area1, it spawns a grunt, when grunt walks to area2 an entity is spawned in front of the player. (Where player is looking, right in front of him.)
06-02-2012, 07:58 PM
Find
lolboy9797 Offline
Junior Member

Posts: 29
Threads: 8
Joined: May 2012
Reputation: 1
#2
RE: Spawning entity where player is looking

im not sure if this will work but: add a line "AddEntityCollideCallback("Player", "blar", "bla", true, 1);"
you can try to change Player to the name of the Entity. yo can also use "StartPlayerLookAt" to make it look at an entity.
(This post was last modified: 06-02-2012, 08:07 PM by lolboy9797.)
06-02-2012, 08:03 PM
Find
Topsu Offline
Junior Member

Posts: 12
Threads: 3
Joined: Mar 2012
Reputation: 0
#3
RE: Spawning entity where player is looking

(06-02-2012, 08:03 PM)lolboy9797 Wrote: im not sure if this will work but: add a line "AddEntityCollideCallback("Player", "blar", "bla", true, 1);"
you can try to change Player to the name of the Entity. yo can also use "StartPlayerLookAt" to make it look at an entity.
But I want to spawn the entity where the player is facing, not spawn entity and make player look at it.

Also I know how to do the AddEntityCollideCallback things, the problem is how I spawn entity where player is facing.
06-02-2012, 09:19 PM
Find
Theforgot3n1 Offline
Member

Posts: 192
Threads: 20
Joined: Apr 2012
Reputation: 6
#4
RE: Spawning entity where player is looking

I could be wrong, but I don't think it is possible to spawn the grunt at where the player is looking. You can only have a grunt spawn where you want him to WHEN the player looks at that location.

You should urge the player to look at a location by having some sort of light or escape route, and then spawn the grunt there. Try to predict where the player will look and be.

Confusion: a Custom Story - Ch1 for play!
http://www.frictionalgames.com/forum/thread-15477.html
About 50% built.
Delayed for now though!
06-02-2012, 10:19 PM
Website Find
Topsu Offline
Junior Member

Posts: 12
Threads: 3
Joined: Mar 2012
Reputation: 0
#5
RE: Spawning entity where player is looking

Oh ok, But what about I set few areas and when you look at one it spawns entity there and the other areas set innactive or are removed? Any tips for doing that?

Ofcourse at the direction player is looking at and like 1 meter away spawning entity would be best. :/
(This post was last modified: 06-03-2012, 02:37 AM by Topsu.)
06-03-2012, 02:24 AM
Find
Theforgot3n1 Offline
Member

Posts: 192
Threads: 20
Joined: Apr 2012
Reputation: 6
#6
RE: Spawning entity where player is looking

(06-03-2012, 02:24 AM)Topsu Wrote: Oh ok, But what about I set few areas and when you look at one it spawns entity there and the other areas set innactive or are removed? Any tips for doing that?

Ofcourse at the direction player is looking at and like 1 meter away spawning entity would be best. :/
Try to have the "Area1" about 1 meter in front of the Player, when he looks at it, by predicting movements and doing distractions, etc.
void OnEnter()
{
SetEntityPlayerLookAtCallback("Area1", "SpawnEntity", true);
}

void SpawnEntity(string &in asEntity, int alState)
{
SetEntityActive("servant_grunt1",true);
SetEntityActive("area2",false);
SetEntityActive("area3",false);
}

Confusion: a Custom Story - Ch1 for play!
http://www.frictionalgames.com/forum/thread-15477.html
About 50% built.
Delayed for now though!
(This post was last modified: 06-03-2012, 05:35 PM by Theforgot3n1.)
06-03-2012, 05:35 PM
Website Find




Users browsing this thread: 1 Guest(s)