Scripts / Working on some of the weapon functions

Author
Message
Flatlander
GameGuru Master
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 24th Aug 2018 05:14 Edited at: 24th Aug 2018 22:51
I'm beginning to test and figure out certain weapon functions.







See comments in the posted code.

We add a player weapon using code rather than picking it up. We then delete the Wizard's Staff that's in slot #1 and move the Uzi from slot #2 to slot #1
Alienware Aurora R7 with SSD 256GB boot drive ( C: ) and a secondary drive ( D: ) that is 2TB
Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz 3.19 with Intel Turbo-burst
Installed RAM 16.0 GB
64-bit operating system, x64-based processor
Windows 10 Home
NVIDIA GeForce GTX 1070 with 8192 MB GDDR5 and 8095 MB shared system memory
Flatlander
GameGuru Master
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 24th Aug 2018 22:50 Edited at: 24th Aug 2018 22:53
I added two lines of code to previous (above) example

This is the old segment:



The two added lines (new code):
Alienware Aurora R7 with SSD 256GB boot drive ( C: ) and a secondary drive ( D: ) that is 2TB
Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz 3.19 with Intel Turbo-burst
Installed RAM 16.0 GB
64-bit operating system, x64-based processor
Windows 10 Home
NVIDIA GeForce GTX 1070 with 8192 MB GDDR5 and 8095 MB shared system memory
Flatlander
GameGuru Master
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 24th Aug 2018 23:42
If you are wanting to control all aspects of the player's weapons and would like to put a particular weapon that the player picks up in a specific slot (for reasons only known to you ) then you can use the "SetWeaponSlot" function. There are two things you need to know before using this command. 1. You need to know what slot you want to use. 2. You need the weapon id of the particular weapon you want to put into that slot.

I can't help you with the first parameter. To retrieve info for parameter #2 you need to first have the weapon on the map and you need to know its name (path of the gun folder including the gun name. In this example, it is "modern\uzi". Now you can look at the code and see how to pull this off. I am going to put the uzi in slot #9 to show that you don't need any weapons in any of the slots prior to #9. However, I do start off with the Wizard's Staff in slot 1. When picking up the uzi you can either add it or replace the staff if you are currently holding it. You will place the code for a dynamic entity anywhere on the map. You might have to have it always active if the player is going to be a greater distance than the default distance for when entities are considered active.



Alienware Aurora R7 with SSD 256GB boot drive ( C: ) and a secondary drive ( D: ) that is 2TB
Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz 3.19 with Intel Turbo-burst
Installed RAM 16.0 GB
64-bit operating system, x64-based processor
Windows 10 Home
NVIDIA GeForce GTX 1070 with 8192 MB GDDR5 and 8095 MB shared system memory
Flatlander
GameGuru Master
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 24th Aug 2018 23:55 Edited at: 25th Aug 2018 00:16
I won't be adding any more to this thread. If there are any questions, then please ask. The following are most of the functions and variables for weapons.

Variables used in game


Functions (probably used most)


Other Functions (anything for the default player control mechanism you would rarely use)
Alienware Aurora R7 with SSD 256GB boot drive ( C: ) and a secondary drive ( D: ) that is 2TB
Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz 3.19 with Intel Turbo-burst
Installed RAM 16.0 GB
64-bit operating system, x64-based processor
Windows 10 Home
NVIDIA GeForce GTX 1070 with 8192 MB GDDR5 and 8095 MB shared system memory

Login to post a reply

Server time is: 2024-12-22 19:05:57
Your offset time is: 2024-12-22 19:05:57