1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

Modding examples from devs

Discussion in 'Community Dev Corner' started by MM, Feb 28, 2014.

Mods: Downburst, Mazey
  1. MM

    MM THD Team THD Team Administrator Global Moderator

    Messages:
    327
    Rayne asked me recently for an example on how to make a custom block. It's relatively simple but if nobody shows you, you can get stuck. Trying to find how it works in one of the 200 game scripts can be overwhelming too. http://doc.kag2d.com might be useful but won't teach you how to implement.

    So I made an example for Rayne which will be included in the Mods folder in the next patch. I think this is the best way to learn how to make cool mods, by short examples.

    We think modding is the most important thing now for the future of KAG. Mods made by you have the most potential for bringing the awesomness from KAG.

    So, if you want me or Geti to write a short example of how to make something with scripts just ask and we'll try to write it and include in the next game patch.
     
  2. -Tj-

    -Tj- Sicarii Donator
    1. The Ivory Tower of Grammar-Nazis

    Messages:
    358
    This sounds awesome, it will help alot of new modders in the field and shed some insight on how one makes customs blocks.
     
  3. SnIcKeRs

    SnIcKeRs Bison Rider

    Messages:
    148
    Also skilled modders can help you make examples.
     
  4. 8x

    8x Elimination Et Choix Traduisant la Realité Forum Moderator Staff Alumni Tester
    1. The Young Blood Collective - [YB]

    Messages:
    1,325
    Sweet...
    Could you devs make an example mod with 3 kind of weapons -rifle, auto, shotgun- for the archer, which will be triggered by a single click and need you to press a key to reload?
     
    crackwise likes this.
  5. SnIcKeRs

    SnIcKeRs Bison Rider

    Messages:
    148
    It isnt simple example, its real mod
     
    Vampire, Rayne, 8x and 1 other person like this.
  6. MM

    MM THD Team THD Team Administrator Global Moderator

    Messages:
    327
    Anything more?
    We'll be focusing on mod examples and fixing bugs this week.
     
  7. 101i

    101i Haxor Forum Moderator Tester

    Messages:
    445
    A script to change the character bodies (More than heads)
     
  8. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    Code:
    //supply the filename of a new sprite with replacement frames
    void ChangeSprite(CSprite@ this, string filename) {
        this.ReloadSprite( filename, this.getConsts().frameWidth, this.getConsts().frameHeight,
                            this.getBlob().getTeamNum(), this.getBlob().getSkinNum() );
    }
    enjoy
     
    Noburu likes this.
  9. Mazey

    Mazey Haxor Global Moderator Forum Moderator Staff Alumni Donator Official Server Admin

    Messages:
    1,914
    Example on how to make custom reason to nextmap vote in-game.
     
  10. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    DefaultVotes.as line 30 to 37: (expanded to 38 due to the added line)

    Code:
    enum nextmap_reason {
        nextmap_reason_ruined = 0,
        nextmap_reason_stalemate,
        nextmap_reason_bugged,
        nextmap_reason_your_reason_here,
        nextmap_reason_count,
    };
    
    string[] nextmap_reason_string = { "Map Ruined", "Stalemate", "Game Bugged", "Your Reason Here" };
    Same goes for the handful of lines above it for votekicking reasons.
     
  11. SnIcKeRs

    SnIcKeRs Bison Rider

    Messages:
    148
    how to catch map changing or new round?
     
  12. crackwise

    crackwise Shipwright

    Messages:
    52
    Expanding your thought a little, a mod which makes the game a little similar to Soldat (but without jetpacks) with modern weapons and such would be very fun I think. But different from Soldat, you'll have the opportunity to build stuff around, dig trenches. You could even have tanks, helicopters, paratroopers, Anti-Air or Anti-Tank defence agains these things etc.

    You could have the different classes as well, such as assault troopers, engineers/sappers, medics etc.
     
  13. Mazey

    Mazey Haxor Global Moderator Forum Moderator Staff Alumni Donator Official Server Admin

    Messages:
    1,914
    No Gatu, customizable in-game like classic ;-;


    @SnIcKeRs
    Code:
    void onRestart( CRules@ this )
    {
    
    }
    I guess?
     
    Last edited: Mar 20, 2014
  14. SnIcKeRs

    SnIcKeRs Bison Rider

    Messages:
    148
    Doesnt work :(
     
  15. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    You sure? Might not work on the first round, but onRestart is how it's handled in the gamemode code.

    Not possible, at least currently; I didn't bind that menu text box thing because they require callback registration and a variable to write into - things that I'd have to create an interface to for AS, and that it wouldn't be hard to fuck up and crash the game with. Sorry about that.

    A possible workaround would be binding a chat command !kickreason or something and then using that, but you might have to change how the reason was synced, depending on how that's done now.


    Re: triple slash, multiple weapons etc - these are not trivial examples to provide, and triple slash in particular is something you should be able to nut out yourself from the existing double-slash code - you just need to detect the transition point from double to triple slash - like we already do from single to double. These modding examples aren't a "how to code" course, you need to pick that up yourself.

    Re: Changing weapons - I think Skinney and Rayne may have been working on something along those lines as part of their archer deathmatch mod thing. Either way it's not particularly hard but it requires quite a bit of code and a lot of assets - and if you're at the point where you're considering a heap of different weapons, you might want to just code them as separate blobs that you can pick up rather than try to put them all inside a single entity (the code would be MUCH cleaner with them as separate entities).
     
  16. Mazey

    Mazey Haxor Global Moderator Forum Moderator Staff Alumni Donator Official Server Admin

    Messages:
    1,914
    The old F3 (or whatever) mantis bug reporting has text box thingies?
     
  17. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    The old F5 mantis bug reporting thing isn't written in scripts?
     
  18. Mazey

    Mazey Haxor Global Moderator Forum Moderator Staff Alumni Donator Official Server Admin

    Messages:
    1,914
    Then do it pls.
     
  19. Rayne

    Rayne ༼ つ ◕_◕ ༽つ Administrator Global Moderator Forum Moderator Tester

    Messages:
    1,916
    tile animation based on tile hp in attacking blob code

    pls
     
Mods: Downburst, Mazey