Trying to make something the forum will appreciate...

Discussion in 'Modding' started by Vitellozzo, Aug 13, 2013.

  1. Vitellozzo

    Vitellozzo Member

    ...but, since my mod curriculum is just about making some sort of minor changes to already made codes, I'm encountering difficulties.
    The first thing I would like to figure entirely is the entire "spell mine" essence:
    Code:
    mine="1"
          mineradius="x"
          minePermanent="x"
          mineTimer="x"
          mineSpriteDrawOrder="x"
          mineSpritePNGSeries="sprites/folder/basicspritename"
          mineSpritePNGFirst="x"
          mineSpritePNGNum="x"
          mineSpritePNGRate="xxx" 
    Can someone help me read all this code?
    The first one is obvious, if there is a spellmine or not; radius is pretty easy, how much wide the spellmine is - but permanent? Timer?
    For the sprites, I know I have to write all the folder path to the .png files, but why the name of the sprite must be spritename without even a number? Like mineSpritePNGSeries="sprites/sfx/divine_inscription/divine_inscription", it reads crazy for me. The draw order is something I also didn't understand, while PNGFirst must be the final number for the first .png making the sprite, while PNGNum must be how many .png are there to make the entire sprite. But... PNGRate?

    Also there's something more it's bugging me: how can I make a spell trigger only for the player? I know the player can trigger every taxa-only spell, but there's a more clean way to do that, instead of just making something like taxa="human"?

    Finally, I cannot understand why the Lured buff keeps activating on player, even with that self="0" tag.
    Code:
    <spell name="Lured" type="target" icon="skills/tracker32.png" wand="1" >
      <buff useTimer="1" time="30" self="0" allowstacking="0" icon="skills/tracker64.png" smallicon="skills/tracker32.png" >
      <halo name="sprites/sfx/rage/rage" first="0" num="3" frameRate="100"/>
      <primarybuff id="2" amount="-1"/> <!-- Nimbleness -->
      <secondarybuff id="10" amount="-2"/> <!-- armor -->
        <secondarybuff id="6" amount="-15"/>
        <secondarybuff id="7" amount="-15"/>
        <secondarybuff id="8" amount="-15"/>
      <secondarybuff id="2" amount="-2"/> <!-- melee power -->
      <resistbuff crushing="-1" slashing="-1" />
      </buff>
      <description text="This monster has been lured toward you!"/>
      <anim sprite="sprites/sfx/hero_glow/hero_glow" frames="3" framerate="60" sfx="magic" centerEffect="1"/>
      </spell>
    
    I will post more questions as they come in my mind, since I really want to finish this work of mine to show you.
     
    Last edited: Aug 13, 2013
    Kazeto likes this.
  2. Syphonix

    Syphonix Member

    minePermanent = (either "0" or "1")
    If it is set to 0, then the mine will disappear as soon as it is stepped on (it still deals damage/trigger spells). If it is set to 1, they will stick around and continue to deal damage/trigger spells every turn for the duration. A good example of a permanent mine is the acid pool left behind by Blobby attacks.

    mineTimer = (a numeric value)
    All this does is set how long these mines last, in turns.

    mineSpriteDrawOrder = (either "0" or "1")
    If it is set to 1, then it will draw the sprites in order, starting at the sprite number set in mineSpritePNGFirst, and ending a number of frames after it equal to the number set in mineSpritePNGNum. If it is set to 0, it will draw the sprites in a randomly selected order.

    mineSpritePNGSeries = (path to a series of sprites)
    In your example, the game would look in "sprites/folder" for a series of numbered PNG files that each begin with "basicspritename." In that folder should be a series of PNG files named basicspritename000.png, basicspritename0001.png, and so on. Collectively, you can think of these as an animation. Ignore the numbers when you think about the animation that you're pointing to with this function. The numbers tell the game what frame it is in the order of the animation.

    mineSpritePNGFirst = (a numeric value)
    What frame to start at in the PNG series. 0000 is frame 1, 0001 is frame 2, and so on.

    mineSpritePNGNum = (a numeric value)
    How many frames to draw from the starting frame, including the starting frame. Usually, you will just input the total number of frames in the animation here. For example, divine_inscription0000.png to divine_inscription0003.png is 4 frames long, so you would put 4 in here. If you didn't actually want to use all the frames, you could put 3 in to this example and it would draw from divine_inscription0000.png to divine_inscription0002.png. Unless, of course, mineSpritePNGFirst is set to, let's say, "2." Then it would start at divine_inscription0001.png and draw that many frames deep.

    mineSpritePNGRate = (a numeric value, representing milliseconds)
    How long it takes to draw the frames. If you set this number low, the animation will draw faster. Higher numbers draw the frames slower. Usually I set this to 80 and adjust from there as necessary.


    As for the buff activating on the player, self="0" only stops the buff from automatically assuming that it goes on the player. BUT, if the player is somehow also a TARGET of the spell or a spell that calls on this buff, then it is entirely possible that he can still be hit with and receive it. Self="0" doesn't mean the player cannot ever receive the buff. He just has to be a valid target instead of it being just thrown on him/her.
     
    Kazeto and Vitellozzo like this.
  3. Vitellozzo

    Vitellozzo Member

    Thanks, now the thing makes a lot of more sense to me. It's strange that there isn't even the smallest description for spellmines on Dredmod, but this forum is great for this: awesome users.

    Anyway, I have to make somehow a spellmine which can affect monsters in a way, and the player (and only the player) in an entire new way (read as two different buffs). I have to find a way to do this since it's the last thing this sort of spell needs in my spelldb to let me do the rest of things my "mod" needs.
     
    Kazeto likes this.
  4. Syphonix

    Syphonix Member

    Now, there's probably a more efficient way to do this, which someone else can point out, but here's one way of doing it.




    Code:
    
    <spell name="Stop it!" type="self">
      <buff useTimer="1" time="0" allowstacking="0" bad="0" removable="0" icon="skills/stopit64.png" smallicon="skills/stopit32.png">
        <description text="Stop!"/>
      </buff>
    </spell>
    
    <spell name="Is Player Check" type="target">
      <effect type="trigger" spell="Stop it!"/>
    </spell>
    
    <spell name="PC Check 1" type="target">
      <effect type="dot" spell="Is Player Check" taxa="Player" amount="1"/>
    </spell>
    
    <spell name="Remove Stop" type="self">
      <effect type="removebuffbyname" name="Stop it!"/>
    </spell>
     
    <spell name="Buff Check" type="target">
      <effect type="trigger" spell="PC Check 1" amount="0"/>
      <effect type="trigger" spell="Monster Buff" amount="1" requirebuffonnottrigger="1" requirebuffonnottriggername="Stop it!"/>
      <effect type="trigger" spell="Player Buff" amount="1" requirebuffontrigger="1" requirebuffontriggername="Stop it!"/>
      <effect type="trigger" spell="Remove Stop" amount="1"/>
    </spell>
     
    <spell name=" Test Mine" type="targetfloor"
      mineTimer="8"
      mineUseGlints="0"
      mineSpriteDrawOrder="1"
      mineSpritePNGSeries="xxx"
      mineSpritePNGFirst="xxx"
      mineSpritePNGNum="xxx"
      mineSpritePNGRate="xxx"
      mine="1"
      mineRadius="1"
      minePermanent="1"
      minesMustBeUnobstructed="0" >
      <effect type="trigger" spell="Buff Check"/>
    </spell>
    
    



    I can give you a play-by-play of it if you want and why I did the things I did.
     
    Kazeto likes this.
  5. Vitellozzo

    Vitellozzo Member

    Thanks again for the help mate. I did something similar in the evening too yesterday, with little less spells to check and a removebuff effect to remove the monster buff since I couldn't stop it to affect the player.
    But I like your way, it's very clean even with so many spells. Only one thing I don't understand, is why for Pc Check 1 you made the effect a dot and not a trigger, but otherwise I can follow and read the entire code.
    But there's one thing I want to add to the whole mass: check if the player has a semi-permanent buff (Start Buff) which is immune to Monster Buff, which we can call Bad Buff instead, while the Player Buff can be called Good Buff, since it will be positive but not always available to the player. So there's the spellmine, which buffs for Good Buff the player only if Start Buff is on, otherwise, no Start Buff on or a mob, it buffs for Bad Buff. In this way, the player cannot have the beneficial effect if he isn't in the Start Buff form, so the spellmine must be played with more reasoning (it lasts 30 turns).
    Let's see how the two differs, after the adding of Start Buff in your code:
    Code:
    <spell name="Start Buff" type="self">
    <buff useTimer="1" time="x>>1" allowstacking="0" bad="0" removable="0" icon=skills/startbuff64.png smallicon="skills/startbuff32.png">
      <description text="If you have this on, you'll be good."/>
    </buff>
    </spell>
    
    <spell name="Stop it!" type="self">
      <buff useTimer="1" time="0" allowstacking="0" bad="0" removable="0" icon="skills/stopit.png"  smallicon="skills/stopit32.png">
        <description text="Stop!"/>
      </buff>
    </spell>
    
    <spell name="Is Player Check" type="target">
      <effect type="trigger" spell="Stop it!" requirebuffontrigger="1" requirebuffontrigger="Start Buff"/>
    </spell>
    
    <spell name="PC Check 1" type="target">
      <effect type="dot" spell="Is Player Check" taxa="Player" amount="1"/>
    </spell>
    
    <spell name="Remove Stop" type="self">
      <effect type="removebuffbyname" name="Stop it!"/>
    </spell>
    <spell name="Buff Check" type="target">
      <effect type="trigger" spell="PC Check 1" amount="0"/>
      <effect type="trigger" spell="Bad Buff" amount="1" requirebuffonnottrigger="1" requirebuffonnottriggername="Stop it!"/>
      <effect type="trigger" spell="Good Buff" amount="1" requirebuffontrigger="1" requirebuffontriggername="Stop it!"/>
      <effect type="trigger" spell="Remove Stop" amount="1"/>
    </spell>
    <spell name=" Test Mine" type="targetfloor"
      mineTimer="8"
      mineUseGlints="0"
      mineSpriteDrawOrder="1"
      mineSpritePNGSeries="xxx"
      mineSpritePNGFirst="xxx"
      mineSpritePNGNum="xxx"
      mineSpritePNGRate="xxx"
      mine="1"
      mineRadius="1"
      minePermanent="1"
      minesMustBeUnobstructed="0" >
      <effect type="trigger" spell="Buff Check"/>
    </spell>
    What those mean?

    I really like where's this code is going on, I think I will take it as it is and just change values and names to avoid every possible conflict.
    Here's my code anyway, just for the sake to preserv it here and maybe start examine it. I'll remove every possible reference to my work just to preserve the little surprise effect.
    Code:
    <spell name="Start Buff" downtime="50" type="self" icon=skills/startbuff64.png smallicon="skills/startbuff32.png" >
    <buff useTimer="1" time="x>>1" allowstacking="0" bad="0" removable="0" icon=skills/startbuff64.png smallicon="skills/startbuff32.png">
      <description text="If you have this on, you'll be good."/>
    </buff>
    </spell>
    
    <spell name="Bad Buff" type="target" >
        <buff useTimer="1" time="11" allowstacking="1" stacksize="3" self="1" bad="1" icon="skills/badbuff64.png" smallicon="badbuff32.png" >
            <bad stuff here />
            <effect type="dot" spell="Bad Buff Hit" affectsCorpses="0" affectsCaster="0" amount="24" self="1" />
        </buff>
        <description text="Bad means bad." />
        </spell>
    
    <spell name="Bad Buff Hit" type="target" >
        <bad damage here />
        </spell>
    
    <spell name="Good Buff" type="target" >
        <buff usetimer="1" time="11" allowstacking="0" self="1" icon="skills/goodbuff64.png" smallicon="skills/goodbuff32.png" >
    <effect type="dot" spell="Bad Buff Hit" affectsCorpses="0" affectsCaster="0" amount="24" self="1" />
        </buff>
        <description text="Good for you." />
        </spell>
    
    <spell name="Good Buff check" type="target" >
        <effect type="trigger" spell="Good Buff" requirebuffontrigger="1" requirebuffontriggername="Start Buff" />
        <effect type="removebuffbyname" name="Bad Buff" amount="2" />
        </spell>
    
    <spell name="Spellmine effect" type="target">
        <effect type="trigger" spell="Good Buff" taxa="human" affectscaster="0" amount="1" />
        <effect type="trigger" spell="Bad Buff" affectscaster="0" />
        </spell>
    
    <spell name="Spell mine" type="adjacent" downtime="10" icon="skills/spellmine32.png"
            mine="1"
            mineradius="1"
            minePermanent="1"
            mineTimer="30"
            mineSpriteDrawOrder="0"
            mineSpritePNGSeries="sprites/sfx/folder/name"
            mineSpritePNGFirst="0"
            mineSpritePNGNum="4"
            mineSpritePNGRate="100" >
        <effect type="trigger" spell="Spellmine effect" />
        <ai hint="mine" />
        </spell>
    Btw, what is the wand="0" in some <spell ...> intestations?
     
    Last edited: Aug 14, 2013
    Kazeto likes this.
  6. Syphonix

    Syphonix Member

    I used a "dot" in the player check because taxa checks don't properly work in "trigger" effects. If you want the spell mine to look for that specific buff rather than if the target is the player, then this becomes much simpler. You can remove "Is Player Check", "Stop it!", "PC Check 1", and "Remove Stop", then change the "Buff Check" spell:


    Code:
    
    <spell name="Buff Check" type="target">
         <effect type="trigger" spell="Bad Buff" requirebuffonnottrigger="1" requirebuffonnottriggername="Start Buff"/>
         <effect type="trigger" spell="Good Buff" requirebuffontrigger="1" requirebuffontriggername="Start Buff"/>
    </spell>
    
    

    Then, just make sure all the buffs have self="0" instead of 1.


    The wand="1" appears to point at spells called on by wands, but I've created wands that call on custom spells without wand="1" and it worked fine. I'm not sure if this does anything anymore. There might be something else to it that I didn't notice.
     
    Kazeto and Vitellozzo like this.
  7. Vitellozzo

    Vitellozzo Member

    Ehr, I need the player taxa as much as I need requirebuffontrigger for Start Buff, to make the Good Buff work. But anyway that will not be so simple, since requirebuffontrigger and its equivalent nottotrigger can read only on player, and not on monsters too. So, in this code you've wrote, the good effect will pop up as long as player has Start Buff on, no matter who steps on the spellmine (so even monsters get buffed up), and if player has not Start Buff, everyone takes the Bad Buff instead (which is only half what I want).
    Anyway, I should have integrated it properly for now. Testing ahead.
     
    Kazeto and Syphonix like this.
  8. Vitellozzo

    Vitellozzo Member

    Update: It works as intended! I am so happy finally I can code some sort of thing I didn't see in the game, without having my heart crush by the impossibility of it!
    Anyway I had to change the amount from 1 to 2 in
    Code:
    <effect type="trigger" spell="Remove Stop" amount="2"/>
    since the amount="1" was causing problems for the game to read if the Stop it! was there or not.
    Also, a last thing for now:
     
    Kazeto likes this.
  9. Syphonix

    Syphonix Member

    Glints are when the graphic is drawn multiple times on the same tile, and in slighty offset positions, such as you'll see in poison clouds or fire fields. Turn it on and you'll see what I'm talking about.

    Unobstructed just means that the mine wont spawn in that tile if there's something there that is considered an obstacle.
     
    Kazeto and Vitellozzo like this.
  10. Vitellozzo

    Vitellozzo Member

    Obstacle like monsters too? If yes, I think I'll turn it on.

    Uhm. Now I'm trying to get a spell do something similar of the other, but there's something I can't make past of.
    What I want is to make a spell which, depending on the target, has different uses: if targeted on 3 kind of taxa - taxa2, taxa3 and taxa4 - it casts fear (this works), if cast on a taxa1, it casts charme (this works too), if casted on the player and on a certain kind of mob (XXX, this mob is also one of the charme taxa kind), it should buff its stats to make it fight better (this works only when casted on the player, if casted on the family mob kind, the buff also goes to the player).

    Code:
    <spell name="Big Buff" type="target" >
        <buff useTimer="1" time="5" allowstacking="0" bad="0" removable="0" icon="skills/bigbuff64.png"  smallicon="skills/bigbuff32.png" >
        </buff>
        <description text="Big buff for Player and XXX monster family." />
    </spell>
    
    <spell name="Charm buff" type="target" >
        <effect type="charm" turns="50" /> 
    </spell>
    
    <spell name="Fear buff" type="target" >
        <effect type="fear" amount="15" />
    </spell>
    
    <spell name="Clean Fear buff" type="self" >
        <effect type="removebuffbyname" name="Fear buff" />
    </spell>
    
    <spell name="Big Buff call" type="target" >
        <effect type="dot" spell="Big Buff" taxa="XXX" amount="1" />
    </spell>
    
    <spell name="Dummy effect caller" type="target" >
        <effect type="trigger" spell="Big Buff call" amount="0" />
        <effect type="dot" spell="Charm Buff" taxa="taxa1" amount="1" />
        <effect type="dot" spell="Fear buff" taxa="taxa2" amount="1" />
        <effect type="dot" spell="Fear buff" taxa="taxa3" amount="1" />
        <effect type="dot" spell="Fear buff" taxa="taxa4" amount="1" />
        <effect type="dot" spell="Clean Fear buff" taxa="Player" amount="1" />
    </spell>
    
    <spell name="Multieffect spell" type="template" templateID="100000" downtime="1" icon="skills/multi32.png" >
        <effect type="trigger" spell="Dummy effect caller" />
    </spell>
    Template 100000 is just a 1x1 area of effect which can affect player, I created it to make a solution to both select player and every mob I'd click on.
    So, everything works ad intended, aside than Big Buff buffing XXX taxa; when I try to cast on XXX monsters, it is charmed as every other taxa1 monsters, but no Big Buff on it (but it automatically buffs the player, even if he's not the target of the spell!)!
    As it is now, it can work for my mod, but I'd like to make XXX monsters take Big Buff, for flavor sake and for more utility.
    As long as I've seen, anyway, I can say that, since fear seems to not work on player, "Clean Fear buff" is quite useless. And that "Big Buff call" I made just to test more possibilities, it's quite pointless, "Dummy effect caller" could call directly the Big Buff... it will still buff the player, and not buffs XXX monsters, even if <effect type="dot" spell="Big Buff" taxa="XXX" amount="1" />
     
    Last edited: Aug 14, 2013
    Kazeto likes this.
  11. Essence

    Essence Will Mod for Digglebucks

    This, I believe, is exactly what the 'self="0"' tag is for inside buffs. I'd try putting that in the Big Buff and see what happens.
     
    Kazeto, Syphonix and Vitellozzo like this.
  12. Vitellozzo

    Vitellozzo Member

    Oh my gosh Essence. You're made of pure awesomeness! The right word at the right time!
    It's working like a charme! (now I just have to put a heal effect for those 10 :life: bonus and it's perfect)
    :edit: everything went better than expected.
    Now it's time to move past this too, time for other spells to be made!
     
    Last edited: Aug 14, 2013
    Kazeto, Essence and Syphonix like this.
  13. Vitellozzo

    Vitellozzo Member

    Update for Syphonix, this could help you (and every other) with futher moddings: dot effects seems prone to be resistable, so even <effect type="dot" spell="Is Player Check" taxa="Player" amount="1"/> can fail, risulting in the player taking Bad Buff instead of Good Buff (which is unaccettable). Adding resistable="0" after the amount tag solved my problem, making this other skill work as a charm too.

    :edit: Now I see something I don't like: it is true that in this code if you have Start Buff you can futher be buffed by Good Buff, but it's also true that as for now, there can be istances where Start Buff runs out of his timer, while Good Buff still stays on. What I want is to cancel Good Buff when Start Buff runs out, but I cannot do it for now.
    This is what I've tried so far
    Code:
    <spell name="Remove good buff" type="self" >
        <effect type="removebuffbyname" name="Good Buff" />
    </spell>
    
    <spell name="Remove good buff check" type="target" >
        <effect type="trigger" name="Remove good buff" requirebuffonnottrigger="1" requirebuffonnottriggername="Start Buff" />
    </spell>
    
    <spell name="Good Buff" type="target" >
        <buff things (time="11") >
        </buff>
        <effect type="dot" spell="Remove good buff check" amount="11" resistable="0" />
        <description text="Good buff text." />
    </spell>
     
    Last edited: Aug 16, 2013
  14. Syphonix

    Syphonix Member

    Does Start Buff always run its full course for a set amount of turns? What I mean is, is it ONLY removable by running out of time? If so, you could put a delayed trigger inside of Start Buff that removes good buff. But that wouldn't work if Start Buff is removable, if it can be dispelled or removed by another spell, or if it is stackable, because that could set up situations where Start Buff has been gone for 5 turns, you got another fresh copy of Start Buff, and Good Buff gets removed for no reason (and other such nonsense).

    That looks like it should, at the very least, remove the Good Buff a turn or 2 late. Is it not even doing that?
    I am, unfortunately, not home, or I'd test a few things out.
     
    Vitellozzo likes this.
  15. lccorp2

    lccorp2 Member

    A few things with that:

    *Currently, any dot spell, whether marked with resistable=0 or not, will be removed by a cleansing effect. Keep this in mind.
    *If you want the dot to be tied to the buff, be sure to use requirebuff (see thaumites for that).
    *If a buff is not set as removable or bad AND has been set as timed, then the only way to let it finish is to let it run out or use removebuffbyname.
     
    Vitellozzo and Kazeto like this.
  16. Kazeto

    Kazeto Member

    Mhm, that.
    You can get around that by making a spell which will trigger the effect you want as a dot, as well as itself the next turn but only if the required buff is present.

    It's still not perfect, but at least less accidentally removable.
     
    Vitellozzo and Syphonix like this.
  17. Syphonix

    Syphonix Member

    This is what you should try next. A recurring spell that goes through your required checks. Not only because of the cleanse, but I think dot effects happen at a different point in the turn sequence, which can probably mess up your buff checking gates.
     
    Vitellozzo and Kazeto like this.
  18. Vitellozzo

    Vitellozzo Member

    Iccorp2 and Kazeto, I'm honored!
    Now, one at a time.
    This could work, I thought it too yesterday night. Because yes, Start Buff is something the player can only start it, then he has to wait until the counter makes to 0. A delay will work.
    I tried changing the amount. It said it hates me. :(
    I didn't know dot could be made with requirebuff (well, I didn't know also the removeable dot mechanics), this can be useful to prevent spell cluttering and issues. Thanks bro, quite useful tips for the modding life.
    The last thing is exactly what I wanted to know and the main reason behind this Good Buff checking for Start Buff: the player has a powerful tool at his hands, but must know how to control it properly and not just go on rampage.
    That can work, too. Since Iccorp confirmed me this Start Buff will not be removed randomly, this way could be just more work, but the idea is similar to mine: confirm every turn if the Start Buff is there or not, then cancel the Good Buff if not. I'll keep it in mind anyway, it could be a nice workaround for something similar.
    Again, thanks everyone for answering me and helping me figure how's big the modding world is.
     
    Kazeto likes this.
  19. Vitellozzo

    Vitellozzo Member

    Update:
    It seems the Good Buff is so good it won't remove itself.
    I tried both versions of the resolution:
    1- I gave Start Buff a delayed trigger for "Remove Good Buff" spell, then gave it a removebuffbyname and amount="0". It should have triggered the turn Start Buff fade away, but no removebuff comes through even. I tried putting more triggers, with delay+1 and +2 turns respectively. Nothing changed (I didn't saved the code for this try, but it's pretty simple as it is).
    2- I gave Start Buff a trigger for "Remove Good Buff check", then
    Code:
    <spell name="Remove Good Buff" type="self" >
        <effect type="removebuffbyname" name="Good Buff" amount="0" />
    </spell>
    
    <spell name="Remove Good Buff check" type="self" >
        <effect type="trigger" name="Remove Good Buff" requirebuffonnottrigger="1" requirebuffonnottriggername="Start Buff" />
        <effect type="trigger" spell="Remove Good Buff check" amount="1" requirebuffontrigger="1" requirebuffontriggername="Start Buff" />
    </spell>
    Both were ineffective, sadly.
     
    Kazeto likes this.
  20. Kazeto

    Kazeto Member

    You do know that when not writing a "trigger" effect but rather a "removebuffbyname" one, the "amount" tag isn't used to mark the delay but rather the amount of buffs removed from the stack, right?

    And in the second one, the "Remove Good Buff Check" does something which can pretty much be summed up with "as soon as 'Good Buff' disappears, remove 'Good Buff'", which appears not to have been intended.