I need smoke to go after the player.

I need smoke to go after the player.

Postby Samot » Wed Aug 08, 2018 6:03 pm

I'm creating a Portal 2 level where I'm using env_smokestack to simulate a ghost. I'm using a func_tanktrain to make it move during the story. There is one point in the story where I need the ghost to chase down and kill the player (this happens if the player purposefully does something stupid that stops the story from progressing.) My first instincts on accomplishing this was to turn an invisible brush into an NPC, and have the env_smokestack parented to it. Unfortunately, I cannot find any instructions on creating a custom npc character. If anyone knows of a video or written instructions on how to do this, or if there is an easier way to accomplish this, I'd appreciate the info. Thanks.
Check out my Science Fiction novels at http://www.tomawright.com
User avatar
Samot
I was told I would get $60 if I posted on the forum
 
Posts: 21
Joined: Mar 3, 2014

Registered users don't see ads! Register now!
 

Re: I need smoke to go after the player.

Postby Kwinten06 » Sun Aug 12, 2018 2:42 pm

you can use "EnableAlternatePath" of your path_tracks when the "player does something stupid"
There is no other alternative to create Npc than using path_tracks for the moment
(i have a big project involving scripts to create an AI in p2 :1up:)
User avatar
Kwinten06
Defective Turret
 
Posts: 40
Joined: Sep 9, 2015
Location: France

Re: I need smoke to go after the player.

Postby ChickenMobile » Thu Aug 30, 2018 8:23 pm

path_tracks are a point entity right? They could be parented to the player
                             TWP Releases | My Workshop
User avatar
ChickenMobile
Senior Stalemate Associate
 
Posts: 2,440
Joined: May 9, 2011
Location: Canberra, Australia

Re: I need smoke to go after the player.

Postby GusHan » Sat Jan 05, 2019 7:42 am

Did you manage to get this effect, Samot? Seems like a cool idea. I'd love to know how to do this.
GusHan
i dont know what brush is but i herd it alot
 
Posts: 1
Joined: Jan 4, 2019

Re: I need smoke to go after the player.

Postby ChickenMobile » Sun Jan 06, 2019 4:24 am

It is possible to implement this idea using a vscript.

You can change the position and rotation of the ghost by working out the vector between itself and the player then moving it 'x' distance. This is called Linear Interpolation (google lerp function). Because it is a 'ghost' you don't need to figure out any pathing logic - though could still be done using functions like TraceLine(Vector, Vector, handle).

Below is code that would make an object follow the player at 10 units per/s. I used a dynamic model with the think function of think for testing.
Code: Select all
// Speed of movement of the thing
x <- 10

// Set the direction of this entity to face the player
function think() {
   local p = player.GetOrigin()
   local s = self.GetOrigin()
   local d = p - s // The difference between this angles and the players
   self.SetForwardVector(d) // Set the angles of the object to face the placer
   self.SetOrigin(self.GetForwardVector() * x + s) // Move x units forward from original vector
}

See https://developer.valvesoftware.com/wik ... _Functions for a full list of Portal 2 scripting functions.
                             TWP Releases | My Workshop
User avatar
ChickenMobile
Senior Stalemate Associate
 
Posts: 2,440
Joined: May 9, 2011
Location: Canberra, Australia


Return to Hammer and Modding



Who is online

Users browsing this forum: No registered users and 2 guests