Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Product Chat / Win Zones for NPCs?

Author
Message
Dark_Scorpion
14
Years of Service
User Offline
Joined: 12th May 2012
Location:
Posted: 8th Jun 2012 19:42
I'm in the process of building a map where you have to take out an NPC before he reaches a certain point. Basically, I will create a waypoint for the NPC to follow, and if he reaches a certain grid/point, I want the game to automatically end with a mission failure for you and victory for him. Is there a way to do this with the Win Zones?
Northern
15
Years of Service
User Offline
Joined: 5th Nov 2010
Location: Brazil
Posted: 8th Jun 2012 22:23
Hello Dark_Scorpion,

I think there is not a script ready for it already, because win zone was made for the player not to NPC.

I understand what you want, but I think you should need to create a script coding to do what you want to happen.

Maybe making some modification in the win zone script be an option, but I never tried before.

Cheers,

Northern
Norion
16
Years of Service
User Offline
Joined: 14th Jun 2010
Location: The Netherlands.
Posted: 8th Jun 2012 22:38
Hi Dark Scorpion,

Like Northern said, you have to make your own script to make that happen. But scripting in FPS Creator is very easy. I recommed you to take a look in the scripting tutorials from the Official FPS Creator guide. If you practice a bit, I'll bet you will be scripting within a week.

Good luck with your game,

N.

Flatlander
FPSC Tool Maker
19
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 9th Jun 2012 00:14
Since the NPC is walking a waypoint you can branch the code to another state based on the condition "waypointstate=5". This means that the entity has reached the very end of the waypoint structure.

:waypointstate=5:state=10

Now at state 10 will begin the code to wrap up the game. Whether or not there is a command (could be) to end the game I'm not sure. At least not what you may want. There is an action called "quitgame" which quits the game and goes back to the title page if that is acceptable.

Someone else might be able to give you an idea for ending a game.

"A programmer is just a tool which converts caffeine into code . . . reminds me….. if I had one more brain cell, I could have a synapse! woo hoo, Sparky!

~I'm the Terry of the Flatlands.
Troutflies
15
Years of Service
User Offline
Joined: 24th Feb 2011
Location: Stuck outside my map.
Posted: 9th Jun 2012 00:39
Im thinking that you could also use a trigger and the "anywithinzone" condition to trigger the end of game.

Not great at scripting but I believe it would look something like this.

:state=0,anywithinzone=1:Quitgame,state=1

Now the placement of the tzone is important when using this condition.

Place your waypoints Place the Tzone where you want the NPC to trigger the end of game. Be sure to place the tzone on the floor, When you place tzones or anyzone for that mattre it sits a little off the floor. In order for the anywithinzone to work it has to be level with the map floor. and be sure to not have any other entities close to the zone or they will trigger it.

I haven't tested I am trying to kill time at work.
geistschatten
14
Years of Service
User Offline
Joined: 10th Apr 2012
Location:
Posted: 9th Jun 2012 01:30
What if, and this is just speculating since I don't script, you made a triggerzone that would instantly decrease all your health to zero?

You could easily make a winzone after the triggerzone so if you stop him you can simply reach the end, but if you don't stop him, he'll enter the zone and deplete your lives.

Something similar to plrinzoneactivateused.fpi, but have the activate be your lives decreasing and the plr be the enemy character? I'd have a look at the hurtzone script for help with that.

I like Troutflies idea though!
ncmako
14
Years of Service
User Offline
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 9th Jun 2012 01:31
@Troutflies and anyone else
The "anywithin & anywithinzone" haven't been working right since
1.19. At least from my experience.
Flatlander's method works flawless.
Troutflies
15
Years of Service
User Offline
Joined: 24th Feb 2011
Location: Stuck outside my map.
Posted: 9th Jun 2012 08:57
@nc. I had problems at first with anywithin. But once I put that zone on the floor it worked fine.
Troutflies
15
Years of Service
User Offline
Joined: 24th Feb 2011
Location: Stuck outside my map.
Posted: 9th Jun 2012 08:58
@nc. I had problems at first with anywithin. But once I put that zone on the floor it worked fine. In 119
Dark_Scorpion
14
Years of Service
User Offline
Joined: 12th May 2012
Location:
Posted: 9th Jun 2012 11:04
I have another idea on how this can work, but I need a specific type of door/lock script. I'm familiar with the "onewaydoor" door script from the FPSC community guide, and I've used it, but, the problem with this script is that the door is only locked from the inside, not the outside.

What I could do is, I could have the NPC walk through an open door or auto door. Then, once he gets through the door, the door closes and locks from both sides. Once this happens, the player will be trapped, why? Because he has to kill the NPC in order to get the another door to open, this is the extraction point where his win zone is found, see what I'm saying? Do you guys know of a script where the door automatically opens, and when the player or NPC enters it, it closes and locks from both sides? The FPSC guide script only locks it from the inside, meaning, I could follow the NPC in. I don't want to be able to do this.
Dark_Scorpion
14
Years of Service
User Offline
Joined: 12th May 2012
Location:
Posted: 9th Jun 2012 14:52
Quote: "Im thinking that you could also use a trigger and the "anywithinzone" condition to trigger the end of game.

Not great at scripting but I believe it would look something like this.

:state=0,anywithinzone=1:Quitgame,state=1"


Which script would I add this to?
Dark_Scorpion
14
Years of Service
User Offline
Joined: 12th May 2012
Location:
Posted: 9th Jun 2012 18:27
Quote: "Im thinking that you could also use a trigger and the "anywithinzone" condition to trigger the end of game.

Not great at scripting but I believe it would look something like this.

:state=0,anywithinzone=1:Quitgame,state=1

Now the placement of the tzone is important when using this condition."


I tried using this code, and it works.....sort of. I mean it quits the entire game and takes you back to the desk top. Is there a way to go back to the title screen, or more preferably, the mission failed screen?
Troutflies
15
Years of Service
User Offline
Joined: 24th Feb 2011
Location: Stuck outside my map.
Posted: 9th Jun 2012 22:25
You could make a HUD that says mission failed. Direct the script to display the HUD at the right time. Could probably script it to give you the choice to try again or go to the menu screen. Ill try an come ip with something tonight and post back.
Troutflies
15
Years of Service
User Offline
Joined: 24th Feb 2011
Location: Stuck outside my map.
Posted: 10th Jun 2012 09:36
Just occured to me dark, that the reason it completly quits is your in test mode. Try building a game and running the script and see what happens.
Flatlander
FPSC Tool Maker
19
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 10th Jun 2012 19:46
Quote: "Just occured to me dark, that the reason it completly quits is your in test mode"


I'm 100% sure that you're 100% right. I think.

You can also make your mission failed screen and replace the title hud (screen) with that and let FPSC go it's proper course. You'll have to make sure that there is at least a quit game option or both a load and quit game option.

"A programmer is just a tool which converts caffeine into code . . . reminds me….. if I had one more brain cell, I could have a synapse! woo hoo, Sparky!

~I'm the Terry of the Flatlands.
Dark_Scorpion
14
Years of Service
User Offline
Joined: 12th May 2012
Location:
Posted: 11th Jun 2012 01:23
Quote: "I'm 100% sure that you're 100% right. I think.

You can also make your mission failed screen and replace the title hud (screen) with that and let FPSC go it's proper course. You'll have to make sure that there is at least a quit game option or both a load and quit game option."


What code/script would I use to do this?
Dark_Scorpion
14
Years of Service
User Offline
Joined: 12th May 2012
Location:
Posted: 11th Jun 2012 01:25
Quote: "Just occured to me dark, that the reason it completly quits is your in test mode. Try building a game and running the script and see what happens. "


I ran a test on the exe, when the NPC reaches the trigger zone the game completely quits to the desktop. I would like it to go to the "mission failed" screen instead. How would I modify the code to allow this?
ncmako
14
Years of Service
User Offline
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 11th Jun 2012 02:10
@Troutflies
Thanx for the tip, lowering the zones seems to have helped.
Also, try changing "Quitgame" to "newgame". Newgame takes you back to menu. Seems to work for me that way. (1.20 beta2)
Flatlander
FPSC Tool Maker
19
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 11th Jun 2012 02:24 Edited at: 11th Jun 2012 18:34
You'd think I'm old enough to realize to never say 100%. At least I'm not a gambler because I would be in the poor-house by now. I usually test these things myself before I commit. Why I didn't, I don't know. Dark_Scorpion, maybe your just meant to to continue tob in a state of confusion, I don't know.

I not only tested now myself which showed that, yes, it does quit out completely. I then looked at the code and again it is coded to do that.

This means that before you issue the quitgame command, you will need to show a "mission failure" hud. It would be something like this. I'm just using a player triggering zone to make it simple for the test.



Each 1000 milliseconds equals 1 second. So hud would show 5 seconds for the example. You can also include an audio if you want. You might want to make the hud full screen. Current default for screen is 1024x768.

"A programmer is just a tool which converts caffeine into code . . . reminds me….. if I had one more brain cell, I could have a synapse! woo hoo, Sparky!

~I'm the Terry of the Flatlands.
Flatlander
FPSC Tool Maker
19
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 11th Jun 2012 06:46 Edited at: 11th Jun 2012 18:33
Nevermind!

"A programmer is just a tool which converts caffeine into code . . . reminds me….. if I had one more brain cell, I could have a synapse! woo hoo, Sparky!

~I'm the Terry of the Flatlands.
BlackFox
FPSC Master
18
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 11th Jun 2012 07:07 Edited at: 11th Jun 2012 07:09
Quote: "Newgame takes you back to menu. Seems to work for me that way."


It does, and even in the previous versions. If you want to go back to the main menu of the game when "failing a mission", use "newgame". If you want the game to exit completely, use "quitgame". Regardless of the two commands you use, it will always exit when in the editor.


Twitter: @NFoxMedia
Dark_Scorpion
14
Years of Service
User Offline
Joined: 12th May 2012
Location:
Posted: 11th Jun 2012 13:26
Quote: "Here is a video of what I tested complete with hud and audio. I used my standard test room."


Flatlander, your script looks good, but I needed to modify it a bit to get it to work the way I want:

[;Artificial Intelligence Script

;Header

desc = quitgame

;Triggers

:state=0:hudreset,hudx=50,hudy=50,hudsizex=1024,hudsizey=768,hudimagefine=texturebank\user\mission_failure.tga,hudname=mission_failure,hudhide=1,hudmake=display
:state=0,anywithinzone=1:music=audiobank\music\ww2\main.wav,state=10
:state=10:hudshow=mission_failure,timerstart,state=20
:state=20,timergreater=10000:quitgame,state=30
:state=30:none


;End of Script]

With your script, the player would end the game, but I switched it to "anywithinzone" so that way the NPC could trigger it. I appreciate the help guys.

Login to post a reply

Server time is: 2026-07-06 14:18:09
Your offset time is: 2026-07-06 14:18:09