Author Topic: Half Life 1 Weapons Project - Redux  (Read 6502 times)

Progress to release

Gluon Gun: Released
No update in progress.
- Model: Complete
- Script: Complete

 

Tau Cannon: Released
No update in progress. Features planned.
- Model: Complete
- Script: Complete

 

Laser Trip-mine: Released
Update 2.0.0 in progress.
- Model: Complete
- Script: Complete

       

Hornet Gun: Not Started
Snarks: Not Started
Guided Rocket Launcher: Not Started
Satchel Charge: Not Started
Grenade: Not Started
Crossbow: Not Started
MP-5: Not Started
SPAS-12: Not Started
Crowbar: Not Started
.357: Not Started
Pistol: Not Started
« Last Edit: May 24, 2017, 09:33:23 PM by Rally »

you could take a peek at the tf2 sniper code from rtb archive for help with the charging system

for anyone who wants to actually write it, my guess its best to just do a split fire state with prefire and fire, with prefire recording the time and fire checking the time diff and using that to determine the damage/projectile

I tried to add color to the models and they looked like butt.



Don't even ask about the tau cannon. Probably gonna trash them and start new ones.

look fine to me but i suppose its not HL1 accurate. btw when exporting the dts you can set certain materials to glow, if you're using belmder 2.49b exporter.

look fine to me but i suppose its not HL1 accurate. btw when exporting the dts you can set certain materials to glow, if you're using belmder 2.49b exporter.

Maybe it's just me being artistically insecure. The Tau Cannon is pretty objectively bad tho lol

I can't seem to get the style I want right. I'm gonna keep tinkering with the designs.

Revisited the Gluon Gun model




Still gotta fine-tune those colors. I feel like the backmount is kinda small and I might bulk it up.

backmount just looks like it sittin a bit low; shoulder packs usually have the top edge sit at shoulder height

I noticed that and I think that's why it's making the backmount look small too



Should be a bit better

It is 6AM, I haven't slept, and I've made progress

https://www.youtube.com/watch?v=RROA9ZOXW9Y

I figured that charging via the RMB is probably loving impossible so I just elected to sacrifice the automatic LMB primary fire and just replace it with a semi automatic shot that you can charge up. If you charge it too long, kaboomy. I might add some more cool emitters and maybe add different layers of charge (but I probably wont because this gun already eats datablocks for breakfast)

Also I wanted to make it so that every time the non-charged beam bounces off something, it makes a 'hit flash' emitter. This was the code I put in:
Code: [Select]
function TauCannon_Projectile::onCollision(%this,%obj)
{
%obj.spawnExplosion(TauCannon_Projectile_Explosion,"1 1 1");
Parent::onCollision(%this,%obj);
}

But it doesn't work. Whenever I fire the gun and the projectile bounces off something, it puts this in the console:
Code: [Select]
Add-Ons/Weapon_TauCannon/DB_Weapon.cs (220): Unknown command spawnExplosion.
  Object (25108) Projectile -> GameBase -> SceneObject -> NetObject -> SimObject

base/server/scripts/allGameScripts.cs (9948): Unable to find object: '' attempting to call function 'getType'
BackTrace: ->TauCannon_Projectile::onCollision->ProjectileData::onCollision


base/server/scripts/allGameScripts.cs (9971): Unable to find object: '' attempting to call function 'getType'
BackTrace: ->TauCannon_Projectile::onCollision->ProjectileData::onCollision

Can someone explain to me what I'm doing wrong? I guess it doesn't make sense that you would spawn an explosion from a projectile, but I don't really know how else I would be able to do it

spawning explosions is actually just creating a projectile with initialPosition = %obj.getPosition(), and initialVelocity = 0; and datablock being the projectile that has the explosion you want to create.

then right after creating the projectile, call %proj.explode();

here's an example:

%proj = new Projectile()
{
   dataBlock = PrisonBucketProjectile;
   initialPosition = %col.getHackPosition();
   initialVelocity = %col.getEyeVector();
   client = %col.client;
};
MissionCleanup.add(%proj);
%proj.explode();


i suspect you dont need the missioncleanup.add since you basically delete the projectile right after making it, but I left that in to be safe. Client = the owner of the projectile spawned, and will take ownership for whatever kills/damage the projectile does.

here's an example off of quake-type weaponry
very similar to conan's thing

Quote from: the Sawblade Rifle
function sawbladeRifleProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{   
      %p=new Projectile()
      {
         datablock=sawbladeRifleSparkProjectile;
         
         initialVelocity=vectorScale(%vec,1);
         initialPosition=%obj.getPosition();
         
         client = %prj.client;
         sourceObject=%obj.sourceobject;
         sourceSlot=%obj.sourceslot;
      };
   
   Parent::onCollision(%this,%obj,%col,%fade,%pos,%normal);
}

here's an example off of quake-type weaponry
very similar to conan's thing

yeah whats not shown is the sawblade spark projectile has a 10ms lifetime or something and explodes on projectile death (eg due to time) so thats the same thing essentially.



Thanks bro. I got it working using a mix of yours and the Sawblade Rifle script. Just FYI I really appreciate your help and input throughout the development of these guns, all your advice and comments thus far have been vital. Thank you.

here's an example off of quake-type weaponry
very similar to conan's thing

Thanks for the tip. I'm sorta familiar with the %p = new Projectile() thing because I used it to make a 'spawnVehicle' event a while back which I kinda gave up on because it was extremely abusive and I'm not good at vector rotations and stuff

Functions are kinda a mystery to me. I know that %this,%obj,%col,%fade,%pos,%normal are supposed to be arguments, but I never really know how to set them up. I'm pretty sure %this would be the projectile script object? And %obj would be TauCannon_Projectile? How do I know which ones to use? What do %col,%fade,%pos, and %normal do in the example Sawblade rifle script? If anyone could take the time to explain this to me or point me to a tutorial I'd greatly appreciate it.

a lot of this can be discovered if you get yourself a good eval mod and run tests ingame

ProjectileData::onCollision(%data, %obj, %col, %fade, %pos, %normal)
%data is the datablock itself - whenever you call %obj.function() the very first thing passed in is %obj itself - in this case since the object is projectileData its actually the datablock, not the projectile itself. I might be wrong on why its the datablock though.

%obj is the projectile itself.

%col is the thing the %obj collided with. Use %col.getClassType() to see what type of object it is

%fade, %pos, %normal im not sure. Never really had to use them, but I bet they'd be useful for one thing or another, esp. %normal if it does what I think it does.

use a test package and rewrite it with a server running to do things and find out what they mean. here's one you can use:

package ChatMessageData{
    function ProjectileData::onCollision(%data, %obj, %col, %fade, %pos, %normal)
    {
        talk(%data SPC ": datablock");
        talk(%obj SPC ": projectile");
        talk(%col SPC ": hit object");
        talk(%fade SPC ": %fade");
        talk(%pos SPC ": %pos");
        talk(%normal SPC ": %normal");
        parent::onCollision(%data, %obj, %col, %fade, %pos, %normal);
    }
};
activatePackage(ChatMessageData);

Copy that, and in your eval mod/server console, type in "eval(getclipboard());" with a server running. A good eval mod is port's chateval, which supports data dumps into ingame chat as well as multiline eval. The trigger character is \. you may need to set $Pref::Server::ChatEval::SuperAdmin = 1; in console first.

https://github.com/portify/Server_ChatEval/blob/master/server.cs

your goto function for figuring out what objects are given their ID is [obj].dump();. This will list out everything about said object, if it still exists.
« Last Edit: May 31, 2016, 01:59:49 AM by Conan »

Super useful stuff. Thanks.

Just so you know %pos appears to be the coordinates where the projectile last hit, and %normal appears to be the which side it was hit on in some kind of vector (shooting the north face of a 16x16 resulted in 0 1 0, shooting the south 0 -1 0, shooting the east 1 0 0, ect)

Also do you guys think this looks better when the conducting rod is self illuminating or without?