Jump to content

[PLUGIN] Gunner Mod (Upcoming Project)


jgjiscool

Recommended Posts

Big Red Button Pressers is proud to announce the latest project to hit our product line of... well... nothing:

GUNNER MOD

This plugin is in development at the moment based on my vague un-knowledge of C# and the help of the KSP files. If you have any ideas for this mod, you should share them here.

AT THE MOMENT:

This mod will create an actual machine gun part that you can use to conquer... your own inventions.

PROGRESS:

Observing KSP Files

Working

Creating Parts

Release

Link to comment
Share on other sites

I was thinking of that... I\'ll see what I can do.

Would be handy if you could allow access to the key binding to change it, in a .cfg or something. Would that be difficult?

Link to comment
Share on other sites

Would be handy if you could allow access to the key binding to change it, in a .cfg or something. Would that be difficult?

Hopefully not... If anyone else would like to help with the code, it would be good too. I reckon I could get it to read from the main CFG.

Link to comment
Share on other sites

If you want to access the .cfg files. It\'s fairly straightforward. Harvester has done a fantastic job with his parser!

To lay it out, anything declared as 'public' will be accessible to the config files, all you have to do is exactly match the name of the variable you used.

For example.

// Since this is public it will automatically be available to the cfg parser.
public string FireKey = 'F'; // Sets the default key for firing to F. This will be used if there is no 'FireKey' value in the .cfg file.

// now to use it.
if (Input.GetKeyDown(FireKey)) // Here we check if the key has been pressed 'down', it will return true only once per key press.
{
// Do your fire logic here
}
if (Input.GetKey(Firekey)) // if you hold down the key, it will return true every time. Useful for continuous effects, returns false if the key is up.
{
// Bang bang
}

// Over in the .cfg file just add this line anywhere
// This must be a valid key.

FireKey = T

Now you may be asking, how to create a projectile on the fly eh? Its going to be a little complicated because you need to create everything purely in script. But it can be done. You need to first create a 'GameObject' and attach to it everything that it requires. Such as a visual model, a physics collider and particle effects. Once you have built the game object, you can create clones of it with the 'Instantiate' command of unity.

I\'ll be glad to help you out with the code if you need it. But you may want to reference these links first.

http://unity3d.com/support/documentation/Manual/Instantiating%20Prefabs.html

http://unity3d.com/support/documentation/ScriptReference/Object.Instantiate.html

http://unity3d.com/support/documentation/ScriptReference/GameObject.AddComponent.html

Link to comment
Share on other sites

Now you may be asking, how to create a projectile on the fly eh? Its going to be a little complicated because you need to create everything purely in script. But it can be done. You need to first create a 'GameObject' and attach to it everything that it requires. Such as a visual model, a physics collider and particle effects. Once you have built the game object, you can create clones of it with the 'Instantiate' command of unity.

Or I can export a prefab out of unity itself?

Link to comment
Share on other sites

I\'m getting there guys! Sorry about the wait! I\'ve just finished Start-Stop 0.1 So will get working on this tonight. Still got some bugs with Start-Stop, but they can wait and I\'ll do a prelim release of it anyway. I\'m not giving up!

Link to comment
Share on other sites

  • 2 weeks later...

I want this so bad.

Trust me. I want this more than you to attempt work in a language I have NEVER used before. Ever. In my life.

I am testing my comprehension of Unity in this... endeavor that\'s for sure.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...