{Mod Request} Glowing Projectiles

Started by CB elite, January 05, 2015, 04:23:26 PM

Previous topic - Next topic

CB elite

I just think it would be nifty to have certain projectiles that gave off some sort of light glow as they traveled across the map. I've noticed a lot of laser-type weapons being released recently, and I think it would be really cool if their projectiles had a glow to them.

I'm sure it would require some .dll modding, but still! :)

-----

Note: If this has already been done, I would more than appreciate a link.

Oxidus

They have a glow i think,Can you send pic?
Requiescat in Pace,Mio Fello.

aditaja


CB elite


Tankh

a bit too much glow there imo, but I like the idea.

CB elite

Quote from: Tankh on January 06, 2015, 09:54:52 AM
a bit too much glow there imo, but I like the idea.

I agree. I'm only looking for a faint glow, but I'd be more than happy to know how that was accomplished.

S4NDBE4R

Looking forward to seeing how this is done, been wanting to do some things with ambiance. Maybe digging into one of the other light mods can give a bases of how its accomplished?

skullywag

Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

S4NDBE4R

#8
Hey, so i just dug into the actual light defs. It looks like all you will need is this little bit of code here.

    <comps>
      <li>
        <compClass>CompGlower</compClass>
        <glowRadius>0</glowRadius>
        <glowColor>(0,0,0,0)</glowColor>
      </li>
    </comps>

You'll want to put that at the end of the bullet base for your weapon. DO NOT put it in the actual labeled bullet def for the gun, this way it will track the bullet, preventing a graphical error. So it should look something like this.

  <ThingDef Name="BaseBullet" Abstract="True">
    <category>Projectile</category>
    <tickerType>Normal</tickerType>
    <altitudeLayer>Projectile</altitudeLayer>
    <thingClass>Bullet</thingClass>
    <label>bullet</label>
    <useStandardHealth>False</useStandardHealth>
    <neverMultiSelect>True</neverMultiSelect>
    <shaderType>Transparent</shaderType>
    <comps>
      <li>
        <compClass>CompGlower</compClass>
        <glowRadius>4</glowRadius>
        <glowColor>(217,0,0,0)</glowColor>
      </li>
    </comps>
  </ThingDef>

Of course changing out the glow color numbers will result in different colors. Right now it's set at red. Hope this helped

-Edit:

With all that said, changing BaseBullet will affect all bullets in the xml. So if you're wanting different colors, or having a mix of glowing and non glowing, make sure you have all new xmls for each type.

CB elite

I remember attempting this by putting that comp in the projectile def, but that never worked. Thanks for showing how this is accomplished!

The only thing I don't like is how the glow is rendered as the projectile travels...

Slower projectiles obviously look a lot smoother than fast ones, but "glowy" beams aren't typically slow :P lol

Perhaps a future alpha will allow for smoother rendering of these glows? :)

skullywag

This was why i asked for it to be shown in motion, the lighting is grid based, its always gonna be strange looking when moving unless Tynan changes that, which I doubt will happen.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

S4NDBE4R

Quote from: CB elite on January 07, 2015, 12:05:11 AM
I remember attempting this by putting that comp in the projectile def, but that never worked. Thanks for showing how this is accomplished!

The only thing I don't like is how the glow is rendered as the projectile travels...

Slower projectiles obviously look a lot smoother than fast ones, but "glowy" beams aren't typically slow :P lol

Perhaps a future alpha will allow for smoother rendering of these glows? :)

Yeah.. That's something I'm actually going to be looking into sometime later (unless someone knows this already). I am guessing that if you change the ticker, it might render faster? Seems to me that anything traveling over 94 speed is noticeable. So it would seem that we are stuck with "plasma" weapons for now haha.

aditaja

Quote from: S4NDBE4R on January 06, 2015, 02:47:32 PM
Hey, so i just dug into the actual light defs. It looks like all you will need is this little bit of code here.

    <comps>
      <li>
        <compClass>CompGlower</compClass>
        <glowRadius>0</glowRadius>
        <glowColor>(0,0,0,0)</glowColor>
      </li>
    </comps>

You'll want to put that at the end of the bullet base for your weapon. DO NOT put it in the actual labeled bullet def for the gun, this way it will track the bullet, preventing a graphical error. So it should look something like this.

  <ThingDef Name="BaseBullet" Abstract="True">
    <category>Projectile</category>
    <tickerType>Normal</tickerType>
    <altitudeLayer>Projectile</altitudeLayer>
    <thingClass>Bullet</thingClass>
    <label>bullet</label>
    <useStandardHealth>False</useStandardHealth>
    <neverMultiSelect>True</neverMultiSelect>
    <shaderType>Transparent</shaderType>
    <comps>
      <li>
        <compClass>CompGlower</compClass>
        <glowRadius>4</glowRadius>
        <glowColor>(217,0,0,0)</glowColor>
      </li>
    </comps>
  </ThingDef>

Of course changing out the glow color numbers will result in different colors. Right now it's set at red. Hope this helped

-Edit:

With all that said, changing BaseBullet will affect all bullets in the xml. So if you're wanting different colors, or having a mix of glowing and non glowing, make sure you have all new xmls for each type.

No , dont use it at the projectile data , use it like this

<ThingDef ParentName="BaseBullet">
    <defName>Bullet_Pistol</defName>
    <label>pistol bullet</label>
    <graphicPath>Things/Projectile/Bullet_Small</graphicPath>
    <graphicClass>Graphic_Single</graphicClass>
    <projectile>
      <flyOverhead>false</flyOverhead>
      <damageDef>Bullet</damageDef>
      <DamageAmountBase>10</DamageAmountBase>
      <Speed>55</Speed>
    </projectile>
    <comps>
<li>
<compClass>CompGlower</compClass>
<glowRadius>5</glowRadius>
<glowColor>(199,22,164,0)</glowColor>
</li>
    </comps>

  </ThingDef>

it will make bullet color like picture that im post before , and for specific bullet type ...
PS: sorry for my bad english ...  ;D

S4NDBE4R

Quote from: aditaja on January 07, 2015, 11:18:59 AM
No , dont use it at the projectile data , use it like this

<ThingDef ParentName="BaseBullet">
    <defName>Bullet_Pistol</defName>
    <label>pistol bullet</label>
    <graphicPath>Things/Projectile/Bullet_Small</graphicPath>
    <graphicClass>Graphic_Single</graphicClass>
    <projectile>
      <flyOverhead>false</flyOverhead>
      <damageDef>Bullet</damageDef>
      <DamageAmountBase>10</DamageAmountBase>
      <Speed>55</Speed>
    </projectile>
    <comps>
<li>
<compClass>CompGlower</compClass>
<glowRadius>5</glowRadius>
<glowColor>(199,22,164,0)</glowColor>
</li>
    </comps>

  </ThingDef>

it will make bullet color like picture that im post before , and for specific bullet type ...
PS: sorry for my bad english ...  ;D

The reason why I said use it in the basebullet is that the way you have it will run into graphical errors when there are more than just one gun shooting off. I tested it and confirmed this. Its mainly when they are taking cover. There are also times where the glow will stay at the spawn of the bullet through the lifespan of the bullet, making the person shooting the gun very vulnerable at night.

You could make an expanded basebullet (how food is derived), which should work just fine, keeping it all in one nice "neat" file. But to put it on the actual labeled bullet def will lead to complications.

Berengar

What an amazing idea! when you dont have anithing against, i will put that in my mod. ^^