Ranger's Open Source tConfig Code

Discussion in 'Released Mods' started by LoneRanger121, Jan 28, 2013.

  1. LoneRanger121

    LoneRanger121 Zombie

    Come one, come all, and enjoy these delicate, unique pieces of code I have put together:

    Throwables NPC AI (open)

    public void AI()
        int x = (int)Main.player[npc.target].position.X;
        int y = (int)Main.player[npc.target].position.Y;
        if(npc.velocity.Y == 0)
            npc.velocity.X += 0.2F * npc.direction;
        if (npc.life <= 150) {
        if ((npc.ai[0] >= 90) && (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)))
            float Speed = 20f;     
            Vector2 vector8 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc.height / 2));
            int damage = 30;
            int type = Config.projectileID["Poisoned Knife"];
            Main.PlaySound(2, (int) npc.position.X, (int) npc.position.Y, 1);
            float rotation = (float) Math.Atan2(vector8.Y-(Main.player[npc.target].position.Y+(Main.player[npc.target].height * 0.5f)), vector8.X-(Main.player[npc.target].position.X+(Main.player[npc.target].width * 0.5f)));
            int num54 = Projectile.NewProjectile(vector8.X, vector8.Y,(float)((Math.Cos(rotation) * Speed)*-1),(float)((Math.Sin(rotation) * Speed)*-1), type, damage, 0f, 255);
            Main.projectile[num54].hostile = true;
            Main.projectile[num54].friendly = false;
            npc.ai[0] = 0;
    Change "Poisoned Knife" to any of the throwables for a cool (or deadly!) combination! (ex. Shuriken, Throwing Knife, Grenades!)

    As I develop more bits and pieces of unique code, I will post them here for the exploitation and enjoyment of fellow modders.
    Sapharan likes this.
  2. Yoraiz0r

    Yoraiz0r The Wizard

    so basically this npc charges at the player at a semi dramatic speed , and throws knives on the way , and halves its knife throwing intervals if its health is lower then 50..

    Anyways the OP name is bad , all the mods in tConfig include their source anyways.
  3. LoneRanger121

    LoneRanger121 Zombie

    Pretty much, but the point of posting this is because I probably won't use this code for a long time, so I might as well just put it out there now for anybody who wants it.
  4. Mr.Person

    Mr.Person Moth

    I don't see the point of this...
  5. LoneRanger121

    LoneRanger121 Zombie

    For those who are new to, or just looking for a snippet for tConfig, can have these little bits of code (which the Throwables NPC AI took me a few days to create) to use in their mods. In the future it may expand past just me to include helpful bits of code from multiple coders to build practically a library of possible code combinations to help anybody develop their own code in a matter of minutes; although it would be a little unrewarding for those who contributed, it would allow for a broader selection of mods - and if you can't find one to suit your needs, an easy way to produce one yourself.
  6. Yoraiz0r

    Yoraiz0r The Wizard

    -can't see how this code would take days to create , if you had issues creating it you should've just asked on the tConfig thread.
    -I don't really like the idea of making a premade code snippet library , simply for the fact that people wouldn't learn how to make things themselves that way.
  7. LoneRanger121

    LoneRanger121 Zombie

    - I did ask on the tConfig thread, remember? I was learning C#, and needed a little help to understand the framework of Terraria/tConfig.
    - For those that want to learn it, that's their choice. If they don't, then the snippet library would allow them to quickly make something.
  8. Shockah

    Shockah Grandson of the Wizard

    We don't really want to see more mods that are made by putting some pieces of code together to work, don't you think?
  9. LoneRanger121

    LoneRanger121 Zombie

    Not necessarily public mods; what I intend for this to do is allow for personal mods to be make easily if you are getting bored with the game and need a little of your own boost. In my honest opinion, a lot of mods I see don't quite fit the personality of myself or the game; be it too far-fetched, game-changing, or otherwise. If there is a snippet library, I could piece together a simple 'Creeping Angels' mod for myself in a matter of minutes.
  10. Sapharan

    Sapharan Penguin

    All like the idea for snippet library. Sometimes i ask for help, and i get help. But, asking constantly can be annoying. Some people want to make cool ideas into mods, but have problems learning how to write a snippet that will do what they want. Why waste a good idea, when you can search for a snippet that probably will fit their idea. Odcourse, it has to be credited properly, but look, we don't have much mods for terraria. Maybe, when snippet library will be done, then we will have very cool mods. Ofcourse, we already have very cool mods, for example Yorai's mods, or Shockah mods. Those are unique. And look at Omnirs nostalgia pack, witch adds tons of unique monsters into game. All AI is written by himself (most probably, i'm not 100% sure, correct me if i'm wrong). But, not every one can do that. Ofcourse, i don't want to take away everything what makes great modders a great modder, no. I just wan't bigger mod database. Look at minecraft. It mas massive amount of mods, and a huge bit of them are very good, and interesting mods. Yes, i know, Minecraft is much easier to mod, but why don't make easier for Terraria to mod? That's what i feel about snippet library, and i think, everyone could add something to it. Because, hey, why not? You will still make great mods, but let anyone make good mod.
  11. Shockah

    Shockah Grandson of the Wizard

    How about "no"? Do you really want to see shitty, copy-pasted mods on these forums? At least they're all original right now.
  12. Titot

    Titot Slimed Zombie

    can i ask what is that? xD
  13. Sapharan

    Sapharan Penguin

    But look what's happening now? Do you see many good mods? No, there are few good mods. And with that, soon fun with terraria mods will die. I don't ask for pasting here complicated codes that will change the gameplay like 180 degrees. No. The purpose of this would be that someone would easly make just a small thing.
    Example: i want my weapon to make paricle effect and glow. Why bother flooding tconfig thread with the same question over, and over again, when this simple thing would be here. Many things, that are in vanilla terraria still require scripting. "Hey i want to make flail" <- I saw this very often on tconfig thread. Every time posted by different person. Why repeat questions, and requests about that simple things? And asking about things that are ALREADY in terraria?
    SpasticTiler likes this.
  14. SpasticTiler

    SpasticTiler Green Slime

    Isn't it odd the only "good" and "original" mods are by the very same group (almost exclusively) that are currently working on TConfig? Anything clever gets coded right out in a new version of TConfig, thus making it harder, not easier, for any person new to modding not to feel forced into a "cut 'n paste" situation. Read the description for TConfig on the Wiki:

    "Modding with tConfig was carefully designed so that you don't need any programming knowledge to get started, though it will help a lot. For the more advanced users, tConfig also allows you create scripts written in C# which are seamlessly integrated with items and other game objects which allow you to really push the game to its limits."

    "...so that you DON'T need any programming knowledge..." - seems to me you need quite a BIT of knowledge now (the last "layman's" build of TConfig had to have been 27.2)

    So, ok, they go out and get the knowledge..."For the more advanced users, tConfig also allows you create scripts..." - whose scripts? It would be somewhat difficult to generate one's own "original" code, when tConfig tends to favor the code that's been put in place by who...? The Team working on it, of course! They know the code that works, of COURSE they can make "functional" mods!

    The issue here is that tConfig itself has turned into a beast few can tame, save for the actual writers/developers...not for the new and inexperienced. So yes, a snippet library might benefit some of the less experienced (perhaps with some detailed write-in descriptors in the code as to what each line actually does) as well as generate a LOT more free time for the more experienced and modding Elite to focus on making MORE "Original" content (and no, I'm not ignoring the 50-odd thousand repro's of armor and reskins of vanilla weaponry with some glitter for effect), as opposed to answering every piddly question a newbie (myself included) might have....I think we might just be smart enough to be able to learn on our own....not have our hands held ALL the time...
  15. LoneRanger121

    LoneRanger121 Zombie

    If there is enough support for the project, then I'll consider making a public thread to work with snippet submissions and find a site capable of storing the snippets in a library of sorts.
  16. Shockah

    Shockah Grandson of the Wizard

    You have it all backwards. You don't learn how to make advanced mods by copy-pasting stuff, but by looking at the source and maybe checking out examples. You can get the source by decompiling, and examples in mods.
    In my honest opinion, if someone just can't write his own code, then he shouldn't mod any game. Unfortunately, that doesn't work very well with tConfig, which uses INI files for much of the stuff. And that's a shame.
  17. Sapharan

    Sapharan Penguin

    I know that. But hey, is this something that your life depends on? No. This is somthing that you do for fun, something that you enjoy. And for that, every one have right. To do something that is making them feel good. When i have an idea, and then scrap it, because i can't do this, this is good? Nope. But when i find the possibility to do this stuff, then i'm happy. And that's what's it all about.

    Yes, you can get source, that is well known. But you need to know at least some basics. And come on, it's still resulting in copy/pasting, so it doesn't make any difference. Anyway, you think that only "chosen ones" can do modding? If i want, i learn and do this to. Anyone can. And if tConfig is giving me easy tools to do this, i use them. It doesn't matter if you don't like it, most people like it. Surfpup is making everyone happy, by giving everyone a "tool", with wich you can make simple mods, without knowledge, and some unique mods, with knowledge.

    You see this idea as something bad, but why not just see it from the other side. There's a second side of the medal. It will HELP people.

    EDIT: Ah, and i forgot to mention that some snippets and instructions already exist on tConfig wiki. But there wasn't any new snippet, help or tutorial in.. i don't know... a year? So why don't bring it here, or just make a wiki with them?
    LoneRanger121 likes this.
  18. blahblahbal

    blahblahbal Anomura Fungus

    I think this is kind of a neutral thing. I can see both sides of the coin here, being that I had to pretty much teach myself how to do C# coding. I was familiar with C before I came to modding Terraria, and that helped me some, but it didn't prepare me for most of the things that I had to accomplish. Sure, I asked on the tConfig thread. Sure, I didn't get responses all the time. That's why I can see the benefit of this.

    On the other hand, Shockah is right. If you don't know how to code, you shouldn't be modding. tConfig makes this pretty much null and void(lol programming). With INIs, you can successfully mod Terraria through making new items. But you're never going to see a "good" mod that only has INI stuff. It HAS to have CS files as well. While it's true that most of the "good" and "original" mods come from the creators/helpers on the tConfig team, I feel that some mods have come from others, such as mine(not necessarily saying mine is "good" and "original", but meh). Omnir's is good, so is Obsidian's.

    Just my point of view.
    LoneRanger121 and PoroCYon like this.
  19. LoneRanger121

    LoneRanger121 Zombie

    I honestly don't see the negative side of the argument. You're saying that if they have a broad imagination but just don't know how to employ it, they should just forget about it? That makes no sense to me: "If you don't know how to code, you shouldn't be modding" is just a negative, and personally offensive, way of telling people that only the self-righteous and self-proclaimed modders can do the work. Where does that get anybody? Relying on you to do their work. Not only does it lift the load from you, but it lets creativity be expressed. Why inhibit it?
    Sapharan likes this.

Share This Page