MV3D - 3D rendering for RMMV with Babylon.js

YoraeRasante

Veteran
Veteran
Joined
Jun 6, 2014
Messages
1,599
Reaction score
392
First Language
Portuguese
Primarily Uses
RMMV
@tseyik what is this <mv3d-regions> block? Is it new? Can't find mention of it anywhere...
I thought you could only make region settings on the plugin' parameters right now...
 

CoopNinjask

Veteran
Veteran
Joined
Jan 9, 2020
Messages
105
Reaction score
61
First Language
Portuguese
Primarily Uses
RMMV
You can check my bird script on page 31, should be able to show you how to do it, just make a movement route script pretty much same as I did for birds. Number 2 should be answered by my bird chase script as well. 3 you could probably do by tagging regions as a comparison in the movement like the bird script. 4 you could probably turn on through temporarily, which I did in my heavily edited bird chase script recently, perhaps it will be of use.



Code:
Game_Event.prototype.clearChaseSettings = function() {
  this._alertCommonEvent = Yanfly.Param.ECPAlertEvent;
  this._alertLock = 0;
  this._alertPlayer = false;
  this._alertSound = Yanfly.Param.ECPAlertSound;
  this._alertSoundVol = 100;
  this._alertSoundPitch = 100;
  this._alertSoundPan = 0;
  this._chasePlayer = false;
  this._chaseRange = 0;
  this._chaseSpeed = this._moveSpeed;
  this._defaultSpeed = this._moveSpeed;
  this._fleePlayer = false;
  this._fleeRange = 0;
  this._fleeSpeed = this._moveSpeed;
  this._seePlayer = Yanfly.Param.ECPSeePlayer;
  this._sightLock = Yanfly.Param.ECPSightLock;
  this._returnAfter = Yanfly.Param.ECPReturn;
  this._returnWait = Yanfly.Param.ECPReturnWait;
  this._returnPhase = false;
  this._returnFrames = 0;
  this._staggerCount = 0;
  this._startLocationX = this.x;
  this._startLocationY = this.y;
  this._startLocationDir = this._direction;
  this._bird = false;
  this._startchase = false;
  this._fleelvl = 200;
  this._defaultThrough = this._through;
  this._defaultFreq = this._moveFrequency;
  this._chaseFreq = this._moveFrequency;
  this._encount = 0;
  this._fight = false;
};

Yanfly.ECP.Game_Event_setupPage = Game_Event.prototype.setupPage;
Game_Event.prototype.setupPage = function() {
    Yanfly.ECP.Game_Event_setupPage.call(this);
    this.clearChaseSettings();
};

Game_Event.prototype.activateAlert = function() {
    if (this._fleePlayer) {
    this.requestBalloon(6);
    } else if (this._returnPhase && !this._startchase) {
    this.requestBalloon(6);
    } else if (this._returnPhase) {
    this.requestBalloon(5);
    } else {
    this.requestBalloon(1);
    }
    this._alertPlayer = true;
    this.playAlertSound();
    this.playAlertCommonEvent();
};

Game_Event.prototype.updateChaseDistance = function() {
    if (this._erased) return;
    if (this._chaseRange <= 0) return;
    if (this._fleePlayer) return;
    var dis = Math.abs(this.deltaXFrom($gamePlayer.x));
    dis += Math.abs(this.deltaYFrom($gamePlayer.y));
    if (this.chaseConditions(dis)) {
    if (dis <= 1) {
    if (this.z <= $gamePlayer.z) {
        if (this._opacity > 200) this.start();
    }
    }
      this.startEventChase();
    } else if (this._chasePlayer) {
      this.startReturnPhase();
    }
};

Game_Event.prototype.canSeePlayer = function() {
    if (!this._seePlayer) return false;
    var sx = this.deltaXFrom($gamePlayer.x);
    var sy = this.deltaYFrom($gamePlayer.y);
    if (Math.abs(sx) > Math.abs(sy)) {
      var direction = (sx > 0) ? 4 : 6;
    } else {
      var direction = (sy > 0) ? 8 : 2;
    }
    if (direction === this.direction()) {                             
      return true;
    }
    return false;
};

Game_Event.prototype.chaseConditions = function(dis) {
    if (dis <= this._chaseRange && this.nonSeePlayer()) return true;                                   
    if (dis <= this._chaseRange && this.canSeePlayer()) return true;
    return false;
};

Game_Event.prototype.fleeConditions = function(dis) {
    if (dis <= this._fleeRange && this.canSeePlayer()) return true;
    if (dis <= this._fleeRange && !this._seePlayer) return true;
    return false;
};

Game_Event.prototype.startEventChase = function() {
    if (!this._returnPhase) {
    this._through = true
    this._chasePlayer = true;
    this.activateAlert();
    this._alertLock = this._sightLock;
    this.setMoveSpeed(this._chaseSpeed);
    this.setMoveFrequency(this._chaseFreq);
    this._startchase = true;
    }
};

Game_Event.prototype.startEventFlee = function() {
    if (!this._returnPhase) {
    this._fleePlayer = true;
    this.activateAlert();
    this._alertLock = this._sightLock;
    this.setMoveSpeed(this._fleeSpeed);
    this.setMoveFrequency(this._chaseFreq);
    this._startchase = true;
    }
};

Game_Event.prototype.updateFleeDistance = function() {
    if (this._erased) return;
    if (this._fleelvl > $gameVariables.value(33)) return;
    var dis = Math.abs(this.deltaXFrom($gamePlayer.x));
    dis += Math.abs(this.deltaYFrom($gamePlayer.y));
    if (this.fleeConditions(dis)) {
    if (dis <= 1) {
    if (this.z <= $gamePlayer.z) {
        if (this._opacity > 200) this.start();
    }
    }
      this.startEventFlee();
    } else if (this._fleePlayer) {
      this.startReturnPhase();
    }
};

Game_Event.prototype.checkFacing = function() {
    var x = this._x;
    var y = this._y;
    var d = this._direction;
    var pl = $gamePlayer;
    var px = pl._x;
    var py = pl._y
    var pd = pl._direction;
    if (x > px && y === py) {
        if (pd === 6) {
                if (d === 6) {
                    this._encount = 1;
                    return true;
                } else {
                    return true;
                    };
        } else if (d === 4) {
            if (pd === 4) {
                this._encount = 2;
            return true;
            } else {
                return true;
                };
        } else {
            return false;
        };
    } else if (x < px && y === py) {
        if (pd === 4) {
                if (d === 4) {
                    this._encount = 1;
                    return true;
                } else {
                    return true;
                    };
        } else if (d === 6) {
            if (pd === 6) {
                this._encount = 2;
            return true;
            } else {
                return true;
                };
        } else {
            return false;
        };
    } else if (y > py && x === px) {
        if (pd === 2) {
                if (d === 2) {
                    this._encount = 1;
                    return true;
                } else {
                    return true;
                    };
        } else if (d === 8) {
            if (pd === 8) {
                this._encount = 2;
            return true;
            } else {
                return true;
                };
        } else {
            return false;
        };
    } else if (y < py && x === px) {
        if (pd === 8) {
                if (d === 8) {
                    this._encount = 1;
                    return true;
                } else {
                    return true;
                    };
        } else if (d === 2) {
            if (pd === 2) {
                this._encount = 2;
            return true;
            } else {
                return true;
                };
        } else {
            return false;
        };
    } else if (y === py && x === px) {
        return true;
    } else {
        return false;
    }
};

Game_Event.prototype.updateChaseMovement = function() {
    if (this._erased) return;
    var trig = this._trigger;
    if (trig > 2) return;
    var dis = Math.abs(this.deltaXFrom($gamePlayer.x));
    dis += Math.abs(this.deltaYFrom($gamePlayer.y));
    if (trig > 0) {
    if (dis <= 1) {
        if (this.z <= $gamePlayer.z) {
            if (this._opacity > 200) {
                if (this.checkFacing()) {
                    this._fight = true;
                    return this.start();
    }}}}}
    if (!this._startchase) {
        if (this._fleelvl < $gameVariables.value(33)) {
                if (this.fleeConditions(dis)) this.startEventFlee();
        } else if (this.chaseConditions(dis)) this.startEventChase();
    } else if (this._alertLock <= 0) this.startReturnPhase();
    var x = this._x;
    var y = this._y;
    var r = this._returnPhase;
    if ($gameSwitches.value(159)) {
    var Edge = $gameMap._myVariable;
    if (y > Edge[0] || y < Edge[1] || x > Edge[2] || x < Edge[3]) {
        if (!r) this.startReturnPhase();
    }
    }
    if (!r && !this._startchase || $gameSwitches.value(160)) return Yanfly.ECP.Game_Event_updateSelfMovement.call(this);
    if (this._staggerCount > 0) {
      return this._staggerCount--;
    }
    if (this._stopCount > 0 && this._chasePlayer) {
      var direction = this.findDirectionTo($gamePlayer.x, $gamePlayer.y);
      if (direction > 0) {
        this.moveStraight(direction);
        if (this._bird) {
            var fly = new Game_Interpreter()
            fly.pluginCommand('mv3d', ['@e' + this.eventId(), 'elevation', '0', '3.5']);
                }
        if (x === this._x && y === this._y) this._staggerCount = 20;
      }
    } else if (this._stopCount > 0 && this._fleePlayer) {
      this.updateFleeMovement();
    } else if (r) {
      this.updateMoveReturnAfter();
    }
};

Game_Character.prototype.Randommove = function() {
    switch (Math.randomInt(5)) {
    case 0: case 1:
        this.moveRandom();
        break;
    case 2: case 3: case 4:
        this.moveForward();
        break;
    }
};


Game_Character.prototype.flyRandom = function() {
    switch (Math.randomInt(8)) {
    case 0: case 1:
    if (this.z <= $gamePlayer.z) {
        this.ascend();
        break;
    }
        this.descend();
        break;
     case 2: case 3: case 4: case 5: case 6: case 7:
    if (this.z >= $gamePlayer.z + 5) {
        this.descend();
        break;
    }
        this.ascend();
        break;
    }
};

Game_Character.prototype.ascend = function() {
        var fly = new Game_Interpreter()
        var RNG = Math.floor(Math.random(15) * 10) / 3
        fly.pluginCommand('mv3d', ['@e' + this.eventId(), 'elevation', '+' + RNG, '0.853']);
};

Game_Character.prototype.descend = function() {
        var fly = new Game_Interpreter()
        var RNG = this.z - Math.floor(Math.random(30) * 10) / 3;
        fly.pluginCommand('mv3d', ['@e' + this.eventId(), 'elevation', '' + RNG, '0.853']);
};

Game_Event.prototype.startReturnPhase = function() {
    this._chasePlayer = false;
    this._fleePlayer = false;
    this.setMoveSpeed(this._defaultSpeed);
    this.setMoveFrequency(this._defaultFreq);
    this._returnPhase = true;
    this.activateAlert();
    this._alertLock = 0;
    this._alertPlayer = false;
    this._returnFrames = this._returnWait;
};

Game_Event.prototype.updateMoveReturnAfter = function() {
    if (this._returnFrames > 0) return;
        if (!this._returnAfter) {
        this._returnPhase = false;
        this._returnFrames = 0;
        this._startchase = false;
        }
    var sx = this.deltaXFrom(this._startLocationX);
    var sy = this.deltaYFrom(this._startLocationY);
    if (this._bird) this.flyRandom();
    if (Math.abs(sx) > Math.abs(sy)) {
      if (Math.randomInt(6) <= 4) {
        this.moveStraight(sx > 0 ? 4 : 6);
        if (!this.isMovementSucceeded() && sy !== 0) {
          this.moveStraight(sy > 0 ? 8 : 2);
        }
      } else {
        this.moveRandom();
      }
    } else if (sy !== 0) {
      if (Math.randomInt(6) <= 4) {
        this.moveStraight(sy > 0 ? 8 : 2);
        if (!this.isMovementSucceeded() && sx !== 0) {
          this.moveStraight(sx > 0 ? 4 : 6);
        }
      } else {
        this.moveRandom();
      }
    }
    if (sx === 0 && sy === 0) {
      this._returnPhase = false;
      this._returnFrames = 0;
      this._direction = this._startLocationDir;
      this.setThrough(this._defaultThrough);
      this._startchase = false;
    }
};

Also included my heavily removed chase script as I edited it so much I think I'll just combine them soon.
Code:
Yanfly.ECP.Game_Event_updateSelfMovement =
    Game_Event.prototype.updateSelfMovement;
Game_Event.prototype.updateSelfMovement = function() {
    if (Imported.YEP_StopAllMove && $gameSystem.isEventMoveStopped()) return;
    this.updateChaseMovement();
};

Yanfly.ECP.Game_Event_update = Game_Event.prototype.update;
Game_Event.prototype.update = function() {
    Yanfly.ECP.Game_Event_update.call(this);
    this.updateReturnPhase();
};

Game_Event.prototype.canSeePlayer = function() {
    if (!this._seePlayer) return false;
    var sx = this.deltaXFrom($gamePlayer.x);
    var sy = this.deltaYFrom($gamePlayer.y);
    if (Math.abs(sx) > Math.abs(sy)) {
      var direction = (sx > 0) ? 4 : 6;
    } else {
      var direction = (sy > 0) ? 8 : 2;
    }
    if (direction === this.direction()) {
      this._alertLock = this._sightLock;
      return true;
    }
    return false;
};


Game_Event.prototype.nonSeePlayer = function() {
  if (Imported.YEP_X_EventChaseStealth) {
    if (this.meetStealthModeConditions()) {
      this.stealthClearChaseSettings();
      this._stopCount = 0;
      return false;
    }
  }
  return !this._seePlayer;
};

Game_Event.prototype.updateFleeDistance = function() {
    if (this._erased) return;
    if (this._fleeRange <= 0) return;
    var dis = Math.abs(this.deltaXFrom($gamePlayer.x));
    dis += Math.abs(this.deltaYFrom($gamePlayer.y));
    if (this.fleeConditions(dis)) {
      this.startEventFlee();
    } else if (this._fleePlayer) {
      this.endEventFlee();
    }
};

Game_Event.prototype.fleeConditions = function(dis) {
    if (this._alertLock > 0) return true;
    if (dis <= this._fleeRange && this.canSeePlayer()) return true;
    if (dis <= this._fleeRange && !this._seePlayer) {
      this._alertLock = this._sightLock;
      return true;
    }
    return false;
};

Game_Event.prototype.startEventFlee = function() {
    this._fleePlayer = true;
    this.setMoveSpeed(this._fleeSpeed);
};

Game_Event.prototype.endEventFlee = function() {
    this._fleePlayer = false;
    this.setMoveSpeed(this._defaultSpeed);
    if (this._alertTimer <= 0) this._alertPlayer = false;
    this.startReturnPhase();
};

Game_Event.prototype.updateChaseMovement = function() {
    if (this._staggerCount > 0) {
      return this._staggerCount--;
    }
    if (this._stopCount > 0 && this._chasePlayer) {
      var direction = this.findDirectionTo($gamePlayer.x, $gamePlayer.y);
      if (direction > 0) {
        var x = this._x;
        var y = this._y;
        this.moveStraight(direction);
        if (x === this._x && y === this._y) this._staggerCount = 20;
      }
    } else if (this._stopCount > 0 && this._fleePlayer) {
      this.updateFleeMovement();
    } else if (this._returnPhase) {
      this.updateMoveReturnAfter();
    } else {
      Yanfly.ECP.Game_Event_updateSelfMovement.call(this);
    }
};

Game_Event.prototype.updateFleeMovement = function() {
    switch (Math.randomInt(6)) {
    case 0: case 1: case 2: case 3: case 4:
      this.moveAwayFromPlayer();
      break;
    case 5:
      this.moveRandom();
      break;
    }
};

Game_Event.prototype.playAlertSound = function() {
    if (this._alertSound === '') return;
    var sound = {
      name:   this._alertSound,
      volume: this._alertSoundVol,
      pitch:  this._alertSoundPitch,
      pan:    this._alertSoundPan
    };
    AudioManager.playSe(sound);
};

Game_Event.prototype.playAlertCommonEvent = function() {
    if (this._alertCommonEvent <= 0) return;
    $gameTemp.reserveCommonEvent(this._alertCommonEvent);
};

Game_Event.prototype.startReturnPhase = function() {
    if (!this._returnAfter) return;
    this._returnPhase = true;
    this._returnFrames = this._returnWait;
};

Game_Event.prototype.updateReturnPhase = function() {
    if (this._returnPhase) this._returnFrames--;
    if (this._alertLock) this._alertLock--;
};

Game_Event.prototype.updateMoveReturnAfter = function() {
    if (this._returnFrames > 0) return;
    var sx = this.deltaXFrom(this._startLocationX);
    var sy = this.deltaYFrom(this._startLocationY);
    if (Math.abs(sx) > Math.abs(sy)) {
      if (Math.randomInt(6) <= 4) {
        this.moveStraight(sx > 0 ? 4 : 6);
        if (!this.isMovementSucceeded() && sy !== 0) {
          this.moveStraight(sy > 0 ? 8 : 2);
        }
      } else {
        this.moveRandom();
      }
    } else if (sy !== 0) {
      if (Math.randomInt(6) <= 4) {
        this.moveStraight(sy > 0 ? 8 : 2);
        if (!this.isMovementSucceeded() && sx !== 0) {
          this.moveStraight(sx > 0 ? 4 : 6);
        }
      } else {
        this.moveRandom();
      }
    }
    if (sx === 0 && sy === 0) {
      this._returnPhase = false;
      this._returnFrames = 0;
      this._direction = this._startLocationDir;
    }
};

Here's event page in case it helps with conditionals.
I had to turn on through since anything that tracks calculates destinations based off player seems to be extremely laggy unless set to through, even moving using the mouse diagonally at long distances.
It looks a lot complex to me and i don't get how i can obtain the z value in (and by) a variable.
There's a help file or something like that?
I got kinda lost here! XD

Thanks for trying to help, by the way. ^^
 

tseyik

Villager
Member
Joined
Oct 22, 2015
Messages
20
Reaction score
19
First Language
English
Primarily Uses
@tseyik what is this <mv3d-regions> block? Is it new? Can't find mention of it anywhere...
I thought you could only make region settings on the plugin' parameters right now...
mv3d-babylon.js presets
001.jpg
 

Attachments

YoraeRasante

Veteran
Veteran
Joined
Jun 6, 2014
Messages
1,599
Reaction score
392
First Language
Portuguese
Primarily Uses
RMMV
@tseyik ok, the way your other screenshot was taken it seemed like it was a map's notetag box, sorry.
 

glaphen

Veteran
Veteran
Joined
Jan 13, 2019
Messages
326
Reaction score
120
First Language
English
Primarily Uses
RMMV
It looks a lot complex to me and i don't get how i can obtain the z value in (and by) a variable.
There's a help file or something like that?
I got kinda lost here! XD

Thanks for trying to help, by the way. ^^
As shown in bird script you can get z value inside a movement route plugin by
Code:
Game_Character.prototype.flyRandom = function() {
    switch (Math.randomInt(8)) {
    case 0: case 1:
    if (this.z <= $gamePlayer.z) {
        this.ascend();
        break;
    }
        this.descend();
        break;
     case 2: case 3: case 4: case 5: case 6: case 7:
    if (this.z >= $gamePlayer.z + 5) {
        this.descend();
        break;
    }
        this.ascend();
        break;
    }
};
this.z, if you want to make it equal to player you could do like if (this.z != $gamePlayer.z)
this.equalize();
Code:
Game_Character.prototype.equalize = function() {
    var fly = new Game_Interpreter()
    var z = $gamePlayer.z
    fly.pluginCommand('mv3d', ['@e' + this.eventId(), 'elevation', '' + z, '0']);
};
then it would always be equal to player, change var z to be equal to $gameVariables.value() to make it equal to a variable. To make it check regions z you could check after every movement the region with
if (this.regionId()) { and compare it to an array of each regions you would make at the beginning of game and store and a height of each region, might be an easier way if there's a way to check the tiles collision height. Checking events z you would first need to know what event is being shot at, then you can get it with $gameMap.event().z === $gameMap.event(this._eventId).z).

Actually even better might be yanfly event chases stagger, if it tries to move into a square it can't move to
Code:
Game_Event.prototype.updateChaseMovement = function() {
    if (this._staggerCount > 0) {
      return this._staggerCount--;
    }
    if (this._stopCount > 0 && this._chasePlayer) {
      var direction = this.findDirectionTo($gamePlayer.x, $gamePlayer.y);
      if (direction > 0) {
        var x = this._x;
        var y = this._y;
        this.moveStraight(direction);
        if (x === this._x && y === this._y) this._staggerCount = 20;
      }
    } else if (this._stopCount > 0 && this._fleePlayer) {
      this.updateFleeMovement();
    } else if (this._returnPhase) {
      this.updateMoveReturnAfter();
    } else {
      Yanfly.ECP.Game_Event_updateSelfMovement.call(this);
    }
};
so if its x and y are equal to its previous x y it would be staggered since it didn't move, so if the x y of bullet is the same then it's obviously hit something, if it's not set to through, if you put the bullet to player.z height minus stair threshold height then if its x and y are the same after movement just erase it.
 
Last edited:

Poppie360

chocobo wrangler
Veteran
Joined
Feb 28, 2018
Messages
175
Reaction score
52
First Language
English
Primarily Uses
RMMV
Looking into the scripts how would i overwrite function in "characters.js"?
Specifically the following function:

JavaScript:
updateCharacter(){
    this._tilesetId = $gameMap.tilesetId();
    this._tileId = this._character.tileId();
    this._characterName = this._character.characterName();
    this._characterIndex = this._character.characterIndex();
    this._isBigCharacter = ImageManager.isBigCharacter(this._characterName);
    if(this._tileId>0){
        this.setTileMaterial(this._tileId);
    }else if(this._characterName){
        this.setMaterial(`img/characters/${this._characterName}.png`);
    }else{
        this.setEnabled(false);
    }
}
Normally it would be as simple as just saying something like this:
JavaScript:
mv3d.updateCharacter(){
    //insert stuff
}
But that doesn't do anything when put into practice.
 

CoopNinjask

Veteran
Veteran
Joined
Jan 9, 2020
Messages
105
Reaction score
61
First Language
Portuguese
Primarily Uses
RMMV
As shown in bird script you can get z value inside a movement route plugin by
Code:
Game_Character.prototype.flyRandom = function() {
    switch (Math.randomInt(8)) {
    case 0: case 1:
    if (this.z <= $gamePlayer.z) {
        this.ascend();
        break;
    }
        this.descend();
        break;
     case 2: case 3: case 4: case 5: case 6: case 7:
    if (this.z >= $gamePlayer.z + 5) {
        this.descend();
        break;
    }
        this.ascend();
        break;
    }
};
this.z, if you want to make it equal to player you could do like if (this.z != $gamePlayer.z)
this.equalize();
Code:
Game_Character.prototype.equalize = function() {
    var fly = new Game_Interpreter()
    var z = $gamePlayer.z
    fly.pluginCommand('mv3d', ['@e' + this.eventId(), 'elevation', '' + z, '0']);
};
then it would always be equal to player, change var z to be equal to $gameVariables.value() to make it equal to a variable. To make it check regions z you could check after every movement the region with
if (this.regionId()) { and compare it to an array of each regions you would make at the beginning of game and store and a height of each region, might be an easier way if there's a way to check the tiles collision height. Checking events z you would first need to know what event is being shot at, then you can get it with $gameMap.event().z === $gameMap.event(this._eventId).z).

Actually even better might be yanfly event chases stagger, if it tries to move into a square it can't move to
Code:
Game_Event.prototype.updateChaseMovement = function() {
    if (this._staggerCount > 0) {
      return this._staggerCount--;
    }
    if (this._stopCount > 0 && this._chasePlayer) {
      var direction = this.findDirectionTo($gamePlayer.x, $gamePlayer.y);
      if (direction > 0) {
        var x = this._x;
        var y = this._y;
        this.moveStraight(direction);
        if (x === this._x && y === this._y) this._staggerCount = 20;
      }
    } else if (this._stopCount > 0 && this._fleePlayer) {
      this.updateFleeMovement();
    } else if (this._returnPhase) {
      this.updateMoveReturnAfter();
    } else {
      Yanfly.ECP.Game_Event_updateSelfMovement.call(this);
    }
};
so if its x and y are equal to its previous x y it would be staggered since it didn't move, so if the x y of bullet is the same then it's obviously hit something, if it's not set to through, if you put the bullet to player.z height minus stair threshold height then if its x and y are the same after movement just erase it.
I'm finally understanding how to work with Z coordinates.
I've made the bullet always get the Z coordinate of the player and I've also made the collision with events work.
I just need to understand how to make the collision with the tilesets work properly. At the moment, the collision with the tileset is happening regardless of the Z bullet's coordinate.
 

glaphen

Veteran
Veteran
Joined
Jan 13, 2019
Messages
326
Reaction score
120
First Language
English
Primarily Uses
RMMV
I'm finally understanding how to work with Z coordinates.
I've made the bullet always get the Z coordinate of the player and I've also made the collision with events work.
I just need to understand how to make the collision with the tilesets work properly. At the moment, the collision with the tileset is happening regardless of the Z bullet's coordinate.
Well as said if you make it similar to yanfly event chase player stagger so it tracks x y before movement and then compares it after movement, if the bullet isn't set to through and it doesn't step over the event from stair threshold it shouldn't move, you can erase the event if said condition was true, now if that stop was from an event or was a tileset, you would have to figure out, you could check for an event 1 step away by checking x or y + 1 based off its current direction.

You can get events at a location with
$gameMap.eventIdXy(x, y) ;
 
Last edited:

CoopNinjask

Veteran
Veteran
Joined
Jan 9, 2020
Messages
105
Reaction score
61
First Language
Portuguese
Primarily Uses
RMMV
@glaphen

I did it! My collision system now have z coordinates!
Thank you so much for all the help! :awink:
 
Last edited:

Poppie360

chocobo wrangler
Veteran
Joined
Feb 28, 2018
Messages
175
Reaction score
52
First Language
English
Primarily Uses
RMMV
I have still no idea how to work with it as it deals with the really fun map thing and that just complicates everything.

I cant figure out how to overwrite it still, i tried a few things, but nothing really worked.
 

Dread_Nyanak

Veteran
Veteran
Joined
Feb 24, 2019
Messages
165
Reaction score
275
First Language
English
Primarily Uses
RMMV
In regard on the last update.
My game looks like this:
View attachment 133780
Before this update, the characters was messy., now it's the map that looks this way, an d the sprites is ok.
This is excellent news. I made a very small change in the part of the code where I get the texture's size. I switched from using getBaseSize to getSize. According to the documentation, they sometimes return different values, and that's the cause of the bug. So I just need to revert the change for the tiles and keep the change for the characters.
Though, the characters do look a bit vertically stretched.

@Waterguy
The mv3d-regions block is actually for the next major update. Rpg maker ignores when I switch branches unless I close the project, so changes I make to the map accidentally get pushed out with bugfixes.


@Poppie360
To overwrite the function you would need
JavaScript:
mv3d.Character.prototype.updateCharacter=function(){

}
 
Last edited:

Poppie360

chocobo wrangler
Veteran
Joined
Feb 28, 2018
Messages
175
Reaction score
52
First Language
English
Primarily Uses
RMMV
This is excellent news. I made a very small change in the part of the code where I get the texture's size. I switched from using getBaseSize to getSize. According to the documentation, they sometimes return different values, and that's the cause of the bug. So I just need to revert the change for the tiles and keep the change for the characters.
Though, the characters do look a bit vertically stretched.

@Waterguy
The mv3d-regions block is actually for the next major update. Rpg maker ignores when I switch branches unless I close the project, so changes I make to the map accidentally get pushed out with bugfixes.


@Poppie360
To overwrite the function you would need
JavaScript:
mv3d.Character.prototype.updateCharacter=function(){

}
Oh that actually looks much easier than how i was going to go about it on my own, i was going to go and edit it and rebuild the map file...thanks for the help!

for future reference, would you access all functions by?:
mv3d.FILENAME.prototype.FUNCTIONNAME
 

Dread_Nyanak

Veteran
Veteran
Joined
Feb 24, 2019
Messages
165
Reaction score
275
First Language
English
Primarily Uses
RMMV
@Poppie360
No, in this case Character is the name of the class. The prototype is only used for classes. There are some functions directly on the mv3d object, and some which are on a class's prototype.
 

Poppie360

chocobo wrangler
Veteran
Joined
Feb 28, 2018
Messages
175
Reaction score
52
First Language
English
Primarily Uses
RMMV
@Poppie360
No, in this case Character is the name of the class. The prototype is only used for classes. There are some functions directly on the mv3d object, and some which are on a class's prototype.
I seem to have run into an error:

 

Dread_Nyanak

Veteran
Veteran
Joined
Feb 24, 2019
Messages
165
Reaction score
275
First Language
English
Primarily Uses
RMMV
Do you have the latest version of mv3d? mv3d.Character shouldn't be undefined.
 

Dread_Nyanak

Veteran
Veteran
Joined
Feb 24, 2019
Messages
165
Reaction score
275
First Language
English
Primarily Uses
RMMV
Github.
 

Poppie360

chocobo wrangler
Veteran
Joined
Feb 28, 2018
Messages
175
Reaction score
52
First Language
English
Primarily Uses
RMMV
Github.
iiiiiiiiiit works now thanks

edit:

Seems i have run into some issues, i have no idea why this happened

Code:
mv3d.Character.prototype.updateCharacter=function(){
        this._tilesetId = $gameMap.tilesetId();
        this._tileId = this._character.tileId();
        this._characterName = this._character.characterName();
        this._characterIndex = this._character.characterIndex();
        this._isBigCharacter = ImageManager.isBigCharacter(this._characterName);
        if(this._character.mv_sprite == null){
            //uhhh, well this shouldnt happen
        } else if(this._character.mv_sprite._pathName != null && this._character.mv_sprite._path != null){
            if(this._tileId>0){
                this.setTileMaterial(this._tileId);
            }else if(this._characterName){
                if(this.isVehicle){
                    if(this.isBoat){
                        if($gameSwitches.value(6) == true) {
                            this.setMaterial($gameVariables.value(7) + $gameVariables.value(8) + '.png');
                        } else {
                            this.setMaterial(`img/characters/${this._characterName}.png`);
                        }
                    } else if(this.isShip){
                       if($gameSwitches.value(7) == true) {
                           this.setMaterial($gameVariables.value(9) + $gameVariables.value(10) + '.png');
                        } else {
                            this.setMaterial(`img/characters/${this._characterName}.png`);
                        }
                    } else if(this.isAirship){
                        if($gameSwitches.value(8) == true) {
                            this.setMaterial($gameVariables.value(11) + $gameVariables.value(12) + '.png');
                        } else {
                            this.setMaterial(`img/characters/${this._characterName}.png`);
                        }
                    }
                } else {
                    if((this._character.mv_sprite._path + this._character.mv_sprite._pathName + '.png') != 'VV.png'){
                        this.setMaterial(this._character.mv_sprite._path + this._character.mv_sprite._pathName + '.png');
                    } else {
                        this.setMaterial(`img/characters/${this._characterName}.png`);
                    }
                }
            }else{
                this.setEnabled(false);
            }
        } else {
            if(this._tileId>0){
                this.setTileMaterial(this._tileId);
            }else if(this._characterName){
                this.setMaterial(`img/characters/${this._characterName}.png`);
            }else{
                this.setEnabled(false);
            }
        }
        //console.log(this);
    }

for some reason adding the actor to the party (the follower) cuased an event where all of the events that didnt have custom graphics to have their this._character to become undefined. maybe even more, i havent checked yet
 
Last edited:

Dread_Nyanak

Veteran
Veteran
Joined
Feb 24, 2019
Messages
165
Reaction score
275
First Language
English
Primarily Uses
RMMV
@Poppie360
I don't see anything wrong with the code you've written. The black textures usually mean there's something wrong with the material.
One thing to note is that updateCharacter is only called when isImageChanged returns true, so if you want you could also overwrite isImageChanged to check for changes in _path and _pathName.

@WesdrasLink
I updated github reverting the change to tiles. Can you or someone else who experienced the bug test to see if it's fixed?
 

WesdrasLink

Veteran
Veteran
Joined
Jan 2, 2013
Messages
40
Reaction score
60
First Language
Portuguese
Primarily Uses
RMMV
@Dread_Nyanak
I can't help with the codes, but this is what happened to me:
1.png
Most tiles is ok, it seems that some tile b,c,d,e have some problems, and animated auto tiles have problems now.
 

Users Who Are Viewing This Thread (Users: 2, Guests: 9)

Latest Threads

Latest Profile Posts

Vote for what I show more indepth on Twitter tomorrow from the MZ default resources
Oh look, 12 more free Daz3D models. *adds them to his collection * Yes, the fools... Give it a few months and my collection will be crazy, all without paying a dime. I still have no idea if I'll ever learn the software, but hey... Just in case, these models are quite expensive. In two weeks, they've already given me almost $400 worth of free models. :LZSexcite:
Not easy to find DS resources, is it? I need to make a good compilation thread linking to all the artists that do DS...
Spent a whole evening planning Stats, Animations, Abilities of 24 different weapons.. Only to realize I was just Bloating the Game. In the end i decided to stick with only 6.
Haven’t gotten over a mentor’s promotion. He deserves it, but he was the first person to be nice to me at work. It’s been hard for me to let him go.

Forum statistics

Threads
99,350
Messages
964,357
Members
130,947
Latest member
critikalseth
Top