Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Tiberian Technologies / Blackhand Studios » Tiberian Technologies Forum » WeaponBag
WeaponBag [message #484697] Sat, 30 November 2013 10:29 Go to next message
Neijwiert is currently offline  Neijwiert
Messages: 124
Registered: October 2009
Karma: 0
Recruit
FIXED IT

There seems to be something wrong with the WeaponBagClass.

I have a situation where I select the most optimal weapon for a bot against a certain object. Everytime I have the exact same set-up, yet on some occasions the WeaponBagClass::Get_Count() returns 0. However I can see the weapon on the actual soldier in-game and it's the exact same soldier preset and everything I had before.

I do call my function multiple times, so it's not like those usual problems that you have to wait x time after creation to do y.

I can provide my whole code, so you guys can recreate this problem if you can't identify it in my code.

Toggle Spoiler

[Updated on: Sat, 30 November 2013 10:54]

Report message to a moderator

Re: WeaponBag [message #484702 is a reply to message #484697] Sat, 30 November 2013 10:48 Go to previous messageGo to next message
Neijwiert is currently offline  Neijwiert
Messages: 124
Registered: October 2009
Karma: 0
Recruit
Ok, I fixed it. It was really stupid of me not to think of this.

There was a combination of something going wrong with copying the DLL, thus not displaying the debug messages. Which made me believe that the for loop never was fired.

Now the problem was that whenever I gave myself a Blamo skin/armour . The calculated damage of the gun would then result 0 and would never be higher than the initial highest damage. Which would result in never assing WeaponIndex another value.

So to fix it, if anybody wants to know.

Change

float HighestDamage = 0;

To

float HighestDamage = -1;

[Updated on: Sat, 30 November 2013 10:49]

Report message to a moderator

Re: WeaponBag [message #484710 is a reply to message #484697] Sat, 30 November 2013 11:58 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
Of course ,the most effective weapon might be one for which you have limited ammo and this sort of scripting would go ahead and waste that ammo on free rifle infantry or engineers and leave the bot with a less effective weapon when it comes face to face with a vehicle or advanced infantry unit.

Really you need some way to evaluate the "threat level" of the target to decide if you really should be using your limited ammo top tier weapons or just stick with something slightly less effective but less limited on the ammo front.


http://steamsignature.com/card/1/76561197975867233.png
Re: WeaponBag [message #484742 is a reply to message #484710] Sun, 01 December 2013 05:03 Go to previous message
Neijwiert is currently offline  Neijwiert
Messages: 124
Registered: October 2009
Karma: 0
Recruit
danpaul88 wrote on Sat, 30 November 2013 11:58

Of course ,the most effective weapon might be one for which you have limited ammo and this sort of scripting would go ahead and waste that ammo on free rifle infantry or engineers and leave the bot with a less effective weapon when it comes face to face with a vehicle or advanced infantry unit.

Really you need some way to evaluate the "threat level" of the target to decide if you really should be using your limited ammo top tier weapons or just stick with something slightly less effective but less limited on the ammo front.


That's a really good idea, I haven't thought about that. But for the purposes I'm using it for it's fine. It's merely a simple improvement on the standard AI. And chances of coming across an actual vehicle aren't that big.
Previous Topic: Client Crash
Next Topic: Tiberian Technologies releases TT scripts 4.0 patch 1!
Goto Forum:
  


Current Time: Sat Dec 21 22:09:07 MST 2024

Total time taken to generate the page: 0.00889 seconds