lklslel2016.11.15 12:50
※ 적이 맵 상에 출현하여 움직이는 방식의 것은 ※

※ 현재 오프라인 상에 없기에... 우선 플레이어만 다룹니다. ※

웹 브라우저로 실행해서 개발자 도구에서 _moveSpeed의 값을

변경하면 그대로 적용이 됩니다.


툴에서 권장하는 최소 속도가 1인듯하니 스크립트로 처리를 하시면

제대로 원하는 연출을 가능하게 할 것으로 생각됩니다.


어떤 상황일 때에 속도가 느려져야 하는지는 모르겠지만

(세부적인 사항은 모르고 방법만 기재합니다.)


저라면 따로 함수를 만들어 두고서 기본 값과 토글되는

방식으로 처리를 해보겠습니다.


rpg_object.js 의 6222줄부터 있는 함수를 복사해서 편집합니다.


다음과 같이 원래의 변수는 남겨두고 새로

this._moveSpeed_에 원래의 이동 값을 저장합니다.

그리고 새로 플러그인으로 작성해서 꽂아주시면 됩니다.


Game_CharacterBase.prototype.initMembers = function() {
this._x = 0;
this._y = 0;
this._realX = 0;
this._realY = 0;

this._moveSpeed_ = 4;
this._moveSpeed = this._moveSpeed_;

this._moveFrequency = 6;
this._opacity = 255;
this._blendMode = 0;
this._direction = 2;
this._pattern = 1;
this._priorityType = 1;
this._tileId = 0;
this._characterName = '';
this._characterIndex = 0;
this._isObjectCharacter = false;
this._walkAnime = true;
this._stepAnime = false;
this._directionFix = false;
this._through = false;
this._transparent = false;
this._bushDepth = 0;
this._animationId = 0;
this._balloonId = 0;
this._animationPlaying = false;
this._balloonPlaying = false;
this._animationCount = 0;
this._stopCount = 0;
this._jumpCount = 0;
this._jumpPeak = 0;
this._movementSuccess = true;
};


Game_Character 객체는 Game_CharacterBase의 인스턴스로

Game_CharacterBase객체의 모든 것을 사용할 수 있습니다.

아래의 부분도 만드시는 플러그인에 꽂아넣어주시고 사용하면 됩니다.

※ 아래 2개의 함수는 새로 추가하실 함수입니다. ※

[ 아래의 .changeSpeed()는 단순하게 작성한 예입니다. ]


Game_Character.prototype.changeSpeed = function(moveSpeed){
this._moveSpeed = moveSpeed;
};

Game_Character.prototype.initSpeed = function(){
this._moveSpeed = this._moveSpeed_;
};




사용하실 이동값을 배열에 저장해서 쓴다면

.changeSpeed()를 위와는 다르게 해야 됩니다.



//플러그인 설명문 시작
//직접 하실 줄 아실테니 수도코드로만
//플러그인 설명문 끝

//플러그인 매니저에 해당 플러그인 로딩시키기
//직접 하실 줄 아실테니 수도코드로만

//change speed array : csa
//특정 상황에 연동시키시려면 ._moveSpeed값만
//있으면 안됩니다. 추가적으로 생각을 하셔서
//적용을 하시지 않으면 원하실 때에 작동하지 않습니다.
//맵상에 표시된 플레이어 파티의 리더 Actor의 상태를
//기준으로 가정하여 작성해보겠습니다.
//csa[ 상태번호 ] = [ 상태번호 , 이동속도 ];
var csa = new Array();
csa[0] = [0,0.1];

Game_Character.prototype.changeSpeed = function(){
var cs,cs2;
switch(typeof csa === "undefined"){
case true:
return false;
}
for(cs = 0;cs < $gameActors._data.length;cs++){
switch($gameActors._data[cs]._characterIndex === $gamePlayer._characterIndex){
case true:
for(cs2 = 0;cs2 < $gameActors._data[cs]._states.length;cs2++){
switch($gameActors._data[cs]._states[cs2] === Number(csa[$gameActors._data[cs]._states[cs2]][0])){
case true:
this._moveSpeed = Number(csa[$gameActors._data[cs]._states[cs2]][1]);
return true;
}
}
break;
}
}
};



위의 스크립트가 에러가 나면 .changeSpeed()를 다음과 같이


Game_Character.prototype.changeSpeed = function(){
var cs,cs2;
switch(typeof csa === "undefined"){
case true:
return false;
}
for(cs = 0;cs < $gameActors._data.length;cs++){
switch($gameActors._data[cs] instanceof Object
&& $gameActors._data[cs]._characterIndex === $gamePlayer._characterIndex){
case true:
for(cs2 = 0;cs2 < $gameActors._data[cs]._states.length;cs2++){
switch(csa[$gameActors._data[cs]._states[cs2]] instanceof Array
&& csa[$gameActors._data[cs]._states[cs2]].length === 2
&& $gameActors._data[cs]._states[cs2] === Number(csa[$gameActors._data[cs]._states[cs2]][0])){
case true:
this._moveSpeed = Number(csa[$gameActors._data[cs]._states[cs2]][1]);
return true;
}
}
break;
}
}
};


이 스크립트는 에러 발생시 2중 for문만 실행하고 나옵니다.


※ 실제 사용 방법 ※

속도 값 변화시 $gamePlayer.changeSpeed();

원래로 되돌릴 때는 $gamePlayer.initSpeed();


2중 for문을 사용했기에 속도가 저하되는 관계로

switch문으로 보완하려고 했습니다.

if문으로도 속도가 떨어지지 않는다면 if문을 쓰시길...

제가 작성해드린 방식은 속도 최적화 방식이 아닙니다.
파일 첨부

여기에 파일을 끌어 놓거나 파일 첨부 버튼을 클릭하세요.

파일 크기 제한 : 0MB (허용 확장자 : *.*)

0개 첨부 됨 ( / )






[개인정보취급방침] | [이용약관] | [제휴문의] | [후원창구] | [인디사이드연혁]

Copyright © 1999 - 2016 INdiSide.com/(주)씨엘쓰리디 All Rights Reserved.
인디사이드 운영자 : 천무(이지선) | kernys(김원배) | 사신지(김병국)