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


Post Reply 
 
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Entity-connected lights and areas (solved)
Author Message
Phoroneus Offline
Member

Posts: 141
Joined: Feb 2011
Reputation: 0
Post: #1
Question Entity-connected lights and areas (solved)

Hello all, I've been using the forum search to answer my questions thus far with great success (and the Script Functions page of the wiki with even greater success) but I've been unable to find a solution to my latest problem, and am wondering if anyone else has managed it or if such a thing is even possible in the HPL2 engine.

I'm currently working on a custom story entitled "Whiteout", and a major mechanic in the introductory map is the cold, which will gradually freeze the player to death if (s)he does not find a place of relative warmth*. Towards the end of the map, the player is able to place an ember into a bucket and carry it around as a mobile source of warmth and light (and therefore sanity), allowing them greater freedom of movement and less time spent running between warm spots.

My issue is that I have been thus far unable to move the ember's light and warmth area with the ember, which uses the Coal entity and physics to better simulate actually moving a very hot object rather than sticking it in the player's inventory (in fact, touching it with one's hand burns the player).

If there were a way to do this with a light (hypothetically "EmberLight"), area ("WarmArea") and entity ("Ember"), how might it be done? And would it utilize primarily the Level Editor, script, or should I modify the entity's properties in the Model Editor (I am comfortable with this, though I have relatively little experience with model editing).

Thanks in advance for any help. I can post snippets of code or whatnot as needed.


*I realized later just how similar this was to the opening scene in Penumbra: Overture. The scene itself is very different, but the freezing mechanic is apparently not an original concept... which may be why it was so simple to implement.


EDIT: I have been able to attach a light using the model editor. The area remains a challenge.
Alternately, is there a way to check the player's distance from an object via scripts? For example,
if (GetEntityDistance("Player", "Ember") >= 3)
{
//Do stuff.
}
else
{
//Do other stuff.
}
or something similar? I believe that would be even easier to work with, but I can't find anything along those lines on the Script Functions page. Undecided

Answered my own question. There isn't a script designed to perform such a check. It might come down to filling the entire map with script areas and damaging the player if they're not in the same area as the ember, but GetEntitiesCollide doesn't appear to function in the way I thought it did. Confused So I'm rather stuck. Any help or suggestions appreciated.

[Image: at_9365860.png]

Follow Harvest.
(This post was last modified: 02-02-2011 03:04 AM by Phoroneus.)
02-01-2011 05:16 PM
Find all posts by this user Quote this message in a reply
Frontcannon Offline
Senior Member

Posts: 538
Joined: Jul 2010
Reputation: 2
Post: #2
RE: Entity-connected lights and areas (1 of 2 solved)

Not wanting to burst your bubble, but if you can't find anything in the script functions, it'll most likely not work the way you want it, as there is no way of connecting areas to an entity.

Maybe use AttachPropToProp (?), but I have no idea how that one works.


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
02-01-2011 10:06 PM
Find all posts by this user Quote this message in a reply
Phoroneus Offline
Member

Posts: 141
Joined: Feb 2011
Reputation: 0
Post: #3
RE: Entity-connected lights and areas (1 of 2 solved)

(02-01-2011 10:06 PM)Frontcannon Wrote:  Not wanting to burst your bubble, but if you can't find anything in the script functions, it'll most likely not work the way you want it, as there is no way of connecting areas to an entity.

Maybe use AttachPropToProp (?), but I have no idea how that one works.
Thought of that. AttachPropToProp only appears to work on non-area entities like furniture and such, as it wasn't moving the script areas at all, unfortunately.

I also tried adding a non-solid area to the ember (just a modified coal entity) that would collide with the player when they were within a certain range, but that didn't seem to have any effect at all (of course I'm new to modeling outside of ProE and the Model Editor in particular, so that was hardly surprising).

I'm currently attempting to get it to work by setting up lots of overlapping 3m by 3m areas throughout the map and assigning each a number, then changing two variables ("EmberLoc" and "PlayerLoc") depending on which area they're in, then comparing the numbers to find out if they're in the same area and determining whether the player is within range of the ember by that method. It's inelegant as all hell, but it appears to be the only option given the limitations.

EDIT: And it works, to a degree. It'll require a lot of tweaking and adjusting before it's playable, but at least it's proof of concept. Thanks anyway Frontcannon. Smile

[Image: at_9365860.png]

Follow Harvest.
(This post was last modified: 02-01-2011 10:37 PM by Phoroneus.)
02-01-2011 10:16 PM
Find all posts by this user Quote this message in a reply
Frontcannon Offline
Senior Member

Posts: 538
Joined: Jul 2010
Reputation: 2
Post: #4
RE: Entity-connected lights and areas (1 of 2 solved)

No problem, it's refresing to see a post here that doesn't just say 'Help it doesn't work!! Sad'.

Just make sure if the player depends on the ember that he can't lose it somewhere in the map! Because if he could you'd have to spawn a new one, with a new set of areas etc. Or try for-loops.


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
02-01-2011 11:21 PM
Find all posts by this user Quote this message in a reply
Phoroneus Offline
Member

Posts: 141
Joined: Feb 2011
Reputation: 0
Post: #5
RE: Entity-connected lights and areas (1 of 2 solved)

(02-01-2011 11:21 PM)Frontcannon Wrote:  Or try for-loops.

This sounds like a very good idea. And thus far I've been unable to lose the ember, but I know players and if there is a way, they will find it. Dodgy I'm thinking of creating an ember-spawner as a prophylactic measure.

I took a break and I've been messing with the Model Editor, which seems promising. I'll report any findings in case anyone else ends up needing something similar.

[Image: at_9365860.png]

Follow Harvest.
02-02-2011 12:22 AM
Find all posts by this user Quote this message in a reply
jens Offline
Frictional Games

Posts: 4,095
Joined: Apr 2006
Reputation: 202
Post: #6
RE: Entity-connected lights and areas (solved)

I think you could make a big body that does not physically collide, but works to use with addcollideentitycallback. So if you set a variable when you have added the ember to the bucket, you could then check the players in/out collision with the big body of the bucket to know if he is in or outside the light (the body would be like an area).

At least in Penumbra overture we have one place with a big rock rolling over the player, and to be sure there was no hiccup the entity does not collide physically with the player, but there is an addcollideentitycallback to check if the entity has rolled over the player.

Amnesia is a little bit different so could be this idea does not work any longer.
02-02-2011 06:49 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Phoroneus Offline
Member

Posts: 141
Joined: Feb 2011
Reputation: 0
Post: #7
RE: Entity-connected lights and areas (solved)

(02-02-2011 06:49 AM)jens Wrote:  I think you could make a big body that does not physically collide, but works to use with addcollideentitycallback. So if you set a variable when you have added the ember to the bucket, you could then check the players in/out collision with the big body of the bucket to know if he is in or outside the light (the body would be like an area).

At least in Penumbra overture we have one place with a big rock rolling over the player, and to be sure there was no hiccup the entity does not collide physically with the player, but there is an addcollideentitycallback to check if the entity has rolled over the player.

Amnesia is a little bit different so could be this idea does not work any longer.

Thanks Jens. I changed my method to an inventory-based one, and actually got it to work just now (was coming back to put [SOLVED] on my other post) but originally considered your idea. I wasn't able to get the big body to register, or anything to register for that matter, using GetEntitiesCollide. No matter what I tried, it always returned false. :/

Even so, I ended up learning more than I originally would have, so all in all I'd say it was more a blessing in disguise than anything else.

[Image: at_9365860.png]

Follow Harvest.
02-02-2011 06:57 AM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)