chrono engine ABS item drop

Discussion in 'Javascript/Plugin Support' started by arashiya, Aug 13, 2019.

  1. arashiya

    arashiya Veteran Veteran

    Messages:
    75
    Likes Received:
    3
    First Language:
    english
    Primarily Uses:
    RMMV
    #1
  2. arashiya

    arashiya Veteran Veteran

    Messages:
    75
    Likes Received:
    3
    First Language:
    english
    Primarily Uses:
    RMMV
    can any body help?
     
    #2
  3. Restart

    Restart Veteran Veteran

    Messages:
    201
    Likes Received:
    130
    First Language:
    English
    Primarily Uses:
    RMMV
    Mog's plugin uses the stock RPGMaker base 'makeDropItems()' function, and in addition to that, the getTreasure() function is hardcoded to only add 1 of any given item. It's a bit of a pain to modify because of that. (and I THINK maybe the monster gets transformed into the treasure? Not sure on that, didn't dig deep enough to understand it).

    Since in my own project, I wanted to do enemies dropping hearts zelda-style, which are instantly used instead of being put into the inventory, I eventually decided to do a dumb hack, and create some dummy items in high numbered item slots, which trigger a spawn of a new event using yanfly's Event Spawner plugin whenever they come up in the drop table.

    Code:
    Game_CharacterBase.prototype.makeTreasure = function(char,battler) {
       var treasures = battler.makeDropItems();
        if (treasures.length > 0) {
           var rt = Math.randomInt(treasures.length);
           var item = treasures[rt]
           if (item.id == 100)
           {
               Yanfly.SpawnEventAt( INPUT PARAMETERS AS APPROPRIATE)
           }else
           {
               char._user.treasure = [item,false,0,0,20];      
               char._characterName = 'treasurebattlertool'
               $gameMap._treasureEvents.push(char);
           }
           char._user.collapse = [true,0];
          
       };
    };
    
    YMMV how useful that is to you, but that's what I did.
     
    #3
    arashiya likes this.
  4. arashiya

    arashiya Veteran Veteran

    Messages:
    75
    Likes Received:
    3
    First Language:
    english
    Primarily Uses:
    RMMV
    thanks for your reply!
    I think maybe I have to give up on multiple items...

    your method is cool
    I can understand the logic
    but maybe I don't have the knowledge to modify it...
    thanks anyway
     
    #4
  5. Restart

    Restart Veteran Veteran

    Messages:
    201
    Likes Received:
    130
    First Language:
    English
    Primarily Uses:
    RMMV
    Yeah it's just a pain to do. If you don't care about running around to collect items on the map, you can do something like this (untested code incoming:)


    Code:
    Game_CharacterBase.prototype.makeTreasure = function(char,battler) {
       var treasures = battler.makeDropItems();
       if (treasures.length > 0) {
    
        for (var i = 0; i < treasures.length; i++) {
             var item = treasures[rt]
            $gameParty.gainItem(item, 1);
           if (Imported.MOG_TreasurePopup) {
               $gameSystem._trspupData.push([item,1,event.screenX(),event.screenY()]);
           };
            }
          char._user.collapse = [true,0];
       };
    };
    You'd still be working within the very limited constraints of the default loot drop code, though, which limits your multiple item possibilities pretty badly.

    It appears that yanfly's extra enemy drops might be compatible since it modifies makeDropItems. You can try that and see if it works.

    http://www.yanfly.moe/wiki/Extra_Enemy_Drops_(YEP)
     
    #5
    arashiya likes this.
  6. arashiya

    arashiya Veteran Veteran

    Messages:
    75
    Likes Received:
    3
    First Language:
    english
    Primarily Uses:
    RMMV
    I tried but still seems no luck...
     
    #6
  7. Restart

    Restart Veteran Veteran

    Messages:
    201
    Likes Received:
    130
    First Language:
    English
    Primarily Uses:
    RMMV
    try
    Code:
    Game_CharacterBase.prototype.makeTreasure = function(char,battler) {
       var treasures = battler.makeDropItems();
       if (treasures.length > 0) {
    
        for (var i = 0; i < treasures.length; i++) {
             var item = treasures[i]
            $gameParty.gainItem(item, 1);
           if (Imported.MOG_TreasurePopup) {
               $gameSystem._trspupData.push([item,1,char.screenX(),char.screenY()]);
           };
            }
          char._user.collapse = [true,0];
       };
    };
     
    #7
  8. arashiya

    arashiya Veteran Veteran

    Messages:
    75
    Likes Received:
    3
    First Language:
    english
    Primarily Uses:
    RMMV
    yes I have tried paste the code into it
    but no item appear when the monster is dead
    and the position it dead remains sth blocking the player to step on
     
    #8
  9. Restart

    Restart Veteran Veteran

    Messages:
    201
    Likes Received:
    130
    First Language:
    English
    Primarily Uses:
    RMMV
    Odd, is working for me.

    [​IMG]
    [​IMG]
    [​IMG]

    Did you add that code as a plugin at the bottom of the list? Are you using other non-chrono engine plugins?
     
    Last edited: Aug 24, 2019
    #9
  10. arashiya

    arashiya Veteran Veteran

    Messages:
    75
    Likes Received:
    3
    First Language:
    english
    Primarily Uses:
    RMMV
    oh I just add the code into chrono engine...
    yes I have used a bunch of other plugins
     
    #10
  11. Restart

    Restart Veteran Veteran

    Messages:
    201
    Likes Received:
    130
    First Language:
    English
    Primarily Uses:
    RMMV
    Can't really figure anything out without knowing the plugins and their order - would you mind giving me a screenshot of your full plugin list?

    Also, try just sticking the tweak in a seperate plugin. Save it as 'droptest.js', and stick it at the bottom of the list.
     
    #11
  12. arashiya

    arashiya Veteran Veteran

    Messages:
    75
    Likes Received:
    3
    First Language:
    english
    Primarily Uses:
    RMMV
    actually I am using the chrono engine demo to test but still no difference
    I set the enemy to have 3 items but can't return the result as yours
    would you explain more how to make a separate plugin?
     
    #12
  13. Restart

    Restart Veteran Veteran

    Messages:
    201
    Likes Received:
    130
    First Language:
    English
    Primarily Uses:
    RMMV
    Just save it into a .txt file with notepad, then rename that file to "testPlugin.js"
     
    #13
    arashiya likes this.
  14. arashiya

    arashiya Veteran Veteran

    Messages:
    75
    Likes Received:
    3
    First Language:
    english
    Primarily Uses:
    RMMV
    thanks so much I finally make it
    a lot of stupid mistakes...

    although there is no drop item on the map now,
    being able to collect several items is important to my game

    the reason of invisible block after monster dead,
    should be the event page I created before the monster move
    everything's fine after I removed the page
    ( I create a page that make the monster fade in and wait than turn on a switch to movement)

    anyway thanks again you are always my lifesaver!!
     
    #14
  15. arashiya

    arashiya Veteran Veteran

    Messages:
    75
    Likes Received:
    3
    First Language:
    english
    Primarily Uses:
    RMMV
    I find even the monster is dead but the event itself semms still remaining
    I am also using yanfly event spawner
    when the monster is dead on the spwan point, no more spawn occurs again
    so is there a way to completely remove the dead monster event?
     
    #15

Share This Page