Scripts / Hide and un Hide weapons

Author
Message
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 4th Nov 2021 13:04
I have this little script that Can hide and un hide a weapon.
It is working fine, but as soon as you pick up more than two weapons , then when you hide any weapon from slot 2,3,or 4 , when you un hide the weapon , it does not go back to the last weapon slot, it goes back to slot one.
With only two weapons it works correctly.
Somewhere I'm doing something totally wrong.


How can i fix it.?

Windows 10 Pro 64-bit
Intel(R) Core(TM) i5-4590S CPU @ 3.00GHz
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: 4th Nov 2021 18:49
I can't see how that script does anything tbh, at least not on its own.

collect_weapon is set to 0 so the if check on line 15 cannot be true.
give_back is set to 1 so the if check on line 30 cannot be true.
Been there, done that, got all the T-Shirts!
PM
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 4th Nov 2021 19:50 Edited at: 4th Nov 2021 19:51
when i pick up a weapon i have a variable called collect_weapon in the weapon.lua script that become 1 so that is how the first if can work
and give_back is set to 1 in the top of the script, so once the first if becomes true it set the give_back to 0 then the last if can be true.

just copy the script and test it and see, then you will see what i am talking about.
Windows 10 Pro 64-bit
Intel(R) Core(TM) i5-4590S CPU @ 3.00GHz
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: 4th Nov 2021 20:39
This version works for me.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 4th Nov 2021 23:47 Edited at: 4th Nov 2021 23:54
Ok. thank so so much , i have tested your no_weapon script you gave , and it also made the same problem.
Then i realized that i was testing the no_weapon script with the weapon.lua script you rote for dropping / swapping guns.
As soon is i was using the original GG weapon.lua then both my script and yours are working 100% fine.
That Means that some were in this weapon.lua script you rote , there must be some thing that is not compatible with the no_weapon script

Here is the weapon script you rote a wile back.


edited
My guess is that this weapon script are using the weapon slot.
It is a fantastic weapon.lua script ,
i would so much like to use it together with the no _weapons. lua script.
It is above my knowledge to see what i have to change to get it to work.
Windows 10 Pro 64-bit
Intel(R) Core(TM) i5-4590S CPU @ 3.00GHz
RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 4th Nov 2021 23:52
did you try changing the number of weapons you can carry?
local max_Weapons = 2 -- nuimber of weapons the player can carry
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 4th Nov 2021 23:55
Yes smallg , i did it still gives back slot 1 when you un hide a weapon
Windows 10 Pro 64-bit
Intel(R) Core(TM) i5-4590S CPU @ 3.00GHz
RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 5th Nov 2021 00:13 Edited at: 5th Nov 2021 06:53
Ok here In South Africa it 02:13 in the morning
Let me put my brain at rest , and get some sleep.
Like Arnold Schwarzenegger said in terminator....... il be back

Edit 08:51
im Back
Windows 10 Pro 64-bit
Intel(R) Core(TM) i5-4590S CPU @ 3.00GHz
RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 5th Nov 2021 07:44 Edited at: 5th Nov 2021 13:09
@ Amen, Ok looks like i got it to work.
Like i said, my programing skill is very bad, but if i remove this part in the weapon.lua script

Then both our no_weapon.lua scripts work fine.
Even if i adjust ( local max_Weapons = 3 -- number of weapons the player can carry ) every thing still test out ok.
Maybe somewhere something else is not going to work by removing the above part, but so far everything seems to work ok.
You can check and see what will go wrong without this part, like i said it seems to work ok.
I even test to see Ammo count and Ammo pick up even that looks fine.
The only thing i must add is to stop player from swapping a weapon if it is in hide mode, other than that it looks fine.

edited:
Quote: "The only thing i must add is to stop player from swapping a weapon if it is in hide mode, other than that it looks fine."

Done
Windows 10 Pro 64-bit
Intel(R) Core(TM) i5-4590S CPU @ 3.00GHz
RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11

Login to post a reply

Server time is: 2024-12-22 01:33:31
Your offset time is: 2024-12-22 01:33:31