View unanswered posts | View active topics It is currently Wed Dec 25, 2024 7:01 pm



Reply to topic  [ 6 posts ] 
 Weapons that can't be hit by bullets issue 
Author Message

Joined: Sat Jul 14, 2012 3:07 am
Posts: 6
Reply with quote
Post Weapons that can't be hit by bullets issue
So recently I modified several weapons to have them be completely unaffected by enemy bullets when being held (meaning when someone shoots you, the bullet actually passes through your weapon and hits your actor instead, so those weapons can't absorb bullets and save your life anymore)

I did this by changing a value on a single line in each weapon's ini file:
The line where it says GetsHitByMOs = 1 was changed to GetsHitByMOs = 0 to achieve this effect, and it worked perfectly.

However... this caused the weapons to be simply "unpickable" when dropped. If they're laying on the ground, the actors can't pick them up, period. No option to pick up the weapon will appear in the menu, no matter how close you get your actor to it. And if you're building your defenses, giving those weapons to the actors is impossible.. even the ones that were programmed to automatically pick up the weapon you drop onto them can't do it (such as Crobotech infantry for ex)

My question is.. is this a bug, and is there any way to work around this and make those weapons "pickable"? The version I used was b27 by the way. Thanks in advance.

By the way it would be really awesome if there was a command, like a Shift+Click to force equip the weapon when you're in bunker editing mode, rather than dropping them below your actors' feet and hope they pick them up themselves when you press Done. I would be soo happy


Wed Apr 23, 2014 1:52 am
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Weapons that can't be hit by bullets issue
In the latest build, B30, in bunker building mode, placing a gun near an actor will automatically equip it.


Also, where did you modify GetsHitByMOs? If it was in the gun itself, then it's no bug; the gun can't get hit by MOs, i.e., your actor, which means that it just goes through it.

If you want to make gunshots go past your own actors, you'd have to change the value for the actual particle that is defined as the round. By doing that, though, shots will avoid EVERY actor, not only yours.


Wed Apr 23, 2014 2:12 am
Profile

Joined: Sat Jul 14, 2012 3:07 am
Posts: 6
Reply with quote
Post Re: Weapons that can't be hit by bullets issue
Let's take a Heavy Pistol from the Coalition faction for ex. What I did was open the Coalition.rte/Devices/Pistols.ini

In that ini file, when you scroll down a bit there's a part which says:

AddDevice = HDFirearm
PresetName = Heavy Pistol
AddToGroup = Weapons
AddToGroup = Secondary Weapons
Description = Offering more firepower than any other pistol on the market, the Heavy Pistol is a reliable sidearm. It fires slowly, but its shots have some serious stopping power.
Mass = 5
HitsMOs = 0

GetsHitByMOs = 1

(that's where I changed it)

I just changed that value to 0. The only way for my actors to use this weapon is to either have them added in the Buy Menu during skirmish, or (for the opponent) to have it added into their inventory via the Skirmish Activities.ini file for the corresponding activity (they will spawn with the weapons, but once they die and drop them, they will be unobtainable).

Anyways, all I'm trying to do is make the bullets ignore the equipped firearms of opposing actors (I don't want bullets to ignore actors as well xD)
Could there be some line/command that maybe I could add to the bullet stats to make that bullet pass through all HDFirearms, or something like that?


Wed Apr 23, 2014 2:35 am
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Weapons that can't be hit by bullets issue
Well, I guess you could add a lua script to the bullets you fire. Something rather simple:

Code:
function Update(self)
    for item in MovableMan.Items do
        if item:IsHDFirearm() or item:IsTDExplosive() then
            self:SetWhichMOToNotHit(item,9999);
        end
    end
end


Problem would be putting that script on each round of each gun of the game.

Another solution would be putting a slightly different script on an actor (say, a copy of the brain case with this particular script)

Code:
function Update(self)
    for particle in MovableMan.Particles do
        for item in MovableMan.Items do
            if item:IsHDFirearm() or item:IsTDExplosive() then
                particle:SetWhichMOToNotHit(item,9999);
            end
        end
    end
end


But this last script would cause too much lag (I admit though, this is just a raw idea, not a very fancy script at all).

The other idea that comes to mind would be instead modifying the material of the guns. Like, under the definition of the material of the weapon, add the line "StructuralIntegrity = 99999", which would basically make it undamageable by particles.

But I don't get what you wanna do though, you want to make guns indestructable or something different?


Wed Apr 23, 2014 3:08 am
Profile

Joined: Sat Jul 14, 2012 3:07 am
Posts: 6
Reply with quote
Post Re: Weapons that can't be hit by bullets issue
I was only trying to make the bullets pass through a weapon (HDFirearm). Changing the GetsHitByMOs to 0 did exactly what I wanted. It made that gun ignore all the enemy bullets when being equipped (meaning they couldn't be destroyed from the opposing team's gunfire, because they were passing through it as if they're transparent). But as I said, it also caused the weapon to be unobtainable when dropped on the ground. Actors cannot pick it up at all.


My friend has the most recent version (I think. It's 1.05 <- that's what people refer to as B30 correct?), I tried making one of the guns unhittable by MOs, and same thing happened. They cannot be picked up from the ground.


Quote:
In the latest build, B30, in bunker building mode, placing a gun near an actor will automatically equip it.


Nope. I tried with regular weapons on Soldier Light. He didn't pick up any of those. I had to press Done and have the skirmish start for him to pick them up. Only actors from other mods that have their custom AI did this, and neither the regular actors, nor default ones were able to pick up weapon that had GetsHitByMOs set to 0.

Also,
Code:
function Update(self)
    for item in MovableMan.Items do
        if item:IsHDFirearm() or item:IsTDExplosive() then
            self:SetWhichMOToNotHit(item,9999);
        end
    end
end


I had no clue what to do with this at first.. but much later I made a Bullet.lua file (with the script above), and added ScriptPath = Browncoats.rte/Devices/Weapons/Bullet.lua line to the bullet I wanted to be affected... but sadly the bullet was still able to hit and destroy weapons from opposing actors (it wouldn't pass through them). Maybe I did something wrong, or didn't put that script path line in the correct place.. I'm really not sure.


When I took a second look at these ini files for weapons I did notice that Bullets actually have this line/stat:
HitsMOs = 1
If this gets switched off, the bullet passes through everything (you can't hit any actor with it).

Anyways, would it be somehow possible to "break" the HitsMOs = 1 into two: one that allows the bullet to hit the actors themselves (set to 1), and the other line where it's for HDFirearms (set to 0)
Something like
HitsAHumans = 1
HitsHDFirearms = 0
(These are completely wrong by the way, I was just giving an example to try and explain what I'm talking about)


Wed Apr 23, 2014 5:35 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Weapons that can't be hit by bullets issue
B30 is the version that comes after 1.05, the one currently available at Steam. Over there putting the weapons in editing mode works.

And as I said before, that's what GetsHitByMOs do, setting it to 0 will make it not get hit by MOs, which is everything that is not terrain (movable objects).

Let me explain how GetsHitByMOs and HitsMOs work. Basically, if you have either set to 1, you will hit anything that has 1 in the other variable. Say, GetsHitByMOs = 1 collides with anything that has HitsMOs = 1. I don't remember how hands are scripted, maybe you could work it like that, changing HitsMOs to 1 and the other one to 0.

Also, the script I wrote should be added to the particle itself, not the round. It had a mistake, and apparently, SetWhichMOToNotHit works for only one MO, and I can't set it to hit any MOs at all, so I had to make a distance check.

Code:
function Update(self)
   for item in MovableMan.Items do
      local dist = SceneMan:ShortestDistance(self.Pos,item.Pos,true);
      if dist.Magnitude < 50 then
         self:SetWhichMOToNotHit(item,9999);
      end
   end
end


It does have limitations though. If there are many weapons around, the script will check for all the guns while it's moving, and it doesn't cycle through all the weapons according to their distance, so basically, if you have a heap of guns laying somewhere, and a single gun in a different place, when you shoot, the script will probably check through a big part of the heap and check it's distance, and since the bullet is moving fast, there is a rather large chance that the script won't be fast enough to check the lonely gun, making it hit the gun.

If there's a low amount of guns however, or if you are firing to an actor that is far enough, it should work.

However, since the script aims to preserve guns, odds are that you'll end up with a large amount of guns in your game, which leads to a couple of problems, mainly, making the script work worse, and also affecting the famous MOID limit.


Wed Apr 23, 2014 11:40 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.389s | 13 Queries | GZIP : Off ]