Putting the 'role' back in role-playing games since 2002.
Donate to Codex
Good Old Games
  • Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.

RPG Maker MZ First Person Camera Plugin

Sunri

Liturgist
Joined
Apr 16, 2020
Messages
2,796
Location
Poland
I asked AI to make First person view plugin for RPG marker MZ and after some errors and shit i have this

// =============================================================================
// First Person Camera Plugin
// by Sunri
// Version: 1.2.1
// License: MIT
// =============================================================================

/*:
@target MZ
@plugindesc A plugin that allows for a first-person camera view in RPG Maker MZ.
@help This plugin allows for a first-person camera view in RPG Maker MZ.
The first-person camera view will always be enabled when this plugin is active.

@param cameraX
@text Camera X Position
@type number
@desc The X position of the camera relative to the player. Default: -0.5.
@default -0.5

@param cameraY
@text Camera Y Position
@type number
@desc The Y position of the camera relative to the player. Default: 1.
@default 1

@param cameraZ
@text Camera Z Position
@type number
@desc The Z position of the camera relative to the player. Default: 1.
@default 1

@param cameraRotationX
@text Camera X Rotation
@type number
@desc The X rotation of the camera relative to the player. Default: -20.
@default -20

@param cameraRotationY
@text Camera Y Rotation
@type number
@desc The Y rotation of the camera relative to the player. Default: 180.
@default 180

@param cameraRotationZ
@text Camera Z Rotation
@type number
@desc The Z rotation of the camera relative to the player. Default: 0.
@default 0
*/

(function() {
var parameters = PluginManager.parameters('FirstPersonCameraPlugin');
var cameraPosition = { x: Number(parameters['cameraX']), y: Number(parameters['cameraY']), z: Number(parameters['cameraZ']) };
var cameraRotation = { x: Number(parameters['cameraRotationX']), y: Number(parameters['cameraRotationY']), z: Number(parameters['cameraRotationZ']) };

var _Spriteset_Base_createPictures = Spriteset_Base.prototype.createPictures;
Spriteset_Base.prototype.createPictures = function() {
_Spriteset_Base_createPictures.call(this);
this._cameraContainer = new PIXI.Container();
this._pictureContainer.addChild(this._cameraContainer);
};

var _Scene_Map_update = Scene_Map.prototype.update;
Scene_Map.prototype.update = function() {
_Scene_Map_update.call(this);

var playerX = $gamePlayer.x;
var playerY = $gamePlayer.y;
var playerZ = $gamePlayer.z;

cameraPosition.x = playerX + Number(parameters['cameraX']);
cameraPosition.y = playerY + Number(parameters['cameraY']);
cameraPosition.z = playerZ + Number(parameters['cameraZ']);

cameraRotation.x = Number(parameters['cameraRotationX']);
cameraRotation.y = Number(parameters['cameraRotationY']);
cameraRotation.z = Number(parameters['cameraRotationZ']);

if (this._pictureContainer && this._pictureContainer._baseSprite && this._cameraContainer) {
if (!this._pictureContainer.contains(this._cameraContainer)) {
this._pictureContainer.addChild(this._cameraContainer);
}
this._cameraContainer.position.set(cameraPosition.x, cameraPosition.y, cameraPosition.z);
this._cameraContainer.rotation.set(cameraRotation.x * Math.PI / 180, cameraRotation.y * Math.PI / 180, cameraRotation.z * Math.PI / 180);
}
};
})();

How it looks inside program
Gocvh7Q.png

But for some reason it doesn't work, any ideas what I'm missing?

I wanted a camera similar to this, but in MZ instead MV.

 

Kedar

Educated
Joined
Apr 14, 2022
Messages
83
How come there are all of those impressive plug-ins for RPG Maker, yet almost every game made in it available on Steam looks the same?
 

Sunri

Liturgist
Joined
Apr 16, 2020
Messages
2,796
Location
Poland
How come there are all of those impressive plug-ins for RPG Maker, yet almost every game made in it available on Steam looks the same?
Because the engine is problematic and has a lot of limitations plugins cause a lot of problems you get error after error when trying to change things and when it finally works fps drops to single digit lol
 

Tyranicon

A Memory of Eternity
Developer
Joined
Oct 7, 2019
Messages
6,147
How come there are all of those impressive plug-ins for RPG Maker, yet almost every game made in it available on Steam looks the same?
Because the engine is problematic and has a lot of limitations plugins cause a lot of problems you get error after error when trying to change things and when it finally works fps drops to single digit lol

I'm already ditching MV3D because the FPS drop and complications aren't worth having a fully 3D game, which would work better in Unity anyways.
 

Sunri

Liturgist
Joined
Apr 16, 2020
Messages
2,796
Location
Poland
How come there are all of those impressive plug-ins for RPG Maker, yet almost every game made in it available on Steam looks the same?
Because the engine is problematic and has a lot of limitations plugins cause a lot of problems you get error after error when trying to change things and when it finally works fps drops to single digit lol

I'm already ditching MV3D because the FPS drop and complications aren't worth having a fully 3D game, which would work better in Unity anyways.
Thank you for recommendation but i dont want to use other people plugins i wanted to use first person camera to obscure player vision and make dungeon crawling more interesting buy maybe i will just limit player view with some lighting system seems easier to make and less taxing on the engine.
 

Tyranicon

A Memory of Eternity
Developer
Joined
Oct 7, 2019
Messages
6,147
How come there are all of those impressive plug-ins for RPG Maker, yet almost every game made in it available on Steam looks the same?
Because the engine is problematic and has a lot of limitations plugins cause a lot of problems you get error after error when trying to change things and when it finally works fps drops to single digit lol

I'm already ditching MV3D because the FPS drop and complications aren't worth having a fully 3D game, which would work better in Unity anyways.
Thank you for recommendation but i dont want to use other people plugins i wanted to use first person camera to obscure player vision and make dungeon crawling more interesting buy maybe i will just limit player view with some lighting system seems easier to make and less taxing on the engine.

Just curious, do you want to divulge what AI are you using to refine these plugins?

Edit: I took a look at the script. Are you using another plugin to handle 3D? You need that first.
 
Last edited:

Sunri

Liturgist
Joined
Apr 16, 2020
Messages
2,796
Location
Poland
How come there are all of those impressive plug-ins for RPG Maker, yet almost every game made in it available on Steam looks the same?
Because the engine is problematic and has a lot of limitations plugins cause a lot of problems you get error after error when trying to change things and when it finally works fps drops to single digit lol

I'm already ditching MV3D because the FPS drop and complications aren't worth having a fully 3D game, which would work better in Unity anyways.
Thank you for recommendation but i dont want to use other people plugins i wanted to use first person camera to obscure player vision and make dungeon crawling more interesting buy maybe i will just limit player view with some lighting system seems easier to make and less taxing on the engine.

Just curious, do you want to divulge what AI are you using to refine these plugins?

Edit: I took a look at the script. Are you using another plugin to handle 3D? You need that first.
Im using ChatGPT just ask for plugin for example Make a JavaScript plugin for RPG MV that will make font 25% smaller and you get this
//=============================================================================
// FontSize.js
//=============================================================================

/*:
* @plugindesc Reduces the font size by 25%. Use plugin command "FontSmaller" to activate.
*
* @help FontSize.js
*
* Plugin Command:
* FontSmaller - Reduces the font size by 25%.
*/

(function() {

var _Window_Base_resetFontSettings = Window_Base.prototype.resetFontSettings;
Window_Base.prototype.resetFontSettings = function() {
_Window_Base_resetFontSettings.call(this);
this.contents.fontSize = Math.round(this.contents.fontSize * 0.75);
};

var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'FontSmaller') {
$gameSystem.reduceFontSize();
}
};

Game_System.prototype.reduceFontSize = function() {
var newFontSize = Math.round(Window_Base.prototype.standardFontSize() * 0.75);
this._fontSizeDifference = newFontSize - Window_Base.prototype.standardFontSize();
Window_Base.prototype.standardFontFace = function() {
return $gameSystem.isChinese() ? 'SimHei, Heiti TC, sans-serif' : 'GameFont';
};
Window_Base.prototype.standardFontSize = function() {
return newFontSize;
};
};

})();

And after that if i want to change something, i just paste the whole code and ask him to make the change for example change this code to be always active without using command (pasted previous code) and i get

Here's an updated version of the code that will automatically make the font 25% smaller without using a command:

javascriptCopy code
(function() {
var originalFontSize = Window_Base.prototype.standardFontSize();
Window_Base.prototype.standardFontSize = function() {
return originalFontSize * 0.75;
};
})();

This code overrides the standardFontSize function of the Window_Base class to return a font size that is 25% smaller than the original size. It is wrapped in an immediately invoked function expression (IIFE) to ensure that it is executed as soon as the game starts
 

Tyranicon

A Memory of Eternity
Developer
Joined
Oct 7, 2019
Messages
6,147
Ah okay. I attempted to have ChatGPT generate some code for a RPGM plugin and it basically spat gibberish out at me.

If you're trying to do a first-person mode you need to first convert the engine to display 3D. That's what the MV3D plugin does.

I have no idea how to make that from scratch.
 

Sunri

Liturgist
Joined
Apr 16, 2020
Messages
2,796
Location
Poland
Ah okay. I attempted to have ChatGPT generate some code for a RPGM plugin and it basically spat gibberish out at me.

If you're trying to do a first-person mode you need to first convert the engine to display 3D. That's what the MV3D plugin does.

I have no idea how to make that from scratch.
To be honest, it's a hit-and-miss sometimes it makes a plugin that works, sometimes he can't even add } at the end of the code despite me asking specifically to add it, so now I'm only asking for simple stuff like rolling random stats and shit.
 

As an Amazon Associate, rpgcodex.net earns from qualifying purchases.
Back
Top Bottom