Jump to content

panzer1b

Members
  • Posts

    1,776
  • Joined

Everything posted by panzer1b

  1. Id say buf fixes/optimization is #1 priority. Now im not saying all of are like to fly around in 1000 part monstrosities, but forcing us to use a welding mod isnt really the best solution. I suggest making the physics simplify overly large craft (ideally physics would allow for no lag while calculating every part, but thats not happing any time soon without a new engine/massive optimization). This would mean, that parts could be grouped into segments that essentially work as a single componet in terms of physics. Yes this is not idea, but in practice, almost all these super large things are stations, and having 2000 parts total (station + all docked junk), just lags teh game up for no benefits. I think that docked craft should be set as a single solid entity UNLESS they are collided with by something, then do the calculations on the collided part individually. Im no super coder, nor do i know how ksp engine works inside, but i THINK such a system would help cut down on lag, allow truly massive stations to exist, and also i doubt anyone would be unhappy that their station nolonger wobbles all day. Another idea i have is to make every body 100% rigid until something exceeds its breaking force or hits something fast enough. This would get rid of every single physics cal aside from teh force applied to each object. Id personally not miss the lack of wobliness, as it just makes super heavy massive part count ships lag your game. A great solution would be to disable complex physics when a craft exceeds a user set value (say from 100-1000 parts), that would essentially fix the entire thing as a solid, and only calculate forces applied to each object. I say a good temporary fix until unity 5 (which HOPEFULLY will address large part count lag). Btw, i have a decent rig that can handle around 500 parts with minimal issues, and can still render 1500 before the game dies completely, id still like smoother framerate, and id be more then happy to sacrifice a little bit of physics in exchange for stable framerate. Keep physics at low part count as is, i like teh detail, but at super large part numbers (or stations with lots of vessels docked), please treat entire ships as solid bodies that only break from collision or overstress of joints.
  2. im now working on turret code sadly, it requires a complete overhaul of the whole mod, so essentially im forced to recode the entire thing from scratch once turrets are coded, itll be very very easy to make them non moveable (either via model itsself, or just setting a flag to flase to disable rotation ability) issue right now is that the code is coded to fire forward in worldspace, not forward relative to how the gun is rotated (eg i could rotate the gunpods right now in any orientation, and itd still fire forward relative to the plane, working on making it fire wherever the barrel is pointing) i will upload my final alpha version today lateron, it works, has a few small bugs, and alot more features then before (tracer colors, random spread, ability to ricochet a bullet from one target to another, some gun handling improvements, ect) sadly in doing something i broke recoil, so you will have to live with either no recoil and these upgrades or stick to the original release that still works perfectly fine if officially discontinuing support for all versions that do not support turret code, since adding the turrets cant be done without essentially redoing the whole base code still, for those who have been waiting go ahead and install the next alpha version, its better in all ways except recoil is messed up (i know i could theoretically fix it if i had the time, but id rather spend it doing the beta version that has turrets working) if there is enough requests for a recoil fix, i will be happy to do it, but id rather spend all my time modding at making the new one, again, post here if youd really like the recoil fixed in the 2nd alpha current working features: *guns shoot *guns have spread *guns damage things to varying degree *tracer color choices and enable/disable tracers *2 muzzle flashes to choose from *easier way to determine initial velocity/firepower, now you set it velocity and mass, mass doesnt change the velocity anymore, only increases firepower/decreases drag effects, velocity only increases velocity and hence firepower Few featires im working on with the beta code: working turrets (i have gotten them to rotate and elevate the gun, but still working on making the bullets spawn in varying orientations, a bit hard to figure out how to work) working on giving bullets different ammunition types: AP, HE, I, and AM rounds: AP or armor piercing will function more or less similar to the guns now HE or high explosive will create a small explosion with varying amount of force based on the caliber I or incendiary will increase the heat of a part by a set amount based on caliber (im also considering particle beam weapons that fire a short burst increasing the heat of the target, similar in concept to the sunbeam laser but different implementation, an actual stream of bullets essentially that each heat a small amount, and have very very slight target seeking ability, as well as limited velocity and dont aimbot things like the enemy cockpits ect) AM or anti matter rounds will force delete a single part it touches (as in the only round guaranteed to do damage, but as a balancing effect other then deleting the target part, it will not do anything else, no forces exerted on the target or collateral damage, only for use on battleship class guns, 210mm or more caliber to keep the ammo useage very high and to keep the rate of fire extremely low some guns may have selectable ammunition, meaning a toggle from say AP to HE, with different resource useage as one may have a different mass then another resource usage per shot and a few ammunition bin parts to go with it (ammo production will be in final release, its not hard to code, but i dont really have the time to do this as i have other priorities) target tracking and lockon will be in final release, 1st i gotta get the turrets to work semi decently with manual controls im also switching over to a new style of the guns and turrets, old ones are most likely going to be scrapped in beta release, since there is too much i need to do in terms of proper bone orientations, that the old models lacked, essentuially since new code will look at orientation of barrel and shoot straight out of it, i cant use my old randomly oriented models finally, im hoping to release at least a few turreted guns, im working on making the code work with a dual 88mm flak cannon designed for smaller scale destroyers or as cruiser secondary armarment, a bit too powerful and low rate of fire for shooting fighters, but also too weak to take down huge ships turets will also have toggle on/off and return to default position, allowing only one turret to be used at a time, or as many as you want (since each is going to be bounce to the same numpad keys), and also a option to return turret to default forward facing (so that if you used a turret and want to then face all guns forward, allows the ability to then use them as essentially forward firing emplacements) also working on ingame hotkey binds so each gun can be fired with a different key ect
  3. i lost some of my modded code when i went to my new machine, so some stuff ill have to redo, but sofar this works: *bullets shoot out of guns *bullets damage things *bullets have random spread, finally a reason to not always use the 30mm cannons which have apparently little drawbacks but low velocity rounds *alot more customization options (different physical shell sizes, muzzle flashes, tracer colors still being worked on but will have this) *working casing ejection (well it worked before but the issue was with the shells not having a removal script, meaning once spawned itd stay rendered for a very very long time until it flew past 2KM from you, not to mention still rendered underground after clipping thru it) *and alot of other features i could use some help with getting teh sound to work, so if anyone knows how to get the game to play a sound file once every time the firing code cycles through, id greatly appreciate it and add you into credits note: i do not want any looping sounds, they cause glitches like the SPH/VAB symmetry bug in the gau19, and just dont sound good with anythig that isnt a rapid fire weapon, its impossible to sync the sound properly without forcing the guns into legit semi auto (not fun unless its the howitzers which reload 5-20 seconds anyways) And is it possible to give a object selective collision? perhaps make it collide with teh ground but nothing else, or collide with everything but say a specific object? ITd be nice to make casings have ground collision but not hit the plane, and also nice to have bullets interact with everything BUT other bullets also, im trying to fix a few errors and unnecessary crap in the code, not to mention now everything is documented im also willing to add anyone who would like to help me make 3d models to the team, i can only do so much, and any 3d model of a gun would work well given proper naming and orientation of the bones if anyone is interested to make model compatible with my plugin, the one bone that must be named properly is the bone called "MuzzleLoc" case sensitive without quotes, oriented in the same direction the barrel is. This is where the bullet effects are spawned, and the bullet itself spawn a little bit in front of it, to avoid clipping issues. Also, the hitbox should preferably be nowhere near the "MuzzleLoc". try to keep the models fairly low poly, since KSp generally speaking isnt super graphics anyways, so lower polys allows mounting more guns without framerate issues.
  4. im going to take about a week's break from modding due to my computer being close to dead ive ordered a new one, which should be shipped to my place in about a week or so, so once i get it and KSP running on it, ill get back to modding this sorry for the short delay in my work, but since KSP has become unplayable due to random crashes every few minutes requiring a computer reboot, i just cant really test mods reliably until i get a new computer at least blender works without crashing, so expect more then just 1-2 extra guns in my updated release, ive already finished my 170mm railgunish looking cannon and 75mm anti-tank gun
  5. can someone help me create a randomizer which will give me more or less teh effect of random spread in a ejected object i have a weapons mod, that needs this for the shells that are fired my shell's firing code is as follows, basically once spawned in, this force is applied to the shell using the 2 variables shellmass and shellvelocity to determine the magnitude of this force: newshell.rigidbody.AddForce(part.transform.up * shellvelocity * shellmass, ForceMode.Impulse); i want to know what i can do to make this shell spawn in with a slight variation which would be random every shot (basically i need to know a method for making a variable lets just call "vectormultiplier" to change randomly as time progresses to give me a different value every shot) this way i can give the shell a different force in either the forward/back direction or the left/right direction also, where is information about how to implemennt resources? i want my cannons to use a certain amount of resource per shot, and i also want to make it fo that if there is less then a certain amount of ammunition resource left, the weapon will not fire. i know this part is most likely very easy to code, i just dont know the proper terms to use in my code to make it use resources when a shell if fired, and then also not fire when the resources are empty.
  6. id be happy to add you in, since im always willing to add people to the team

    im open to letting you do whatever you do best, if you would like me to give you my mod for testing before a release i can do so (since i upload to mediafire, i can give you link before posting it officially in thread), if you would like to help me actually create content im open to that as well, basically whatever you want to do ill be happy to accept your help, since being one guy makes it hard to do a mod 100% solo

    feel free to send me a PM whenever, i usually come online every few days at the minimum, more often if i have something to post or add

  7. i agree with this, the only way plasma weapons would work is similar to a old sci-fi RTS ive played a few years back (basically once of the races used plasma grenades and plasma beams, grenades fired a shell containing plasma that would penetrate partially, then plasma would destabilize exploding the grenade (devastating if it fully penetrated and the plasma exploded inside a structure or tank), and the beam weapon was short range and fired a stream of plasma or something liek that, honestly the more sci-fi of the two, teh grenade being way more plausible) so i may or may not add plasma weaponry, but at most, they will just be a different look on the explosion, muzzleflashes, tracers, ect, they will still effectively function as either a kinetic, or explosive, or deletion weapon also, i have considered making weapons that heat up a vessel therefore overheating it, but since there is already such a mod i see no reason to try to code this myself, if you want overheating weapons just use the sunbeam laser and modify it in whatever way is desired for balance finally, although it will not be any part of this mod, i do plan to add a defensive technologies pack to help make multipleyer with weapons a bit more fun, i will have a shield generator (perhaps make its hitbox generation based on procedural fairings), and a few armor plates that can resist anything but deletion code based weapons also, one more question for the community who weants this mod, do you guys prefer sci-fi or would you like me to make more realistic looking models (the 37mm and 13mm machinegun is sortof the style i like, but i am willing to and actually plan to have both my styled guns and more conventional stuff, such as the 23mm, the 20mm, the 30mm, and the planned 8mm entry machinegun i m making (its heavily based on a vickers machine gun, with a top mounted drum mag, which will rotate similar to a russian DT machine gun from WW2) and should i continue to make weapons animated or do you guys think its a waste of time to bother modeling moving belts that feed the guns?, its not that much work but it does add to the time to make a good model, and also adds to the polycount)
  8. ok, here is a list of what im working on this current moment: *adding sound *adding multicolored tracers *adding different caliber shells and casings (as a prelude to the heavier guns that will be eventually added) *adding ammunition resource useage *adding turrets which for now are going to be controlled by arrow keys ( i may or may not release a turret with the bugfix, depending on whether i can get the code to work flawlessly) *fixing lack of science unlocked in guns aside from the mg13 (i forgot to do this, sorry, but most of us are human (or well programmed to think we are human )), before i release a small patch update to fix these problems, i will likely add my own science branch, but i still need to look at other mods to figure out how to do this, if you guys know of a good example mod to see how this is done, i will download it and see how they coded the new branches (as the mods i have now use default science already coded into the game) * rewriting code from scratch as DYJ's code, while readable, is way messier then im used to working with, i very much prefer nicely commented and organized code when given the choice, and its not that much work to do this (actually its already done) * and finally making casing ejection work right (there is a bug that i fixed which made casings persistent and not delete themselves like bullets would, this is fixed now, so shell ejection SHOULD work properly, also considering giving casings collisions, at itd be at the least interesting to have casings rolling down the side of a tank ect), also not going to be enabled on all weapons (since some are either using caseless ammo, are energy weapons, ect also, the old mod will be INCOMPATIBLE WITH THE BUGFIX, so you will need to use one or the other, deleting the old mod entirely, as too many things have changed in the bugfix or should i say new release, to make old one still work. as a side though, most of my guns are futuristic in general, as i just like the look of sci-fi stuff, now whether they use earth tech or not to work is up to you guys to decide, all weapons function for now as either kinetic projectiles (effectively the same as if you were to launch a ibeam at a enemy at some velocity except different bullet weights and kinetic energies), explosive weapons (not yet implemented but the larger guns are planned to create a shockwave on collision, basically creating forces on nearby parts, or deletion weapons (which basically force delete the collided part, and usually add a small explosive force to surrounding parts (similar to the sunbeam laser, except without any heating involved, also similar to the romfarer lazor guided missiles, which also appear to force delete parts within a certain radius of detonation along with creating forces to surrounding parts)
  9. how do i change the title? i do not see any obvious options to change it? im also working on the sound code, so there WILL BE SOUNDS! i just have to figure out how to code this properly (as the sound code for the minigun is a looping sound, which cannot be used properly for my application), and i just havent figured out how to code it properly to work PER SHOT instead of whenever trigger is pressed if anyone is willing to help me with this, if i dont figure out how to get it working by the end of today myself, ill use your ideas for it
  10. eventually i will make all this stuff lets just take it one step at a time, im just one guy, so unless we decide to get a team together im not sure how much i can do alone im already working on making different levels of lethality with my weapons (just try the 37 vs the 13mm and you will see, the 13 just knocks stuff around, the 37 actually blows em apart) also, structural panels right now are your armor, anything with a high breaking tolerance is by defenition resiliant to bullets as the bullets act as if a kinetic object struck the target, basically different levels of velocity and bullet mass determine lethality im also working on a completely new code as the way the bullets interact right now is a bit odd for me (they push stuff way too much and dont seem to obey the laws of inertia, and a few other weird effects) anyways, its just my alpha release, all these features will be done eventually, i will add specialized armor plating (which will be heavy but resilient against all but the biggest caliber guns) and im also working on tech tree integration, its not done yet, as this is a relatively new feature, and i also want to make enough weapons to make this worthwhile (im working on a WW1 style mg now, to make a good starting point for KMP, and all better guns require researching, more and more science to get to the deadlier ones, and ofc there will be different branches, which i plan to have a very high entry cost, say very expensive to get your 1st guided missile, but not that much to increase to a slightly better version or missile)
  11. ok since apparently alot of people want a minigun in my pack, i will add one to the pack do you guys think a turret mounted minigun for my point-defense turrets (once they get implemented) would be a good idea? does a Phalanx CIWS sound like a good idea? I can make something like one of these 9it has a minigun, automated lockon targeting of incoming missiles, and well looks cool) as i cant justify that rate of fire for a normal weapon (the point-defense guns would be defensive and allow locking onto targets at close range, similar to the current naval minigun, unsure what its called, to shoot down missiles) itd probably be unbalanced if i make it realistic and useable as a standard weapon (DYJ's minigun isnt firing ANYWHERE near real life, even a three barreled minigun will fire way way faster then that, his minigun based on my calculations fires at 750 rounds per minute, nowhere near the 3000 or so rpm minimum for a average minigun, my 13mm machine gun fires about 750 rpm). and as for sounds, i will do my best to make them realistic (so if i make the minigun, it will sound more or less like a actual recording of one) im also working on making a single sound to play per shot (so i can have tweakeable rates of fire and not make the thing out of sync) i could use some help with coding sounds, and anyone who is willing to step in and help me with this would be greatly appreciated (i have enough sound files for my needs, but i cant code them to work the way i need) i will probably start up a company in the proper thread, so once its up there anyone willing to help me out with this or any other way, is welcome to join AKS Technologies
  12. Well finally released and in ALPHA stage! http://www./download/pcynnaidmycykl8/AKSWeaponsPackV2_ALPHA.zip Original code by DYJ Modified and improved my panzer1b 3D modeling by panzer1b and special thanks to Romfarer for his lazor mod which made my guided missile possible I will upload this later to spaceport, but for now enjoy. Hopefully there aren't too many bugs left (i had a few issues come up so a few features had to be disabled temporarily, as i really wanted to get this released at least in a preliminary stage). A few features that were suppose to be in didn't make it, but at least i managed to make the general mod work without any obvious issues. Currently complete and included in this pack: Mg-13 13mm heavy machine gun *animated belt feed Mk-20 20mm gunpod Mk-30 30mm gunpod Mk-23®z dual 23mm gunpod FlaK-X/37 37mm dual purpose ground-air mounteable cannon RD-3 guided missile (uses Romfarer's DLL to operate, i did not include it here, so you need the Lazor mod for it to actually spawn in and work) I had a few issues with my X-6 missile's 3d model bugging out, so it did not make alpha release, but will be back in beta. I will use this as the main thread regarding my weapons pack. Here are a few pics of what i have now, all is subject to change, especially the not so great skins which i am definitely going to make more detailed and better in the beta and final releases. But the models for these 3 gunpods are pretty much going to stay more or less as is. http://imgur.com/a/LLqaE#0 A few eventually planned features that will not make 1st release but are going to be in this mod: * heavy caliber guns, eg howitzers and something to use on your gigantic warships and tanks * turreted guns which will have traverse and elevation controlled via keypad (now you need the robotics packs to make makeshift turrets) * lockon point defense turrets (will have very short ranges, but be designed to lock on and fire on missiles or debris) * tech tree integration with different weapon branches (eg heavy caliber tank guns, small caliber lightweight aircraft mounted guns, missiles, defensive technology, ect) * limited ammo * ammo extensions allowing one to bring extra ammo in a similar way to fuel * ammo production parts, allowing one to convert fuels, materials, ect, perhaps even electricity into ammunition And these are potential features i may or may not include but have thought about: * laser based weaponry * radar guidance for missiles that is subject to being jammed (mostly for multiplayer implementation) Finally, ive reconsidered my original stance and will take requests of specific weapons if enough people want them. LISCENSE: Please do not redistribute my 3d models without my permission and do not redistribute any code based on this mod without permission of both me and DYJ. Otherwise feel free to tinker with it as much as you like for personal use, just ask before releasing anything based on it.
  13. will do once its in alpha, ive decided to not wait till its 100% done, so itll have just a few guns and missiles (if romfarer doesnt mind since they are temporarily using romfarer.dll plugin) in initial package
  14. im not making it a WW1 gun specifically per say but there will be a exposed single low caliber machine gun that may or may not look like a WW1 gun (prolly 13mm or something like that as 8mm or less is gonna be useless given the KSP engine limits, less energy then so so and it becomes non lethal at all....), which should sortof fit WW1 style (it will be belt fed as i cant get a drum to animate properly (i did make a belt fed one though with animated links moving during firing). and im still trying to recode sound, to make them fire 1 sound per shot instead of looping we have now (not that looping is bad, but it requires specific sounds for every individual gun, which id rather not be forced to make), so hopefully ill have maybee 3 different sound effects for a low caliber mg, autocannon, and tank gun, im not making every single cannon have different sound as its overkill. and for anyone who would like a historical weapon included in this pack, please provide me with the 3d model for it (it can be from the internet or wherever, as long as im freely allowed to use it according to author's liscense). I have no plans to make historical weaponry (since KSP isnt exactly using any parts that are based on real life replicas and i dont really feel like being super focused on copying a real life object, easier to make something purely custom which looks good). only reason the gunpod in this pictures is based on a mg151/20 from WW2 is cause i had the model file on my machine already, all i did was tweak the back section to make it flat and support connecting to a node there if one doesnt want to mount it radially. All my other models are going to be more or less made up (except a friend of mine really wanted me to make a mig21's dual 23 gunpod, so i do plan on having that as the only other semi reality based cannon in this pack). Anyone who wants real life models, please provide a link to a already done 3d model, or make one yourself (i will credit anyone who helps add to this package).
  15. i am planning on this, just not in 1st release im gonna make my gunpod pack (if i can do it soon there will be a missile launcher pod as well), then eventually ill add tank guns i have a few models sitting around from the old days (used to mod this really old WW2 RTS a few years back, so i have plenty of turret and gun meshes to choose from, thats actually where i got the gunpod mesh, i just modded it with a shell ejector slot and changed teh back a bit) i will add tank guns and artillery eventually, its just not gonna be done right now, i can only do so much at a time (although if i can get it done soon i will add one surprise gun into this pack i wasnt planning on, one for tanks and heavy ships) all in all, ill defenetely add turrets or at least tank guns to this eventually, possibly use romfarer's sunbeam turret as a base plugin (you get a turret, ill just need to slow it down alot to balance it and possibly remove autoaim, or leave it in?), its just not gonna happen immediately, if you have a specific turret in mind i can try to model it, but i prefer working low poly (so its unlikely ill make anything super detailed), less work to manipulate models, and run smoother in game.
  16. here are a few pics of the mod im close to done with, still a few bugs and a few things im working on like animated ammunition belts, but more or less the idea is here, gunpods for those who want something a bit more conventional...... i have 4 different types almost done, this is the only one sofar that ive compiled and made work in game atm this model has a 20mm and a 30mm variant as you can see in pics
  17. here are a few pics of my Tri-Fighter G (its a F but with weapons, G is basically weaponized F model) armed with 30mm gunpods from a mod thats close to release hopefully this shows the craft somewhat well, cockpit is still not done (i replaced it with just 2 pylons for looks and a rcs tank instead of windows the F model is really as simple as i can get a semi viper II look alike to get. I sortof put preformace and part count as priorities here, lost a bit of looks, but those epic gunpods totally fit ALOT better then DYJ's minigun i used to use before i managed to get a mk108 gunpod model i made way back for another game but never used for anything to import to KSP.
  18. i dont know what on earth i did but i fixed it thx for your effort guys, even if i dont really know what on earth i did to make it work finally have tracers defined in each part file, so i can shoot rainbows (or at least make the sci-fi gunpods shoot blue/purple, conventional ones shoot red/orange/yellow/white) now i have another question, how can i make a random vector modifier? i have a vector that defines the direction the bullet is going, but i want to be able to add some random spread (preferable configurable by a modifier that can be made to work. ***How can i implement random bullet spread in this code?*** also, ***How can i modify bullet initial velocity?*** here is what i have sofar (based on DYJ's minigun code, modified to be used with my upcoming gunpods and missile pack mod release): using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; namespace AKSKineticEnergyWeapon { public class AKSKineticEnergyWeapon : PartModule { [KSPField] public string keyFire = "joystick button 0"; [KSPField] public string keyFirealt = "[0]"; [KSPField] public float BulletMass = 0.5f; [KSPField] public float BulletDrag = 0.05f; [KSPField] public float BulletPower = 120f; [KSPField] public float recoilreductionfactor = 0.1f; [KSPField] public float fireRate = 0.08f; [KSPField] public float lackofkrakensbanontrailrendererscompensation = 0.2f; public string test; public FXGroup sound = null; [KSPField] public string soundfilelocation = "AKSTechnologies/sounds/20mm"; private float nextFire = 0.0f; public const string quote = "\""; [KSPField] public float rotationSpeed = 1200f; [KSPField] public bool isGatling = false; [KSPField] public float heatProduction = 800; [KSPField] public string ProjectileFileLoc; [KSPField] public string CasingFileLoc; private VInfoBox heatGauge = null; [KSPField] public string ProjectileType; [KSPField] public bool CasingCollision = false; [KSPField] public string Casinglocationwithquotes; [KSPField] public float color_red = 1.0f; [KSPField] public float color_green = 0.0f; [KSPField] public float color_blue = 0.0f; public Color tracerColor; public GameObject Bullet, Casing, Muzzlefx, Rocketfx; public override void OnStart(PartModule.StartState state) { if (!Bullet) { //Bullet = PartReader.Read(KSPUtil.ApplicationRootPath + ProjectileFileLoc, "model", ".mu"); Bullet = GameDatabase.Instance.GetModel("AKSTechnologies/Parts/bulletcasing/Bullet/model"); Bullet.name = "Bullet"; Bullet.transform.position = new Vector3(1e10f, 1e10f, 1e10f); Bullet.SetActive(true); if (ProjectileType == "bullet") { Casing = GameDatabase.Instance.GetModel("AKSTechnologies/Parts/bulletcasing/Casing/model"); Casing.name = "Casing"; Casing.transform.position = new Vector3(1e10f, 1e10f, 1e10f); Casing.SetActive(true); } } Muzzlefx = (GameObject)GameObject.Instantiate(UnityEngine.Resources.Load("Effects/fx_exhaustFlame_yellow")); Muzzlefx.particleEmitter.emit = false; Muzzlefx.transform.parent = (transform.Find("model/MuzzleLoc")); Muzzlefx.transform.localPosition = new Vector3(0, -0.5F, 0); Muzzlefx.transform.localRotation = this.part.transform.rotation; Muzzlefx.particleEmitter.useWorldSpace = false; Muzzlefx.particleEmitter.minSize = Muzzlefx.particleEmitter.maxSize = 0.75f; Muzzlefx.particleEmitter.localVelocity = Vector3.zero; sound.audio = gameObject.AddComponent<AudioSource>(); sound.audio.volume = GameSettings.SHIP_VOLUME; sound.audio.maxDistance = 10; sound.audio.Stop(); sound.audio.clip = GameDatabase.Instance.GetAudioClip("AKSTechnologies/Sounds/20mm"); sound.audio.loop = true; //tracer color defenition tracerColor = new Color(color_red, color_green, color_blue); } public void Update() { if (!HighLogic.LoadedSceneIsFlight) return; if (vessel == null) { return; } if (this.part.temperature > this.part.maxTemp * 0.3F) { if (heatGauge == null) heatGauge = InitHeatGauge(this.part); heatGauge.SetValue(this.part.temperature, this.part.maxTemp, this.part.maxTemp); } else if (heatGauge != null) { this.part.stackIcon.ClearInfoBoxes(); heatGauge = null; } //sound playing additional information if ((Input.GetKeyDown(keyFire) == true || Input.GetKeyDown(keyFirealt)) && (vessel.isActiveVessel == true)) sound.audio.Play(); if ((Input.GetKeyUp(keyFire) == true || Input.GetKeyUp(keyFirealt)) && (vessel.isActiveVessel == true)) sound.audio.Stop(); if ((Input.GetKey(keyFire) || Input.GetKey(keyFirealt)) && (Time.time > nextFire) && (vessel.isActiveVessel == true)) { nextFire = Time.time + fireRate; GameObject newBullet = (GameObject)GameObject.Instantiate(Bullet); this.part.transform.rigidbody.AddForce(-part.transform.up * BulletPower * recoilreductionfactor, ForceMode.Impulse); Vector3d orbitalVelocity = vessel.orbit.GetVel(); Vector3d airVelocity = vessel.mainBody.getRFrmVel(vessel.findWorldCenterOfMass()); Vector3d relativeVelocity = ((orbitalVelocity - airVelocity) * lackofkrakensbanontrailrendererscompensation); if (Krakensbane.GetFrameVelocityV3f() == Vector3.zero) { newBullet.transform.position = (transform.Find("model/MuzzleLoc").position); } else { newBullet.transform.position = (transform.Find("model/MuzzleLoc").position); } if (ProjectileType == "bullet") { newBullet.transform.rotation = part.transform.rotation; newBullet.AddComponent<Rigidbody>(); newBullet.rigidbody.mass = BulletMass; newBullet.rigidbody.drag = BulletDrag; Muzzlefx.particleEmitter.emit = true; newBullet.AddComponent<Hit>(); newBullet.AddComponent<Bulleteffects>(); /* casing spawn code, disabled for now as current gunpod 3d models lack shell ejection ports and look weird with random shells spawning GameObject newCasing = (GameObject)GameObject.Instantiate(Casing); newCasing.transform.position = transform.Find("model/CasingLoc").position; newCasing.AddComponent<Rigidbody>(); newCasing.transform.rotation = UnityEngine.Random.rotation; newCasing.rigidbody.velocity = (this.vessel.rigidbody.velocity); newCasing.rigidbody.AddForce(part.transform.forward * 2, ForceMode.Impulse); newCasing.rigidbody.drag = 0.9f; newCasing.rigidbody.detectCollisions = false; if (CasingCollision == true) { newCasing.AddComponent<SphereCollider>(); } newCasing.AddComponent<CasingCleanup>(); */ newBullet.rigidbody.velocity = this.vessel.rigidbody.velocity; newBullet.rigidbody.AddForce(part.transform.up * BulletPower, ForceMode.Impulse); newBullet.rigidbody.interpolation = RigidbodyInterpolation.Interpolate; newBullet.AddComponent<physicalObject>(); } /* unused code leftover from DYJ's original, keeping incase rocket launcher pods are implemented if (ProjectileType == "rocket") { newBullet.transform.rotation = part.transform.rotation; newBullet.AddComponent<Rigidbody>(); newBullet.AddComponent<physicalObject>(); newBullet.rigidbody.mass = BulletMass; newBullet.rigidbody.drag = BulletDrag; //print("Bulletcreated"); newBullet.AddComponent<ExplosiveHit>(); newBullet.AddComponent<Rocketeffects>(); newBullet.rigidbody.velocity = this.vessel.rigidbody.velocity; newBullet.rigidbody.AddForce(part.transform.up * BulletPower, ForceMode.Force); newBullet.rigidbody.interpolation = RigidbodyInterpolation.Interpolate; } */ } else { Muzzlefx.particleEmitter.emit = false; } if ((Input.GetKey(keyFire) || Input.GetKey(keyFirealt)) && (vessel.isActiveVessel == true)) { this.rigidbody.AddForce(part.transform.up * (-BulletPower * recoilreductionfactor), ForceMode.Force); part.temperature += heatProduction * TimeWarp.deltaTime; /* unused currently, will be reused later once models get animated moving shell feed belting if (isGatling == true) { Transform Barrels = base.transform.FindChild("model").FindChild("Base").FindChild("Barrelparent"); Barrels.transform.Rotate(Vector3.forward * (rotationSpeed * TimeWarp.deltaTime)); } */ } } static public VInfoBox InitHeatGauge(Part p) { VInfoBox v = p.stackIcon.DisplayInfo(); v.SetMsgBgColor(XKCDColors.DarkRed); v.SetMsgTextColor(XKCDColors.Orange); v.SetMessage("Overheat"); v.SetProgressBarBgColor(XKCDColors.DarkRed); v.SetProgressBarColor(XKCDColors.Orange); return v; } } public class CasingCleanup : MonoBehaviour { public float casingTimeout = 1.5f; void Awake() { Destroy(this.gameObject, (casingTimeout)); } } public class Hit : MonoBehaviour { public void OnCollisionEnter(Collision collision) { Destroy(this.gameObject, 0.1f); //print("Hit!"); } } public class ExplosiveHit : MonoBehaviour { public void OnCollisionEnter(Collision collision) { Destroy(this.gameObject, 0.1f); //print("Hit!"); } } public class Bulleteffects : MonoBehaviour { public float bulletTimeout = 5.0f; public Shader shader1 = Shader.Find("Transparent/VertexLit"); public Color tracerColor; void Awake() { this.gameObject.AddComponent<TrailRenderer>(); TrailRenderer trailRenderer = (TrailRenderer)this.gameObject.renderer; trailRenderer.time = 0.2f; trailRenderer.startWidth = 0.15f; trailRenderer.endWidth = 0.0f; trailRenderer.autodestruct = true; trailRenderer.material.shader = shader1; trailRenderer.material.SetColor("_Emission", tracerColor); trailRenderer.material.SetColor("_Color", tracerColor); Destroy(this.gameObject, (bulletTimeout)); this.gameObject.AddComponent<Light>(); this.gameObject.light.type = LightType.Point; this.gameObject.light.color = tracerColor; this.gameObject.light.range = 5f; this.gameObject.light.intensity = 0.5F; this.gameObject.light.renderMode = LightRenderMode.ForcePixel; } } public class Rocketeffects : MonoBehaviour //unused for now, will be needed once rocket pod implemented { public float bulletTimeout = 5.0f; public GameObject Rocketfx; [KSPField] public float RocketPower = 10f; void Awake() { Rocketfx = (GameObject)GameObject.Instantiate(UnityEngine.Resources.Load("Effects/fx_exhaustFlame_blue")); Rocketfx.particleEmitter.emit = true; Rocketfx.transform.parent = (transform.Find("model/FFarRocket")); Rocketfx.transform.localPosition = new Vector3(0, -0.5F, 0); Rocketfx.particleEmitter.useWorldSpace = false; print(transform.Find("model/FFarRocket")); Destroy(this.gameObject, (bulletTimeout)); this.gameObject.AddComponent<Light>(); this.gameObject.light.type = LightType.Point; this.gameObject.light.color = Color.red; this.gameObject.light.range = 25f; this.gameObject.light.intensity = 0.5F; this.gameObject.light.renderMode = LightRenderMode.ForcePixel; } } } now i know basic C# coding, but as to how im going to make variable initial velocity (need that since a 30mm snub nose cannon is obviously not the same as a 20mm high velocity long barrel gun), and also variable random spread (again, 30mm less accurate then 20mm in this case, so need to balance the 30mm firepower boost with spread)
  19. its giving me errors here the name color_red does not exist within the current context namely it doesnt want to accept anything but a number followed by f to designate it as a float so is there any way to get this to work? As in what i want to do in the end is define a color to be used for my weapon tracers, but have it defined in the part.cfg instead of in the dll, as it just makes no sense to define multiple projectiles when all im really changing between them is the color of the tracer left behind it.
  20. im working on a mod currently with such smaller guns the base 20mm gun will be based on a mg151/20 gunpod 3d model from another game i modeled but never implemented, so if you want WW2 plane weapons its as close as you will get (mg151/20 was on a bf109 fighter if i am correct?) anyways, itll have all sorts of gunpods/weapons in it, possibly even a rocket launcher pod, all based off DYJ's mod, each gun having a different amount of firepower, weight, rof ect as for how to make the model work, i figured out certain parts need to be named properly or the bullets will have nowhere to spawn the name i believe you need a part of the model named is "muzzleloc", but decompile DYJ's minigun to be sure, i dont remember 100% what its called
  21. i will get it up on spaceport as soon as i can fix its instability at high speeds issue (its almost impossible to fly without asas on atm), just doesnt want to fly perfectly straight, if i cant get it fixed, ill give u a private link and maybee you can fix its issues regarding the stability also as for the later viper model VII, no clue how thats doable in KSP, its just that there are many parts of it that are more or less impossible to do with stock parts (namely we dont have a thin enough nose, the engines in KSP are too big for it, ect. Maybee a purely aspheitic model can be done, but to actually make it fly isnt gonna be easy at all. And yeah, cylon tech is impossible until the game makes wings reversible and not glitch physics if backwards ect. heavy raider may be doable, as my HK-R is at least semi flyable in its current state (even if its stability is very bad, and it doesnt have all features done like the hex gun mount and the oddly placed engine pods), but the regular raider cant be made without some wings that would function backwards or sideways how do i upload pictures of my stuff here anyways? no option but from URL, and my images are on computer? here is a link to my upload: http://kerbalspaceprogram.com/tri-fighter-iii-d-bsg-viper-mk-ii-stock-8/
  22. i will also come out with a smaller scale gunpods mod for use on aircraft ect based on the minigun, but hopefully more realistic, less damage (except for the 30mm cannons), less rate of fire, but reasonably heavy (prolly 0.3ish), and a smaller shape, and also hopefully without the glitches that cause your own ship to be shot apart when firing backwards or turning and shooting....
  23. i have one problem, im sortof new to C# and the code used in KSP, but i do have some programming experience how can i make a dynamic color definition? by this im asking how to define a dynamic color (its a color for a tracer if you want me to be specific) color i have currently is defined like this: public Color tracer = new Color(1.0, 1.0, 1.0); but i want to be able to use floats in the part's cfg file like so: [KSPField] public float color_red = 1.0f; [KSPField] public float color_green = 1.0f; [KSPField] public float color_blue = 1.0f; how do i code this in order to make these 3 variables dictate color of the tracer? i just want the part.cfg to dictate the variables the color is based off of, so each of the multiple gunpods i have dont require a entirely different projectile defenition, as thats just unnecessary code since i would think it is possible to just define tracer color in the part cfg.....
  24. i have a question, how can i code it to play a single sound fully every shot? i know how to make it play looping sounds on trigger press, but i dont really like that option when you have differeing rate of fire for 6 or so different gunpods im trying to code. already figured out how to make each gun use a different sound file, but i cant get the blasted thing to play a non looping sound once for every shot (i have alot of single shot sound files laying around, just cant figure out how to make each bullet fire a single shot), im no pro at C#, so help would be appreciated....just started modding KSP plugins a few weeks ago...
  25. Very useful thread Especially since i tend to design stuff to look like sci-fi ships, its nice to know how to properly hide parts, for example VTOL engines within fuel tanks, they dont stick out or cause any issues, nor do they ruin the look of the craft. One question, are there any tricks to getting clipped parts to accept the position easier? Cause it can be pretty annoying to have to spin parts, move em, rotate, toggle symmetry and hope one of these actions allows their attachment to whatever im trying to connect it to.....worst issue is when im trying to get a symmetry enabled feature to connect, its always one of the other mirrored entity refuses to attach....
×
×
  • Create New...