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
Connect Area to Entity
Phoroneus Offline
Member

Posts: 141
Threads: 12
Joined: Feb 2011
Reputation: 0
#1
Connect Area to Entity

Is it possible to parent an area to an entity, e.g. a ScriptArea connected to a grab object or enemy? I haven't been able to via .hps files, so I'm wondering if there's a way to do it in the Model Editor or otherwise. Has anyone managed this kind of thing? And if so, what utility did you use?

[Image: at_9365860.png]

Follow Harvest.
08-14-2011, 07:00 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#2
RE: Connect Area to Entity

I'm stumped. This is all guesswork, but perhaps try a callback between an object and the body of an entity? (as opposed to using an area) To find out what the body name is, open the entity in the model editor, and select the appropriate body. Whatever name it is, tag it to the end of the entity's name in the level editor. For example:

bed_nice_bodynamehere

08-14-2011, 07:28 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#3
RE: Connect Area to Entity

It's impossible to attach an area to an entity (in HPL2). The alternative is to attach an invisible box entity to the target entity and constantly call GetEntitiesCollide() to see if it has collided with another entity of choice. However, this is only for entities that have trouble detecting collision. Otherwise, you can avoid the invisible box and just use GetEntitiesCollide() for the two entities.

Tutorials: From Noob to Pro
(This post was last modified: 08-14-2011, 07:38 PM by Your Computer.)
08-14-2011, 07:35 PM
Website Find
Phoroneus Offline
Member

Posts: 141
Threads: 12
Joined: Feb 2011
Reputation: 0
#4
RE: Connect Area to Entity

I'm working on a workaround right now. The intent is to make a killable enemy that despawns when killed and spawns a ragdoll in its place (this isn't currently for a project but has been bugging me for a while). I'll post the relevant files somewhere if I manage it, or post how to effect the changes.

Meanwhile, I'm also playing around with slight variations on the grunt and brute entities, such as one that is extremely sensitive to sound but nearly blind, one that can see in the dark (which, by the way, is terrifying as hell and I may have to make room for it in my current project), and so on. The "killable" idea is sort of just a continuation of that.
Once I have the differences made up, I'll start working on models that are compatible with the animations and skeletons of the grunt. We haven't really had much by way of custom enemies around here, but at least different appearances ought to be worthwhile.

[Image: at_9365860.png]

Follow Harvest.
(This post was last modified: 08-14-2011, 08:11 PM by Phoroneus.)
08-14-2011, 08:09 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#5
RE: Connect Area to Entity

(08-14-2011, 08:09 PM)Phoroneus Wrote: I'm working on a workaround right now. The intent is to make a killable enemy that despawns when killed and spawns a ragdoll in its place (this isn't currently for a project but has been bugging me for a while). I'll post the relevant files somewhere if I manage it, or post how to effect the changes.

I already have a script that "kills" an enemy, though currently it just makes the enemy go "poof" (i.e. hallucination death). I can post what i have and you can modify it to what you want. If not, i should mention enemies have 0 health by default; giving or setting a health for them does not give them health. Therefore inflicting damage through one of the prop functions will neither kill nor hurt the enemy. My script, however, has a basic monster health system which keeps track of monsters by their names. It starts the enemy off at 100 health and for each "hit" it takes away 20 health.

Tutorials: From Noob to Pro
08-14-2011, 08:39 PM
Website Find
Phoroneus Offline
Member

Posts: 141
Threads: 12
Joined: Feb 2011
Reputation: 0
#6
RE: Connect Area to Entity

<UserDefinedVariables EntitySubType="" EntityType="Enemy_Grunt">
        <Var Name="Health" Value="<whatever>" />
...
</UserDefinedVariables>
Just include that in your .ent file and your enemies will have a health value. "Killing" them only makes them glitch and continue their walk or run or idle animation forever, while they remain in one spot (they still drain sanity when you look at them). They still make sounds, but the active enemy music fades and they are non-solid and do not respond to the player. If I could get them to disappear entirely and be replaced by something else, that would be ideal, but so far no dice.

Also, Blender 2.49b apparently can't export armatures or anything else. I've managed to get the servant_grunt model into Blender and modify it, but it can't export to .dae format. I'm thinking of trying Maya but my hopes are not high (it hasn't been able to import .dae files without a bunch of errors either).

[Image: at_9365860.png]

Follow Harvest.
08-14-2011, 08:51 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#7
RE: Connect Area to Entity

(08-14-2011, 08:51 PM)Phoroneus Wrote: Just include that in your .ent file and your enemies will have a health value. "Killing" them only makes them glitch and continue their walk or run or idle animation forever, while they remain in one spot (they still drain sanity when you look at them). They still make sounds, but the active enemy music fades and they are non-solid and do not respond to the player. If I could get them to disappear entirely and be replaced by something else, that would be ideal, but so far no dice.
The monsters by default have that in the .ent files and set to 100. Yet GetPropHealth() always returned 0 for the monsters for me. This caused me to write my own monster health system. Since it doesn't rely on HPL2 to manage health, there is no apparent glitching of the monsters upon "death." There shouldn't be a problem when spawning a ragdoll version of the monster at the monster with AddAttachedPropToProp().

(08-14-2011, 08:51 PM)Phoroneus Wrote: Also, Blender 2.49b apparently can't export armatures or anything else. I've managed to get the servant_grunt model into Blender and modify it, but it can't export to .dae format. I'm thinking of trying Maya but my hopes are not high (it hasn't been able to import .dae files without a bunch of errors either).
In Blender 2.5 i was able to import and export one of the static objects from Amnesia and have it show up in the level editor. Of course, the object had no materials on it, and i didn't feel like doing anything further with it after that point, though, so i can't tell you how much further you'd be able to get with Blender 2.5.

Tutorials: From Noob to Pro
(This post was last modified: 08-14-2011, 09:22 PM by Your Computer.)
08-14-2011, 09:21 PM
Website Find
Phoroneus Offline
Member

Posts: 141
Threads: 12
Joined: Feb 2011
Reputation: 0
#8
RE: Connect Area to Entity

I have both Blender 2.49 and Blender 2.5. When you put the model into Level Editor, did it show up as just a wireframe (or invisible until selected)? That's what prompted me to get 2.49, since the COLLADA exporter on 2.4x worked with the HPL editor while the newer version in 2.5 doesn't... or didn't when I tried it.

How does your monster health system work? I'd like to try that with AddAttachedPropToProp as you suggested. It'd take out the area step pretty handily.

[Image: at_9365860.png]

Follow Harvest.
08-14-2011, 09:56 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#9
RE: Connect Area to Entity

(08-14-2011, 09:56 PM)Phoroneus Wrote: I have both Blender 2.49 and Blender 2.5. When you put the model into Level Editor, did it show up as just a wireframe (or invisible until selected)? That's what prompted me to get 2.49, since the COLLADA exporter on 2.4x worked with the HPL editor while the newer version in 2.5 doesn't... or didn't when I tried it.
It looked like it did in Blender, that is, with grey faces. In other words, the object with no textures (this only proved a problem when the level editor background had the same color as the object). Aside from that, the position of the object differed from the original. Instead of standing up straight, it was rotated at a 90 degree angle (though that wasn't a problem for me).

(08-14-2011, 09:56 PM)Phoroneus Wrote: How does your monster health system work? I'd like to try that with AddAttachedPropToProp as you suggested. It'd take out the area step pretty handily.
I have an int array which stores the health of the monsters. The index that the monster's health is stored at is based on the int i give to the monster with SetLocalVarInt(); the monster name being the name of the local var. I have two custom functions, GetEnemyHealth() and SetEnemyHealth() which retrieves and modifies the monster's health. These functions pass the monster name (taken from the first string parameter) to GetLocalVarInt(), which is then used to access the current health of the monster from the array. Since GetLocalVarInt() returns 0 if the local var does not exist, you have to manually specify the indexes for each monster in the OnStart() function, which also gives you the chance to specify the default, starting health of the monster.

Tutorials: From Noob to Pro
(This post was last modified: 08-14-2011, 10:29 PM by Your Computer.)
08-14-2011, 10:27 PM
Website Find
Phoroneus Offline
Member

Posts: 141
Threads: 12
Joined: Feb 2011
Reputation: 0
#10
RE: Connect Area to Entity

(08-14-2011, 10:27 PM)Your Computer Wrote: It looked like it did in Blender, that is, with grey faces. In other words, the object with no textures. Aside from that, the position of the object differed from the original. Instead of standing up straight, it was rotated at a 90 degree angle (though that wasn't a problem for me).

That'd be the Y- versus Z- as up discrepancy between Blender and HPL, then. That's good news, actually. I'll give 2.5 a shot and see if I can get it working in-game. 2.4 is nice but having to manually set some of the stuff that 2.5 has already (like different window views and so on) is a pain when it needs to be done every time.

(08-14-2011, 10:27 PM)Your Computer Wrote: I have an int array which stores the health of the monsters. The index that the monster's health is stored at is based on the int i give to the monster with SetLocalVarInt(); the monster name being the name of the local var. I have two custom functions, GetEnemyHealth() and SetEnemyHealth() which retrieves and modifies the monster's health. These functions pass the monster name (taken from the first string parameter) to GetLocalVarInt(), which is then used to access the current health of the monster from the array. Since GetLocalVarInt() returns 0 if the local var does not exist, you have to manually specify the indexes for each monster in the OnStart() function, which also gives you the chance to specify the default, starting health of the monster.

That's pretty brilliant. I'll see if I can emulate it (credit given to you if I end up using it in my project).
Bad news. While I've got the code working properly, enemies do not count as props, so nothing can be attached to them.

Still looking for a solution, if anyone has one. :/

[Image: at_9365860.png]

Follow Harvest.
(This post was last modified: 08-14-2011, 11:02 PM by Phoroneus.)
08-14-2011, 10:33 PM
Find




Users browsing this thread: 1 Guest(s)