Announcement

Collapse
No announcement yet.

Coding question for Wyz (or anyone else who wants to hop in)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Coding question for Wyz (or anyone else who wants to hop in)

    Hey Wyz, so here's my question from the other night:

    I'm trying to create a custom entity for my map, a death trigger that only kills marines. So I've just copied the DeathTrigger.lua and called it DeathTriggerMarines.lua, and I found the function that does the killing, and I figured I could just add a condition to the if statement that's already there to check the team. The if statement looks like this:

    if Server and HasMixin(entity, "Live") and entity:GetIsAlive() and entity:GetCanDie(true) then

    Problem is, I don't know the syntax for checking what team an entity belongs to, so I opened up Entity.lua and noticed that I couldn't find "GetIsAlive()" or "GetCanDie()" anywhere in the file... so where are those functions declared? I assume it's some sort of inheritance, but I can't figure out where it's inheriting from.

    Slightly related, if I type "entity:" it brings up a few things I could complete it with, but none of the ones listed above... is there a way to add these into decoda? I've gotten so accustomed to using the auto complete in eclipse when writing Java, I just can't live without it anymore!

    I figure there's a lot more to adding an entity than I've hit on here (like what in the hell is a mixin????) but these are just the first few questions I've had pop up.

    EDIT: Oh nobody look at me, I'm a moron! The MIXIN is where it's inheriting functions from!!! There they are... LiveMixin.lua...

  • #2
    Re: Coding question for Wyz (or anyone else who wants to hop in)

    I haven't used Mixins in my development, so I sadly can't speak to using them in yours. I'm glad you found the method declarations.

    ns2\lua\TeamMixin.lua defines GetTeamNumber(), and TeamMixin is referenced by entities in the game that have a team.

    Does that get you closer to where you need to be?

    You'll not get IDE help as intelligent as Java offers, due to Lua being interpreted. I use Sublime, with a project to make file navigation/searching very easy.

    I'd be happy to show you one night. Wanna?
    Steam Community? Add me. | Free Remote, Encrypted Backup

    Darkilla: In short, NS is pretty much really fast chess. With guns. Apophis: I haven't seen anyone say that SM's are better than non-SMs. Nordbomber: This is THE first server I've seen where either side can comeback from out of seemingly nowhere with the right teamwork. en4rcment: I have NEVER experienced the type of gameplay that I have found here. Nightly I am amazed at the personalities and gaming talent. Zephyr: Apophis is clearly a highly sophisticated self-aware AI construct that runs on a highly modified toaster oven in Wyzcrak's basement.

    Comment


    • #3
      Re: Coding question for Wyz (or anyone else who wants to hop in)

      Originally posted by Wyzcrak View Post
      I haven't used Mixins in my development, so I sadly can't speak to using them in yours. I'm glad you found the method declarations.

      ns2\lua\TeamMixin.lua defines GetTeamNumber(), and TeamMixin is referenced by entities in the game that have a team.

      Does that get you closer to where you need to be?

      You'll not get IDE help as intelligent as Java offers, due to Lua being interpreted. I use Sublime, with a project to make file navigation/searching very easy.

      I'd be happy to show you one night. Wanna?
      I managed to get it working too, but I'd love to see what tools you work with. What night would you be free?

      What do you mean interpreted? Java is interpreted too (unless you meant something else?)

      Comment


      • #4
        Re: Coding question for Wyz (or anyone else who wants to hop in)

        Tonight? 8:00 PM Central?

        Jargon snafu on my part. I should have said "dynamic". Lua is /dynamically/ typed, and IDE auto-completion for such languages is typically less-impressive than for statically typed languages (e.g. Java), as knowing what properties/methods/etc to offer for auto-complete on any given variable is risky, given that the variables' type is so difficult to reliably keep track of w/o running the code.
        Steam Community? Add me. | Free Remote, Encrypted Backup

        Darkilla: In short, NS is pretty much really fast chess. With guns. Apophis: I haven't seen anyone say that SM's are better than non-SMs. Nordbomber: This is THE first server I've seen where either side can comeback from out of seemingly nowhere with the right teamwork. en4rcment: I have NEVER experienced the type of gameplay that I have found here. Nightly I am amazed at the personalities and gaming talent. Zephyr: Apophis is clearly a highly sophisticated self-aware AI construct that runs on a highly modified toaster oven in Wyzcrak's basement.

        Comment


        • #5
          Re: Coding question for Wyz (or anyone else who wants to hop in)

          Originally posted by Wyzcrak View Post
          Tonight? 8:00 PM Central?

          Jargon snafu on my part. I should have said "dynamic". Lua is /dynamically/ typed, and IDE auto-completion for such languages is typically less-impressive than for statically typed languages (e.g. Java), as knowing what properties/methods/etc to offer for auto-complete on any given variable is risky, given that the variables' type is so difficult to reliably keep track of w/o running the code.
          Ah I see.

          Yea hopefully 8pm will work for me. We just upgraded our internet here, which involved getting a new modem... which... is working perfectly for me, and one other computer, but for whatever reason, one computer's download speed dropped dramatically, while upload speed went up to what it should be... so I need time to figure out what kind of hell on earth I should prepare for. I'll try to be done by 8, but I'll let you know by 7 if I can't make it.

          Comment


          • #6
            Re: Coding question for Wyz (or anyone else who wants to hop in)

            I don't need any advanced notice, really. And I can meet later than that if it suits you. I'm pretty flexible once kiddo bedtimes happen.
            Steam Community? Add me. | Free Remote, Encrypted Backup

            Darkilla: In short, NS is pretty much really fast chess. With guns. Apophis: I haven't seen anyone say that SM's are better than non-SMs. Nordbomber: This is THE first server I've seen where either side can comeback from out of seemingly nowhere with the right teamwork. en4rcment: I have NEVER experienced the type of gameplay that I have found here. Nightly I am amazed at the personalities and gaming talent. Zephyr: Apophis is clearly a highly sophisticated self-aware AI construct that runs on a highly modified toaster oven in Wyzcrak's basement.

            Comment


            • #7
              Re: Coding question for Wyz (or anyone else who wants to hop in)

              Hey, I sent you a message on steam, not sure if you got it, but 8 works for me, for sure.

              Comment

              Connect

              Collapse

              TeamSpeak 3 Server

              Collapse

              Advertisement

              Collapse

              Twitter Feed

              Collapse

              Working...
              X