Need help with my Script!

● ARCHIVED · READ-ONLY
Started by Nickel 1 posts View original ↗
  1. Hey,

    first i must say that im completely new with Javascript. I also "try and error " this litte Script.  My idea was to have a Script to give each weapon a custom image because we can't have more then 30 weapons. 

    The Script loads the weapon images from "/img/system/". I use the notetags <Sheet: "ex: MySword"> and <ImgNumb: "ex: 1"> to do this. It works as long as only one Actor is in the battle. If there more all Actors have the same weapon. I would be nice if someone could help me with the Script.

    Greetings
    Nickel​

    (function() {var parameters = PluginManager.parameters('test');////////////////////////////////////_Sprite_Weapon_LoadBitmap = Sprite_Weapon.prototype.loadBitmap;Sprite_Weapon.prototype.loadBitmap = function() {var pageId = Math.floor((this._weaponImageId - 1) / 12) + 1;var id, item, Sheet;for (i = 1; i < $dataWeapons.length; i++) {item = $dataWeapons;Sheet = item.meta.Sheet;}if (pageId >= 1) {this.bitmap = ImageManager.loadSystem(Sheet);} else {this.bitmap = ImageManager.loadSystem('');}};///////////////////////////////////_Sprite_Weapon_UpdateFrame = Sprite_Weapon.prototype.updateFrame;Sprite_Weapon.prototype.updateFrame = function() {var i, item, _weaponImageId;for (i = 1; i < $dataWeapons.length; i++) {item = $dataWeapons;_weaponImageId = item.meta.ImgNum;}if (this._weaponImageId > 0) {var index = (_weaponImageId - 1) % 12;var w = 96;var h = 64;var sx = (Math.floor(index / 6) * 3 + this._pattern) * w;var sy = Math.floor(index % 6) * h;this.setFrame(sx, sy, w, h);}else{this.setFrame(0, 0, 0, 0);}};})();​​