Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Help! Explosive bullet round rifle  (Read 1804 times)

0 Members and 1 Guest are viewing this topic.

Offline Comrade

  • *
  • *
  • +11% chance to make useful post
  • Comrade might someday be someone...Comrade might someday be someone...Comrade might someday be someone...Comrade might someday be someone...
Help! Explosive bullet round rifle
« on: October 18, 2013, 10:44:10 AM »
So, I decided to toy around with SMOD and script in a custom weapon.
It's supposed to fire a hitscan round that explodes upon impact with something.
The explosive type is supposed to be SMG1 grenade/RPG rocket.

After some toying around, I've come to a conclusion that such weapon isn't gonna work with a hitscan projectile... so I scripted it to use it as a model. But I wanted it to seem like the bullet flies very fast (which it's supposed to), and I set the speed field to something ridiculous. Then the projectile just flew up for some reason.

So the question is: how do you make such a weapon, following the description above?

Offline PaiCrai

  • *
  • +3% chance to make useful post
  • PaiCrai has no influence.
Re: Help! Explosive bullet round rifle
« Reply #1 on: October 18, 2013, 12:51:28 PM »
So, I decided to toy around with SMOD and script in a custom weapon.
It's supposed to fire a hitscan round that explodes upon impact with something.
The explosive type is supposed to be SMG1 grenade/RPG rocket.

After some toying around, I've come to a conclusion that such weapon isn't gonna work with a hitscan projectile... so I scripted it to use it as a model. But I wanted it to seem like the bullet flies very fast (which it's supposed to), and I set the speed field to something ridiculous. Then the projectile just flew up for some reason.

So the question is: how do you make such a weapon, following the description above?

You can make a hitscan explosive weapon, no idea how though.
smignature

Offline Pepsifan04

  • *
  • *
  • +12% chance to make useful post
  • Pepsifan04 might someday be someone...Pepsifan04 might someday be someone...Pepsifan04 might someday be someone...Pepsifan04 might someday be someone...
    • Smod: CryLife
Re: Help! Explosive bullet round rifle
« Reply #2 on: October 18, 2013, 01:09:15 PM »
Quote
I set the speed field to something ridiculous. Then the projectile just flew up for some reason.
setting it over 3000 causes odd behaviour of projectile
DROP DATABASE bsnooch

Offline Comrade

  • *
  • *
  • +11% chance to make useful post
  • Comrade might someday be someone...Comrade might someday be someone...Comrade might someday be someone...Comrade might someday be someone...
Re: Help! Explosive bullet round rifle
« Reply #3 on: October 18, 2013, 01:25:49 PM »
Quote
I set the speed field to something ridiculous. Then the projectile just flew up for some reason.
setting it over 3000 causes odd behaviour of projectile
I know that.

Offline gpgpgpgp

  • *
  • +2% chance to make useful post
  • gpgpgpgp has no influence.
Re: Help! Explosive bullet round rifle
« Reply #4 on: October 19, 2013, 07:18:04 AM »
Quote
I set the speed field to something ridiculous. Then the projectile just flew up for some reason.
setting it over 3000 causes odd behaviour of projectile

Tested with phys_perf_maxvelocity 99999 and the weapon script (part) below:

      "BulletEntitySpawn"{
         "Class"      "custom_explosive"
         "Type"      "SMG1Grenade"
//         "Type"      "q2styleGL"
         "ZVector"      "40"
//         "Power"      "3800"
         "Power"      "380000"
         "NpcZVector"   "100"
         "AngVelocity"   "1000"
      }

Results: The grenades move straight and light-speed. (Almost) Nothing different from a Hit-Scan weapon. No odd behaviour observed. Well, what on earth is that "odd behaviour" you've been talking about anyway?

Offline Comrade

  • *
  • *
  • +11% chance to make useful post
  • Comrade might someday be someone...Comrade might someday be someone...Comrade might someday be someone...Comrade might someday be someone...
Re: Help! Explosive bullet round rifle
« Reply #5 on: October 19, 2013, 08:34:32 AM »
Quote
I set the speed field to something ridiculous. Then the projectile just flew up for some reason.
setting it over 3000 causes odd behaviour of projectile

Tested with phys_perf_maxvelocity 99999 and the weapon script (part) below:

      "BulletEntitySpawn"{
         "Class"      "custom_explosive"
         "Type"      "SMG1Grenade"
//         "Type"      "q2styleGL"
         "ZVector"      "40"
//         "Power"      "3800"
         "Power"      "380000"
         "NpcZVector"   "100"
         "AngVelocity"   "1000"
      }

Results: The grenades move straight and light-speed. (Almost) Nothing different from a Hit-Scan weapon. No odd behaviour observed. Well, what on earth is that "odd behaviour" you've been talking about anyway?

Bullets flying waaaaaaaaaaaaaaay off course.
A'ight, I'm gonna test this myself, and see if it works.

Okay, this works as intended, but sometimes the projectile still flies waaaaaaaay off course. Most of the times it hits the target though. Thanks for your efforts.
« Last Edit: October 19, 2013, 08:50:31 AM by Antivirus_404 »

Offline PaiCrai

  • *
  • +3% chance to make useful post
  • PaiCrai has no influence.
Re: Help! Explosive bullet round rifle
« Reply #6 on: October 19, 2013, 09:14:17 AM »
Quote
I set the speed field to something ridiculous. Then the projectile just flew up for some reason.
setting it over 3000 causes odd behaviour of projectile

Tested with phys_perf_maxvelocity 99999 and the weapon script (part) below:

      "BulletEntitySpawn"{
         "Class"      "custom_explosive"
         "Type"      "SMG1Grenade"
//         "Type"      "q2styleGL"
         "ZVector"      "40"
//         "Power"      "3800"
         "Power"      "380000"
         "NpcZVector"   "100"
         "AngVelocity"   "1000"
      }

Results: The grenades move straight and light-speed. (Almost) Nothing different from a Hit-Scan weapon. No odd behaviour observed. Well, what on earth is that "odd behaviour" you've been talking about anyway?

Bullets flying waaaaaaaaaaaaaaay off course.
A'ight, I'm gonna test this myself, and see if it works.

Okay, this works as intended, but sometimes the projectile still flies waaaaaaaay off course. Most of the times it hits the target though. Thanks for your efforts.

Go on Garrysmod.org, there's lots of joke OP explosive hitscan weapons there. Just copy the scripts, I suppose.
smignature

Offline gpgpgpgp

  • *
  • +2% chance to make useful post
  • gpgpgpgp has no influence.
Re: Help! Explosive bullet round rifle
« Reply #7 on: October 19, 2013, 10:50:16 AM »
Gmod weapons are lua script files, which gives a lot of freedom to create whatever you want. Well, Smod is good, but most of its functions are hardcoded, which means you must follow a certain pattern to realize your ideas. Some effects are thus difficult or impossible to realize without a flaw or two. Hope new version of Smod brings more functions, freedom of programming and openness (although it's already very good!).
« Last Edit: October 19, 2013, 05:10:06 PM by gpgpgpgp »