Scripts / Security camera alert the enemies

Author
Message
Old Larry
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 2nd Apr 2015 12:58 Edited at: 2nd Apr 2015 13:45
Security Camera watch and alert enemies automatically when player enter the zone then it closes when player leaves the zone.



And here is the script for that Security Camera:
Save the script as "securitycam.lua"


The sound for alarm is made by me, so you can use it free
I can give you just the fpe file for that security camera, for the dds and x file you must contact the owner
or to download from the old FPSC the pack containing the animated camera.
Smile today, tomorrow could be worse

http://bestradiolarry.ro/fpsarea/

"The best forum, game software, operating system or web platform, it's that software which can give you most of the features and speed, not just amazing graphics."

Attachments

Login to view attachments
HarryWever
3D Media Maker
14
Years of Service
User Offline
Joined: 14th Jan 2010
Location: below Sea level
Posted: 2nd Apr 2015 14:20
Thanks Old Larry,
Nice script..

Cheers
harry
Harry
PM
JC LEON
14
Years of Service
User Offline
Joined: 22nd Apr 2010
Location:
Posted: 2nd Apr 2015 14:27
cool ...thanks larry
PC Specs:

Q9550@3,8GHZ - 8GB RAM - SVGA R9 280 3GB GDDR5 - HDD WD 1500TB
PM
J_C
17
Years of Service
User Offline
Joined: 9th Nov 2007
Location:
Posted: 2nd Apr 2015 15:32
Larry I am loving all the videos and demo levels you have been showing especially the hidden base and sinking subs..
You are really getting very productive...

Now to the Lua scripts - as you know I am also learning Lua..
but..
Larry.. I don't think this code is working the way you think.. ( if it is.. then I have a awful lot more to learn)...

The main function has another function embedded inside it... ai_soldier_AggroCheck(e)
This is a copy from the soldier script.. but the (e) in the soldier script is the soldier [e] number..
The (e) in your secruritycam script is the [e] number for the security camera..
You them have the if statement doing the same code and check twice... when open[e] == 1
at step 26
elseif open[e] == 1 and GetPlayerDistance(e) > 300 then
and again at step 72
elseif open[e] == 1 and GetPlayerDistance(e) > 300 then

What I think you are seeing in the video is the soldiers sensing you are within range and then coming after you...
To test... change its script to the one with only camera/siren code...
do the soldiers still come and attack you...
I think this script is animating the camera and activating the siren but it does not warn the guards...yet..
Here is your code with the aggro check removed... does it still work...as in your video..



I think this is how to make it work...
1. You need some way to tell the soldier he is a security guard and has a security camera
2. You need some way for camera to tell it's security guards that the alarm is active.
3. So you need 2 scripts... one for cameras and one for guards...
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 2nd Apr 2015 17:25
@larry
great idea, never would have considered adding the aggro check to a camera but you didn't quite get it right, extra functions need to be added after the main script has finished (i.e. below the 'main end'

@ j_C
there is some code in the original ai script which is meant to call nearby characters to join the fight which is called in the script above
Quote: "-- Add this enemy as a point of aggro, alerting anyone near to join the fight"

certainly seems to work but you are correct that in it's current form in larry's script it does not

in this case all you really need to do is add that tiny bit of alert code to the script rather than the whole function


like so
securitycam.lua


now as you can see when i approach the first box with no script i can get pretty close and no response (default ai)
however when i approach the 2nd box with the edited script the soldier responds correctly

life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Old Larry
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 2nd Apr 2015 18:00 Edited at: 10th Apr 2015 19:19
smallg wrote: "@larry
great idea, never would have considered adding the aggro check to a camera"

Done it ! Like usual, our smallg got the peak
For the @ J_C : I made the securitycam.lua like a way for make the camera to alert the enemy soldiers and...
because for now, this is my level of lua learning.
So, don't blame me yet for my beginner level.
Smile today, tomorrow could be worse

http://bestradiolarry.ro/fpsarea/

"The best forum, game software, operating system or web platform, it's that software which can give you most of the features and speed, not just amazing graphics."
J_C
17
Years of Service
User Offline
Joined: 9th Nov 2007
Location:
Posted: 2nd Apr 2015 18:07
Thanks smallg - this is a brilliant spot about the aggro entity -- I was always thinking of enemy soldiers.. but the camera entity itself..
( it went over my head).
saved me a lot of work... I was thinking of a way to tie the camera to the soldier and soldier to the camera..

You always come up with the greatest features with the least amount of code...
I have borrowed (pinched) so many routines from you... you are a god send...
All Hail smallg.... the of code
PM
J_C
17
Years of Service
User Offline
Joined: 9th Nov 2007
Location:
Posted: 2nd Apr 2015 18:35
Larry .. don't worry.. we all have to learn sometime.. that's part of the fun..

I would be embarrassed... to show anyone the code I wrote when I was learning to program..
but that was a long time ago.. now lua and GameGuru gives me something new to learn...


PM
Scene Commander
Support Manager
16
Years of Service
User Offline
Joined: 3rd May 2008
Location:
Posted: 9th Sep 2015 15:22
Unlocked at OP request
i7-4770s 3.10ghz - Geforce GTX 650ti
Old Larry
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 9th Sep 2015 15:31 Edited at: 10th Sep 2015 11:07
Many Thanks for Unlocked
So I have something new on this "securitycam.lua" script:
The Security Camera watch you and alert enemies automatically when player enter the zone...
Also if the security camera is not destroyed before the alarm starts, the player fails his mission and he will be killed.
But because I'm not a scripter, can't make this script to go at "0" (zero) lives of player, lives number remaining at "1"

The script first:


And one short video below, to you well understanding about my script problem:



Any hep will be appreciated and thanks in advance
Smile today, tomorrow could be worse

http://bestradiolarry.ro/fps/

"The best forum, game software, operating system or web platform, it's that software which can give you most of the features and speed, not just amazing graphics."
KeithC
Senior Moderator
19
Years of Service
User Offline
Joined: 27th Oct 2005
Location: 1x1x1 Cube
Posted: 9th Sep 2015 15:57
Posted to unlock.
Intel Core i7-4820K CPU @ 3.70GHz, 16GB RAM, NVIDIA GeForce GTX 770
PM
Old Larry
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 10th Sep 2015 10:34
Any hep for "deadly security camera" script will be appreciated.
Thanks in advance
Smile today, tomorrow could be worse

http://bestradiolarry.ro/fps/

"The best forum, game software, operating system or web platform, it's that software which can give you most of the features and speed, not just amazing graphics."
Corno_1
GameGuru Tool Maker
14
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 10th Sep 2015 10:52
maybe you should use
SetPlayerHealth(0) instead HurtPlayer(v)
but I did not know if this let the player die. Try it
My dream is to develope games, which makes fun when I create it and fun when other people play it.
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 10th Sep 2015 10:53
change this to 0 (line 75)
SetPlayerLives(e,1)
but remember it wont be game over for the test game, only in standalone.
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Old Larry
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 10th Sep 2015 11:21 Edited at: 10th Sep 2015 11:34
smallg wrote: "but remember it wont be game over for the test game, only in standalone."

I've changed at line 75 "SetPlayerLives(e,0)" and still remaining one live...
Ah ! Only in stand alone work at 0 (zero) lives !?!
If I use "SetPlayerLives(e,1)" for the second death (at line 59), then I obtained lives zero in test game mode.....
Smile today, tomorrow could be worse

http://bestradiolarry.ro/fps/

"The best forum, game software, operating system or web platform, it's that software which can give you most of the features and speed, not just amazing graphics."
Old Larry
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 12th Sep 2015 12:24
Maybe need some "player kill count" in the script ?
Smile today, tomorrow could be worse

http://bestradiolarry.ro/fps/

"The best forum, game software, operating system or web platform, it's that software which can give you most of the features and speed, not just amazing graphics."
Old Larry
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 16th Sep 2015 17:41 Edited at: 16th Sep 2015 18:04
So, nobody doesn't know how could be counted the player lives in this script ?!?

Smile today, tomorrow could be worse

http://bestradiolarry.ro/fps/

"The best forum, game software, operating system or web platform, it's that software which can give you most of the features and speed, not just amazing graphics."
Old Larry
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 16th Sep 2015 19:55 Edited at: 16th Sep 2015 21:30
OK, I solved myself this script (it's the final script for this new feature of the security camera) :

Smile today, tomorrow could be worse

http://bestradiolarry.ro/fps/

"The best forum, game software, operating system or web platform, it's that software which can give you most of the features and speed, not just amazing graphics."
Old Larry
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 16th Sep 2015 20:55 Edited at: 16th Sep 2015 21:29
And one short video below for you to see all 3 situations (how working the script) :
Feel free to use the script, and don't forget to share your work, if your work can help the GG comunity



Any comment ?
Smile today, tomorrow could be worse

http://bestradiolarry.ro/fps/

"The best forum, game software, operating system or web platform, it's that software which can give you most of the features and speed, not just amazing graphics."
Old Larry
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 20th Nov 2015 15:09 Edited at: 20th Nov 2015 15:11
Something it's wrong with the sound settings ?
After I kill the security camera, the sound is still hearing until he finished to play.
Please help me to the sound to stop it in the same the camera destroying time.
Thanks in advance
Here is the script:
Smile today, tomorrow could be worse

http://bestradiolarry.ro/fps/

"The best forum, game software, operating system or web platform, it's that software which can give you most of the features and speed, not just amazing graphics."
Old Larry
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 22nd Nov 2015 14:19
Something new about my last request ?
Thanks in advance
Smile today, tomorrow could be worse

http://bestradiolarry.ro/fps/

"The best forum, game software, operating system or web platform, it's that software which can give you most of the features and speed, not just amazing graphics."
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 22nd Nov 2015 18:41
i think this should do it? (note i changed the sound to slot 1)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
Old Larry
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 22nd Nov 2015 20:26 Edited at: 22nd Nov 2015 20:28
If I use the sound to slot 1, never stop it. I put back in slot 0 (in the model option and on the script too) and work now.
Full thanks @Smallg !!!
Smile today, tomorrow could be worse

http://bestradiolarry.ro/fps/

"The best forum, game software, operating system or web platform, it's that software which can give you most of the features and speed, not just amazing graphics."

Login to post a reply

Server time is: 2024-11-16 16:33:13
Your offset time is: 2024-11-16 16:33:13