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
Scripting around a (disappearing) enemy
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#1
Scripting around a (disappearing) enemy

Okay this is kind of a broad problem I've been having with scripting around enemies. A few of my scripts are based around enemies going to a certain place or doing a certain thing, but when the enemy disappears before it can accomplish this, it causes me lots of problems. In some cases I've managed to work around it, but in others it's purely aggravating.

I know there have got to be ways to work around this. I remember that in the main game, no matter what I did that first grunt in the Storage area would not disappear.

Here's the latest example:

In my newest map, the player has to lure an enemy into a certain area in order to trap it. Once it's trapped, it triggers a script necessary to advance in the game. Most of the time, it's not a problem; the map is very small and it's scripted to patrol around an area very close to the trap.

However, if for example it spots the player right when it spawns and the player quickly runs to the other end of the map before it can give chase, the conditions will be just right for the monster to disappear. Then the player can't advance in the game.

I'm trying really hard to find a workaround, but I can't seem to find a way. I can't find a way to stop the enemy from disappearing, and I can't find a way to respawn it in case it does disappear. I've tried using GetEntityExists, but it seems to detect the enemy even when it's disappeared.

Any ideas, fellas?

(This post was last modified: 10-24-2012, 05:30 PM by Damascus.)
10-23-2012, 06:17 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Scripting around a (disappearing) enemy

http://www.youtube.com/watch?v=xWPU6frXm...0C8#t=584s

Tutorials: From Noob to Pro
10-23-2012, 06:33 AM
Website Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#3
RE: Scripting around a (disappearing) enemy

But YC if you give it a pathnode, it will disappear when it has done the pathnode

Trying is the first step to success.
10-23-2012, 07:01 AM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#4
RE: Scripting around a (disappearing) enemy

Is it neccessary to add the PathNodes one by one as it reaches each PathNode?

I currently have it follow six pathnodes in a circle, and then have a Script Area add them again when it reaches the beginning of the circle. I usually use for loops, but thought this would be a better way to keep it from disappearing. Is this acceptable, or do I have to add them one by one like you did in your video?

Also, I'm not sure if it matters, but when it disappeared on me, it hadn't even reached its first PathNode yet. It had just spawned and was headed toward its node when it spotted me and I ran. I sat and waited for it to arrive at its node, but it disappeared. Maybe this doesn't matter, as the grunt in your video seemed to disappear before it reached its destination too.

Also damn I wish my dev/debug mode worked. Making a custom story of this length is hard without it.

(This post was last modified: 10-23-2012, 07:31 AM by Damascus.)
10-23-2012, 07:26 AM
Find
Ongka Offline
Member

Posts: 225
Threads: 3
Joined: Nov 2010
Reputation: 20
#5
RE: Scripting around a (disappearing) enemy

ModelEditor -> Open servant_grunt.ent -> Settings -> User defined variables -> PlayerSearchTime -> Change this value and play around with the other values too to ensure that the grunt won't despawn.

[Image: 18694.png]
10-23-2012, 07:33 AM
Find
Dutton Offline
Member

Posts: 121
Threads: 3
Joined: Apr 2012
Reputation: 2
#6
RE: Scripting around a (disappearing) enemy

(10-23-2012, 07:33 AM)Ongka Wrote: ModelEditor -> Open servant_grunt.ent -> Settings -> User defined variables -> PlayerSearchTime -> Change this value and play around with the other values too to ensure that the grunt won't despawn.
This could cause some problems when he's going to make other grunt encounters, when and how would they now dissapear?

[Image: 15isy6C]
10-23-2012, 08:46 AM
Find
Ongka Offline
Member

Posts: 225
Threads: 3
Joined: Nov 2010
Reputation: 20
#7
RE: Scripting around a (disappearing) enemy

He doesn't have to replace the original one, he can save it as grunt_2 or whatever he wants. And even if he would replace it (bad idea), he still could script that the grunt has to disappear after a specific time or when he reaches a pathnode.

[Image: 18694.png]
10-23-2012, 09:13 AM
Find
Dutton Offline
Member

Posts: 121
Threads: 3
Joined: Apr 2012
Reputation: 2
#8
RE: Scripting around a (disappearing) enemy

(10-23-2012, 09:13 AM)Ongka Wrote: he can save it as grunt_2
Forgot everything about that, well then it might actually be a solution, my mistake, i apologise ^^

[Image: 15isy6C]
10-23-2012, 09:16 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#9
RE: Scripting around a (disappearing) enemy

(10-23-2012, 07:01 AM)beecake Wrote: But YC if you give it a pathnode, it will disappear when it has done the pathnode

Why would it disappear when reaching the last path node when you edited the ENT file for it not to do so?

Tutorials: From Noob to Pro
10-23-2012, 07:28 PM
Website Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#10
RE: Scripting around a (disappearing) enemy

(10-23-2012, 07:28 PM)Your Computer Wrote:
(10-23-2012, 07:01 AM)beecake Wrote: But YC if you give it a pathnode, it will disappear when it has done the pathnode

Why would it disappear when reaching the last path node when you edited the ENT file for it not to do so?
My monster happened to do so... But i might be wrong. You're nearly always right YC Smile

Trying is the first step to success.
10-23-2012, 08:03 PM
Find




Users browsing this thread: 3 Guest(s)