FORUM ARCHIVED

Question: Creating a Container Item

Discussion in 'Modding' started by seriouslysean, May 21, 2013.

  1. seriouslysean

    seriouslysean Member

    I've created an item called Tube of Pogs for my mod. I based it off of a potion but I think there might be a better way to get the result I'm looking for.

    Essentially, I'd like it to work like the Odius Puffballs, so that when you use it, it summons 3 pogs (and sometimes a slammer). All of that is working as a potion due to the spell I call, but it's using the potion animations (and referring to the item as a potion).

    Is there a way to have it referenced as a Container, instead of a Potion? Alternatively, is there a way to change the potion animation? If we figure this out here, I'll be happy to put it up on the Dredmod wiki.

    Code:
    <item name="Tube of Pogs" iconFile="items/90skid/container_tube_pogs.png" special="0" craftoutput="1" overrideClassName="Container">
      <price amount="0"/>
      <potion spell="Make Pogs"/>
      <!--anim sprite="sprites/sfx/psionic_generic/psionic_generic" frames="5" framerate="100" centerEffect="1"/-->
      <description text="This is your tube of Pogs. There are many like it, but this one is yours. It contains a few pogs. If you're lucky, you might even get a slammer!"/>
      </item>
     
  2. Kazeto

    Kazeto Member

    Not really. There were no "container" items in the game to begin with, and thus there is no way to declare an item to be one. Though you could change it so that it used the same animation as the puffball, which isn't perfect but still better than using the potion-drinking animation. Or alternatively, you could make it so that the spell summoned the pogs themselves rather than summoning the tube - I don't know why you chose to do it the way you did it so doing it this way might not be desired for you, but that's another way to do it.

    And there is no way to add new animations of the player character. Unless we veer into the area of insane ideas, but you don't want to go there since it's not worth the effort.
     
  3. seriouslysean

    seriouslysean Member

    Mostly I did it so if the player wanted to keep the tubes instead of spawning all of the pogs in to their bags, they could do that. It's not entirely necessary -- it's mostly for the nostalgia factor. I used to have tons of Pog Tubes, haha.

    As for the animation -- what's the proper way to change it? The <anim> tag I was using didn't work when it was uncommented. It still did the potion drink animation.
     
  4. Kazeto

    Kazeto Member

    Well, there's the "insane" way and not a "proper" one. So instead I'll explain what the "insane" way would do.

    Going that way, you could make it so that using the skill which gave you these pog tubes also transformed the player into something that looked like the playable character but had the animation changed - an effect similar to that the Werediggle Curse skill tree's transformation does, only using different sprites and not having any additional skills - with the effect being removed after the created pog tube is opened.
    Of course, such an approach is likely to make you want to ask "but why not just make it so that the item itself changed the animation?", to which I can reply "sadly, the action animations, including the potion-drinking one, are shown before the effects are calculated so linking the transformation to the item would result in said transformation happening after the potion-drinking animation is shown". And making it work that way would change the potion-drinking animation temporarily for all potions (as well as making it impossible to use your normal skills, which is something we don't want), not to mention the fact that the possibility of someone choosing a differently-gendered character makes it all even less usable.
    So in the end, it is some sort of "solution", but one which amounts to nothing more than a shoddy work-around with more cons than pros.

    Then again, had I been the one to make the whole skill, I would've made it differently. But that is something you might not want to hear about - not because I don't want you to know for whatever reason, but because my ideas (and what I do with the code) tend to be... less safe for sanity than you'd come to expect code to be (of the "why would you do that?" variety). Though if you really want to know, I can write about it, either in general so that you'd be able to build on it yourself or in detain if you wish for that (though I don't think you are a "give me the full solution with no work required" type of person so the latter seems unlikely for you to ask for).
     
    seriouslysean likes this.
  5. seriouslysean

    seriouslysean Member

    By all means, write it up. I'm really interested to see the method you'd go about doing it. I'm working off of "Look at that code, build mine similarly and then see what breaks" mentality. I've been going through all of the game and expansion code religiously, haha.
     
    Kazeto likes this.
  6. Kazeto

    Kazeto Member

    Sure thing. Though you'll have to wait about 17 hours (maybe add another hour for good measure) from now for it, seeing as I wrote this post just before going to bed for today (I just checked the forum for the last time before doing so) and I won't be able to write it before getting back from work tomorrow (which will be in about 16 hours, maybe slightly less depending on circumstances).
     
  7. Bohandas

    Bohandas Member

    You could make it a wand. The wand animation is at least more apropos than the potion animation.

    You CAN change the potion animation but it will change it for all potions and you may have to do the mod as a Total Conversion mod, which I have not experimented with.
     
    Kazeto and seriouslysean like this.
  8. seriouslysean

    seriouslysean Member

    Hm, wand might work. I might also just remove it entirely if I can't get it to work the way I want it to. I'm noticing more restrictions now that I'm starting to delve in to things a bit more.
     
    Kazeto likes this.
  9. Kazeto

    Kazeto Member

    Ugh, I'll post the code I promised to have ready today tomorrow. I spend an hour longer than I should have spent at work, and I'll have to be there tomorrow for the morning shift (instead of the afternoon shift as it was planned) due to some weird shenanigans happening, which is why I spend most of the time after getting back sleeping.

    Edit:
    And once again karma decided to act against me, and I had to spend the whole time I had yesterday getting my internet connection to work. I started writing on it now, so it ought to be done tomorrow. Unless something else happens, but I hope nothing will.
     
    seriouslysean likes this.
  10. seriouslysean

    seriouslysean Member

    Hey man, don't stress over it. I have no expectations. Life first, playing later ;)
     
    Kazeto likes this.