Scripts / Weapon Damage Range

Author
Message
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 14th Jan 2019 04:55 Edited at: 14th Jan 2019 04:56
How do you set a weapons damage range?

In the gunspec damage property I've used damage = math.random(10,20) and other methods and this simply does not work. Is it possible to pass variables through the values in gunspec files? How can we better customize weapons to work with scripts?

Is it hardcoded to just use a numeric value in the gunspec value for weapon damage and there is no way to diversify this? I'd like to create the ability for ranged damage and upgradable damage ranges.

Is this even possible with Game Guru?
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3 | TGC Assets - Store Link | Patreon - Teabone3

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 14th Jan 2019 07:42
Thought it was range that determined the weapons damage range.
Scripting control over the gunspec. That is a good question.
In the global.lua file at the beginning of the direct lua call stuff are the weapons commands.

GetWeaponRange: Value = GetWeaponRange ( WeaponID, FireModeIndex ) -- Get range value of weapon

SetWeaponRange: SetWeaponRange ( WeaponID, FireModeIndex, Value ) -- Sets range value of weapon
RIP
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.

New:
Intel(R) Core(TM) i5-8400 CPU @ 2.81GHz, 12GB RAM, Nvidia gtx660, Windows 10 Home 64bit, Screen resolution 1920 x 1080. System Passmark 3774




Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 15th Jan 2019 06:00
I shouldnt use the word range, as really what I mean is a a dynamic value from low to high damage that is randomized. From my understanding its actually not possible to do this :/
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3 | TGC Assets - Store Link | Patreon - Teabone3

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
Corno_1
GameGuru Tool Maker
14
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 15th Jan 2019 09:45
Quote: "From my understanding its actually not possible to do this :/"

Not in the gunspec, because this is just a kind of default config file, but like Pirate Myke said, you can script it:
look in the global.lua there are a lot of weapon commands, i.e.:
SetWeaponDamage: SetWeaponDamage ( WeaponID, FireModeIndex, Value ) -- Sets damage value of weapon


Ebe Editor Free - Build your own EBE structures with easy and without editing any text files
Thread and Download
PM
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 15th Jan 2019 14:33 Edited at: 15th Jan 2019 22:35
Its unfortunate, I'm aware of all the weapon commands however there is no way to set a randomized low (base) and high (max) damage. Its always a locked static number. Which isnt very typical of most modern games today. Even shooters :/

Only solution would be an FPS eating script that always checks what weapon the player has and it randomly adjusts the damage continuously. Only solution i can think of. was hoping there was a way to have this down within the existing gun mechanics loop to save up on performance. Will have to check out the global player lua script more and see if i can inject something there each time of firing so im not just using a barrel on the map with a constant running script.

Additionally i can't think of any way of adding armor or damage reducing effects on enemies. As all hits to the the entities health/stretch seem to be dealt in a hardcoded manner.
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3 | TGC Assets - Store Link | Patreon - Teabone3

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
Corno_1
GameGuru Tool Maker
14
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 15th Jan 2019 19:25
Quote: "Which isnt very typical of most games today. Even shooters :/"

Maybe you can help me. I did not know a shooter where a weapon use random values for damage. I know the principals of damage decrease per range or hitting different parts of the body means different damage, but not random.
You not need to explain why you need it! I just find the statement a bit weird.

Quote: "Additionally i can't think of any way of adding armor or damage reducing effects on enemies. As all hits to the the entities health/stretch seem to be dealt in a hardcoded manner."

Why you not set the health higher? The player will not see the difference between higher health or reduced damage.
Ebe Editor Free - Build your own EBE structures with easy and without editing any text files
Thread and Download
PM
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 15th Jan 2019 22:45
Quote: "Why you not set the health higher? The player will not see the difference between higher health or reduced damage."


I have enemy health displayed on screen and i need ragdoll to work when they "die" and recover for spawning.

I'll see what I can come up with. Just need to invest some more time in work-arounds as per usual with the engine.
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3 | TGC Assets - Store Link | Patreon - Teabone3

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 22nd Jan 2019 04:41
I see certainly the value in a weapons range of damage in the properties. Most shots should cause random damage. Perhaps a work around, it seems like it would come down to setting (lowering) the enemies health via a random variable-- which I guess would be handy- but not a replacement and you would need to know when they where hit. I doubt it's available.
PM
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 22nd Jan 2019 04:54 Edited at: 22nd Jan 2019 04:55
One solution is having a hit detection for every limb and adding a randomized increased value to that. So basically set the weapons damage to fairly low as baseline and depending where the player hits the enemy, body, arms, legs, head etc... the damage maximum is dealt as addition to what the damage does and from there can add a range of randomized numbers like 2-6 and etc.

This topic can be moved to scripting. If a mod would like to move it.
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3 | TGC Assets - Store Link | Patreon - Teabone3

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 22nd Jan 2019 04:56
BTW all those functions Corno_1 mentioned;

"SetWeaponDamage: SetWeaponDamage ( WeaponID, FireModeIndex, Value ) -- Sets damage value of weapon"

are commented out in global.lua. What is that section for? What does that mean- can you use them?
PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 22nd Jan 2019 05:32
Thread moved at OP's Request.
RIP
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.

New:
Intel(R) Core(TM) i5-8400 CPU @ 2.81GHz, 12GB RAM, Nvidia gtx660, Windows 10 Home 64bit, Screen resolution 1920 x 1080. System Passmark 3774




cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 22nd Jan 2019 09:16
Hi Teabone, you could add the random damage command into gameplayercontrol lua if the fire weapon flag is set as fired. Then it will only call the change on left click of mouse when a weapon is held. Could also intercept the name of the weapon at this point so could attach different weapon random ranges.

Pretty sure this will work - it’s a good idea so am going to look at it for myself and will post if I get it sorted.

@GubbyBlips - the commands are just listed in global as comments for documentation purposes (a place to list all commands) - they can still be used. Ideally they would be in a wiki or some other documentation mechanism with more description of how to use and their impact.

Cheers.

Login to post a reply

Server time is: 2024-12-22 14:24:07
Your offset time is: 2024-12-22 14:24:07