Scripts / Hide Camera / player

Author
Message
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 13th Oct 2018 07:11 Edited at: 14th Oct 2018 17:56
Hi all is there a script function that can hide the camera or the player of that matter.

Something like making the player invisible ( invisible script ? )

Thanks
Pcs
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 17th Oct 2018 20:01
Hello ..... anyone any ideas to make the player invisible to walk around with out being seen by the NPC
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 18th Oct 2018 22:01
Ok. will have to let this one slide , or improvise to over come this challenge
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
synchromesh
Forum Support
10
Years of Service
User Offline
Joined: 24th Jan 2014
Location:
Posted: 19th Oct 2018 00:16
Problem is there is no player … just a camera … Nothing to attach or link a script to in the first place which is probably why no response.
You could set all the enemy view distance to 1
That would work but no idea what you have in mind ..
The only person ever to get all his work done by "Friday" was Robinson Crusoe..
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 19th Oct 2018 00:27 Edited at: 19th Oct 2018 00:32
you could also freeze the AI.
edit; there's a script i did few years back but i don't think the script will still work but should give an idea on how to do the effect... this method is fast as you can do it via code and still lets you use other scripts.

depends what reason you want to do as to the best approach to take, i think synchro's is likely the most effective if you want the AI to still patrol etc but not sure you can adjust the view range via script from memory (i know you can definitely read it) so could be a lot of manual editing... and of course it's not guaranteed to work on all scripts.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
synchromesh
Forum Support
10
Years of Service
User Offline
Joined: 24th Jan 2014
Location:
Posted: 19th Oct 2018 00:50
If you were about to enter a building and had a " Invisibility Activated " message Just before you entered or picked up an item to activate the message before entering then it would work with all the enemy set to Viewrange =1 … You could wander around pretty freely without being detected.

But Like smallg says it all depends on what the reason is behind it
The only person ever to get all his work done by "Friday" was Robinson Crusoe..
PM
synchromesh
Forum Support
10
Years of Service
User Offline
Joined: 24th Jan 2014
Location:
Posted: 19th Oct 2018 01:02
Another thought .. Same as above but some set all to AI neutral for standers
and others using small's civilian waypoint … combined they work well ..
The only person ever to get all his work done by "Friday" was Robinson Crusoe..
PM
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 19th Oct 2018 02:24
Quote: "If you were about to enter a building and had a " Invisibility Activated " message Just before you entered or picked up an item to activate the message before entering "


yes synchromesh, you are correct. that is basically what i want to do. To have the advantage to wander around pretty freely without being detected. It would be like an ability the player will have to , let say its almost like going forward in time for a couple of seconds to see what is waiting for him.
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 19th Oct 2018 22:29 Edited at: 19th Oct 2018 22:31
How about creating a svript in a barrel that has an invisbility flag, and copy of the ai script that uses that variable with an if else to trigger switching between neutral ai script and normal ai script via include wnd switch script?

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 20th Oct 2018 05:45
Belidos, that is and interesting idea. Will also look at that option. Thank you.
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 22nd Oct 2018 18:51
If I were trying this, I would find where the AI code detects the player and put a check for a flag such as "hidden" around it. Then I would flag hidden to equal 0 or 1 when hiding to stop the AI spotting you. Rudimentary, but it would work. You would be able to shoot at will and kill anyone quite easily of course with just this one check, you would need a bit more work to make it more realistic.

A simpler way to do this would be to set the view range to 0 when in certain zones or close to certain objects. I don't think the command exists to alter view distance on the fly though.
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 22nd Oct 2018 19:16
@DVader, thanks for the advice. this could be a nice way to do this invisibility script
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
synchromesh
Forum Support
10
Years of Service
User Offline
Joined: 24th Jan 2014
Location:
Posted: 24th Oct 2018 13:18 Edited at: 24th Oct 2018 13:22
Quote: "A simpler way to do this would be to set the view range to 0"

It would have to be set to =1 like I said above … 0 is default already and uses the scripts for the set distance and they will still see you ..
=1 is pretty much invisible and even if you shoot one they just look for you but still cant see you … Its pretty cool actually
The only person ever to get all his work done by "Friday" was Robinson Crusoe..
PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 24th Oct 2018 20:58
Quote: "It would have to be set to =1 like I said above … 0 is default already and uses the scripts for the set distance and they will still see you .."

Ah, okay, never messed much with AI range generally. Makes sense, 1 will not even be outside the NPC's body I imagine. I think I set the range in my RPGMark demo pretty low, to stop them going for the camera, but not sure how low. I probably tried 0, found it not to work and then worked up at a guess (been too long).

Oh another though about this. I'd wait until the new AI is released before doing too much work on it I haven't done any AI work since I released my store AI scripts. The default GG scripts have been in a state of flux for awhile now and so I leave any idea I might have, until it is a little more settled. A simple hidden flag would probably not be too much trouble to play with though.
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 24th Oct 2018 21:39
@synchromesh, yes i can imagine it,, you shoot them and they don't see you. haha. lol
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 24th Oct 2018 23:58
Have you had any success btw?
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 25th Oct 2018 11:26
@Dvader. Up to now I have had no success, I was trying the check and the flag you were talking about, still struggling, I wil try the view range = 1 as soon as I am back at the house, is at work now.
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
roandoom
8
Years of Service
User Offline
Joined: 24th Mar 2016
Location:
Posted: 25th Oct 2018 16:31
I have a Question, what would the function be to set the view range of the ai because I can't find such a command in the global.lua file.
PM
Jerry Tremble
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 5th Nov 2012
Location: Sonoran Desert
Posted: 25th Oct 2018 17:13
View Range is actually set in the properties of the ai.
Desktop: i7 4770@3.4Ghz (passmark 9809), 12GB RAM, Win 10/64, GeForce GTX 1080 (passmark 12006), 1TB SSD, 1TB HDD; Laptop: i7 4800MQ@2.7Ghz, 16GB RAM, Win 10/64, GeForce GTX870M , 1TB SSD.
PM
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 25th Oct 2018 18:15 Edited at: 25th Oct 2018 18:18
it would be so much better if there were a function to use in a script to change the view range.
it would not make sense to change it in the properties , because then the hole time while you are playing on that map all the npc will have only a view range off 1.
i need to be able to control it .
so i will have to try again with the script to get the ai not to detect the player and then switch it on or off with a flag / trigger in the script.
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
Jerry Tremble
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 5th Nov 2012
Location: Sonoran Desert
Posted: 25th Oct 2018 18:22
Quote: "it would be so much better if there were a function to use in a script to change the view range. "


I agree, although I'm not really much of a scripter.
Desktop: i7 4770@3.4Ghz (passmark 9809), 12GB RAM, Win 10/64, GeForce GTX 1080 (passmark 12006), 1TB SSD, 1TB HDD; Laptop: i7 4800MQ@2.7Ghz, 16GB RAM, Win 10/64, GeForce GTX870M , 1TB SSD.
PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 25th Oct 2018 20:38 Edited at: 25th Oct 2018 21:52
I've searched the global again and found this.

ai_aggro_range = 400

You may be able to override the range using this.

Edit - You can probably check if it is working with this.

AIGetEntityViewRange(obj)

Just tried a quick test but no luck. Changing ai_aggro_range does nothing that I can see. Checking the range with AIGetEntityViewRange(obj) produces 0, no matter if I leave it at 0 or increase it in the editor.

It would seem my first suggestion adding a flag to the actual AI script is still the best bet. I'll continue a few tests when I can.
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 25th Oct 2018 22:17
thanks for the feedback DVader.
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 25th Oct 2018 22:53
AIGetEntityViewRange( obj ) works fine but there isn't an equivalent Set function.

(remember to use 'object id' not 'entity id' for all AI commands)

If you add a request to GitHub I'll get around to adding equivalent 'Set' functions for any 'Get' ones, just list the ones you would like to see added.



Been there, done that, got all the T-Shirts!
PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 25th Oct 2018 23:03 Edited at: 25th Oct 2018 23:04
@ AmenMoses. Awesome. I was using entity ID Wasn't aware of object ID. Is that just npc's, or actual objects, rather than the player start marker etc.?

I have looked at the AI script and have got what you want working.

Attach hideplayer.lua to an object.
Replace your combatcore.lua with the one provided. Be sure to make a backup beforehand in case you don't want this all the time.
Add a soldier and your away. you could easily change it from a distance to a zone by changing the distance part to a zone check.

This will stop the ai from ever noticing you when close to the object you put the script on. I haven't fully tested and you probably need to add code to set g_hidden back to 0 when you are out of range, but apart from that it is working fine That's your homework
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.

Attachments

Login to view attachments
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 25th Oct 2018 23:29 Edited at: 25th Oct 2018 23:31
The object ID is the id of the actual physical object whether it is static or dynamic, the entity ID is a separate id for dynamic objects that can then have a script attached.

Many of the physics related functions use the object id and a lot of functions (for example the ray casting ones) return the object id so it is a good idea to learn how to map one to the other.


btw, other objects have different ids, for example lights, particle emitters, images, sprites, global sounds, there are loads of different ones.
Been there, done that, got all the T-Shirts!
PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 26th Oct 2018 00:04
I always use an auto-generated ID or when I'm lazy, ahem, which is most times when first coding something I use the first number listed in the editor, which I think of as the entity number. I did play with moving lights awhile ago and indeed as you say different ID's. Using the object number listed in editor did not work. I haven't really done much in GG for over a year, so I may be a bit behind the times lol.
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 26th Oct 2018 00:25 Edited at: 26th Oct 2018 00:29
@DVader, thank you my friend, i will look at the script and add any extra code that i need. thanks again
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 26th Oct 2018 00:39 Edited at: 26th Oct 2018 00:57
No problem By the way I set the distance pretty high in the code, you may want to reduce the distance to a more reasonable level in hideplayer.lua. You will also want to set the view range manually in the editor to be less than the range you set. I'm sure you will suss it. I can post the code to reset the hidden flag if you want, but I thought it best to let you try yourself first.

Edit - actually you can leave the range to be higher, been testing some more with the extra code. Once your in hidden mode, they can't see you, but can as soon as you step out of range and visible they will go for you.
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 26th Oct 2018 10:14
To get object id from entity id:


To get entity id from object id is a bit trickier so I usually create a persistent list but for a one off:
Been there, done that, got all the T-Shirts!
PM
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 26th Oct 2018 16:45
@DVader, il let you know as soon as i have the script up and running,
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 26th Oct 2018 23:29 Edited at: 26th Oct 2018 23:42
ok so i got it to work.

@DVader , and AmenMoses , and Jerry Tremble , and synchromesh, and smallg ,and Belidos , and roandoom. thank you.

DVader , i could not use your module_combatcore script , we kept on getting errors.
when i looked at your module_combatcore script then i saw that it contained a lot more lines than the one i have. ( mine has +- 610 lines and yours have 1002 lines. )
So i used my module_combatcore and put g_hidden = 0 in the same place as in your script then it worked.
With the help of Roandoom i have modified the hideplayer.lua so that it can work with GetInKey() in put ,
Also did the code to reset the hidden flag.


Thanks again for every one's help and in put.
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
Disturbing 13
3D Media Maker
19
Years of Service
User Offline
Joined: 12th Apr 2005
Location: Murder Capital of the World
Posted: 27th Nov 2018 13:23 Edited at: 27th Nov 2018 13:24
Did you get a version of this working for a zone so if you're in a zone that has let's say a haystack, it's as if you can't be seen? Something that can just be attached to the zone.
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 27th Nov 2018 17:55 Edited at: 28th Nov 2018 18:08
@Disturbing 13, up to now i have just work with it as it is on this thread, but i am sure it can be modified to work with a zone also.

use this code on a zone



Also make sure you look at DVader's script ( module_combatcore script ) to see were you must add the g_hidden == 0
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
Disturbing 13
3D Media Maker
19
Years of Service
User Offline
Joined: 12th Apr 2005
Location: Murder Capital of the World
Posted: 28th Nov 2018 00:47 Edited at: 28th Nov 2018 00:56
I tried this but it didn't work. It disabled the soldier. These were my steps just to be sure.
1. replaced module_combatcore.lua with Dvader's version
2. placed object on field and assigned it hideplayer.lua
3. placed enemy down
4. placed trigger zone down and assigned it the code above (named it hideplayer_zone.lua)
5. placed playerstart marker
The results I get before entering the zone is it already says 'hidden' at the bottom of the screen and the enemy just stands still.
Without placing the object running hideplayer.lua or placing the zone running hideplayer_zone.lua the enemy just stands still. If I add a waypoint path it follows it but does not attack.
So basically enemies don't attack anymore. ( I did backup my original module_combatcore.lua)
I noticed many custom scripts don't run since recent updates; could that be a factor with Dvader's module_combatcore.lua?

EDIT: I did not add 'g_hidden == 0' to the module_combatcore.lua, but I have no idea where to add it. I found it in the script 3 times but don't know if or how to alter it.(I cannot script)
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 28th Nov 2018 17:58 Edited at: 28th Nov 2018 18:11
@Disturbing 13,, ok the only scripts you need is this one and a modified module_combatcore lua file like DVaders.
I have called it player_invisible_zone.lua, see below and you can also find the download file down below if you don't want to copy it wrong.




You have to place your zone down and attached player_invisible_zone.lua to it.
then make sure that you use Dvader's module_combatcore script and if that does not work,use your original combatcore and look in his script and see where he added "g_hidden == 0" and add it to the same places in your script, then it should work. and only use player_invisible_zone with the zones that you need. Not the hideplayer script, the hideplayer script is if you want to use a button to be invisible.
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11

Attachments

Login to view attachments
Disturbing 13
3D Media Maker
19
Years of Service
User Offline
Joined: 12th Apr 2005
Location: Murder Capital of the World
Posted: 29th Nov 2018 04:31
Thank You very much! It works perfectly. Now if I can get the stealth kill script going I will have the beginnings of a great spy/thief/assassin's creed type game going. Thanks again!
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 29th Nov 2018 10:29
I am happy all worked out ok for you.
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11

Login to post a reply

Server time is: 2024-12-22 20:37:37
Your offset time is: 2024-12-22 20:37:37