zero? 님의 스크립트 변환 vx ace -> mv

by lklslel posted Nov 12, 2016
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄

mv에서 사용하는 스크립트가 자바스크립트인 관계로...

 

class의 형태를 바꾸는 방식이 아닌 prototype(함수원형)으로

 

등록하여 사용하는 방식으로 작성을 하셔야 합니다.

 

 

그리고 def 키워드는 function 키워드로 치환합니다.

 

플러그인으로 작성하여 쓰는 방법에 대해서는 제가

 

작성해드리지 않습니다.

 

 

 

참고하셔야 할 점은 MV샘플 파일 기준으로 작성된

 

것으로서 현재 업데이트 버전과는 부분적으로

 

다를 수 있습니다.

 

 

 

var custom_atk_anim_opt = [[21, 4, 8], [21, 0, 2]];

 

 

Game_Actor.prototype.custom_atk_anim_for_weapon = function(index){
 var i;

 var opts = custom_atk_anim_opt;

 switch(opts.length > 0){

  case true:

   for(i = 0;i < opts.length;i++){

    switch((this._states.indexOf(opts[i][0]) > -1) && opts[i][1] === $dataWeapon[index].wtypeid){

     case true:

     return opts[i][2];

    }

   }

  break;

 }
};


 
Game_Actor.prototype.custom_atk_anim_for_barehand = function(){

 var i;

 var opts = custom_atk_anim_opt;

 switch(opts.length > 0){

  case true:

   for(i = 0;i < opts.length;i++){

    switch((this._states.indexOf(opts[i][0]) > -1) && opts[i][1] === 0){

     case true:

     return opts[i][2];

    }

   }

  break;

 }

};

 

 

Game_Actor.prototype.get_weapons = function(){

 var i;

 var weapons = new Array();

 for(i = 0;i < this._equips.length;i++){

  switch(this._equips[i]._dataClass === "weapon"){

   case true:

    weapons.push(this._equips[i]);

   break;

  }

 }

 return weapons;

};

 

 

Game_Actor.prototype.not_equipped = function(){

 var weapons;

 weapons = this.get_weapons();

 switch(weapons.length === 0){

  case true:

  return true;

  default:

  return false;

 }

};

 

 

var alias_atk_animation_id1_9qxb6_001 = Game_Actor.prototype.atk_animation_id1;

 

Game_Actor.prototype.atk_animation_id1 = function(){

 var caafw0, caafb = custom_atk_anim_for_barehand(), weapons = this.get_weapons();

 switch(weapons.length > 0){

  case true:

   caafw0 = this.custom_atk_anim_for_weapon(0);

   switch(true){

    case(weapons[0] instanceof Object && typeof caafw0 === "number" && !Number.isNaN(caafw0)):

    return caafw0;

    case(this.not_equipped() && typeof caafb === "number" && !Number.isNaN(caafb)):

    return caafb;

    default:

    return alias_atk_animation_id1_9qxb6_001.call(this,arguments);

   }

  break;
 }

};

 

var alias_atk_animation_id1_9qxb6_002 = Game_Actor.prototype.atk_animation_id2;

 

 

Game_Actor.prototype.atk_animation_id2 = function(){

 var caafw1, weapons = this.get_weapons();

 switch(weapons.length > 1){

  case true:

   caafw1 = custom_atk_anim_for_weapon(1);

   switch(weapons[1] instanceof Object && typeof caafw1 === "number" && !Number.isNaN(caafw1)):

    case true:

    return caafw1;

    default:

    return alias_atk_animation_id1_9qxb6_002.call(this,arguments);

   }

  break;
 }

};

 

 

제대로 작성이 되었는지는 적용해봐야 알 수 있습니다.

 

(무책임한 말이지만 구조적으로는 문제없이 작성했습니다.)