Product Chat / Taking gun that is behind wall

Author
Message
Divertic
7
Years of Service
User Offline
Joined: 26th Mar 2017
Location:
Posted: 26th Mar 2017 16:45
Hello, I have a small problem. I made a spawnpoint that is opposite of animated door. When i spawn, i can immedately take the gun without opening the door, that have the gun behind them. Can I change radius for taking gun?

Im sorry for my really really bad english, thanks for help
PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 26th Mar 2017 16:52
This can be changed in the files/scriptbank folder with this script. weapon.lua
The range command is in there. Currently at 150

If this is a specific instance only then you will want to duplicate the script, change its name.
Change the name of the functions to match the new file name exactly.

Find this line. Line 16 & 17


and change the range value to less range then the distance of the center of the spawn point.
Save the lua file.
Open your map.
Choose the weapon behind the door.
Go to the properties, and change the script in the AI_Main spot, to the new script with the modified range.

That should take care of that for you.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

Divertic
7
Years of Service
User Offline
Joined: 26th Mar 2017
Location:
Posted: 26th Mar 2017 18:10
Thanks much, worked
PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 26th Mar 2017 19:10
Excellent. Welcome to the forum.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 28th Mar 2017 11:27
A more foolproof way would be to add the "GetEntityPlayerVisibility(e)" command.

This way if the object cannot see you (behind a wall) you will not be able to pick it up. I haven't tested this in action though, the command is new enough for me not to have used it yet. It will slow things a little more though, especially if you have many objects checking visibility. I'd use it sparingly inside buildings only.


SPECS: Q6600 CPU. Nvidia 660GTX. 8 Gig Memory. Win 7.
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 28th Mar 2017 11:55
I've changed most of my collectibles so that a) they need player visibility (as Dvader said), b) work only within a player distance of 60 units, and c) you have to be looking directly at them (within a 10 degree angle) to activate the prompt and collect them. That way there's almost no chance of the player activating them when they shouldn't.

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.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 28th Mar 2017 15:14
Pretty sure non character entities can't see - at least they never could before.
You can however also check if the Y angles are near 180 apart though, that will help determine if the 2 are facing each other, I have those 2 functions in my thread.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Login to post a reply

Server time is: 2024-11-24 14:01:37
Your offset time is: 2024-11-24 14:01:37