JavaScript questions that don't deserve their own thread

loustak

Villager
Member
Joined
Dec 26, 2013
Messages
16
Reaction score
3
First Language
Français
Primarily Uses
Hello,

I try to make a picture move with my plugin I managed to make it work but I had to use TilingSprite instead of Sprite. Is it okay if I only use TilingSprite instead of Sprite everywhere ? So I will use this even for not moving picture is it ok ?
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,282
Reaction score
106
First Language
Irish
Primarily Uses
N/A
What are you trying to achieve? If you want a sprite to move and repeat the entire screen, I suggest the TilingSprite as it has that property already. Sprites follow the image measurements and won't repeat if you move its x and y. It's better that you use TilingSprite for any moving images you have and sprite for the static ones.
 

loustak

Villager
Member
Joined
Dec 26, 2013
Messages
16
Reaction score
3
First Language
Français
Primarily Uses
There is a way to access to :

Spriteset_Map.prototype.createTilemap = function() { this._tilemap = new Tilemap(); this._tilemap.tileWidth = $gameMap.tileWidth(); this._tilemap.tileHeight = $gameMap.tileHeight(); this._tilemap.setData($gameMap.width(), $gameMap.height(), $gameMap.data()); this._tilemap.horizontalWrap = $gameMap.isLoopHorizontal(); this._tilemap.verticalWrap = $gameMap.isLoopVertical(); this.loadTileset(); this._baseSprite.addChild(this._tilemap);};the _tilemap outside this class ?

Like if I could do :

function lel() { var lel = new Sprite(); Spriteset_Map._tilemap.addChild(lel);};Whitout using reference ?
 

Pine Towers

Knight Hospitaller
Veteran
Joined
Nov 11, 2015
Messages
466
Reaction score
223
First Language
Portuguese
Primarily Uses
RMMV
How do I check if the skill user have at least 1 MP?

The skill uses Yanfly's Limited Skill, but after it hits the target it calls a Common Event that asks if the player wants to spend 1 MP to heal 25% of HP. But I don't know how check this. Should I store the actor id into a variable and them check if for MP >1? Or there's an easier way?
 

TheGamedawg

Veteran
Veteran
Joined
Aug 29, 2014
Messages
350
Reaction score
133
First Language
English
Primarily Uses
How do you make it so the critical hit rate (CRI) goes up on level ups?
 

Leetstuff

Villager
Member
Joined
Oct 27, 2015
Messages
26
Reaction score
2
First Language
Portuguese
Hi guys, I'm having trouble understanding the script call for showing animation in battle. I'd like to have the animation played at the user of the turn.

How do I do it? Do I have to make an if clause for party members and monsters? Or is there a way to target the user?
 

duskaco

Villager
Member
Joined
Dec 14, 2015
Messages
18
Reaction score
0
First Language
English
I found the functions

BattleManager.targetPosX(group, position);

and

BattleManager.targetPosY(group, position);

How are these lines used? I don't have any idea what to enter in group or position.

(I think that group is to choose between actors and enemies, but I do not know what to enter there)
 

WesdrasLink

Veteran
Veteran
Joined
Jan 2, 2013
Messages
35
Reaction score
46
First Language
Portuguese
Primarily Uses
RMMV
Hello friends, i have a question about coordinates using scripts,for exemple:

I have a condition in events that use this little script:

$gamePlayer.x == X
 \  $gamePlayer.y == Y 

If the character stop in this position something will happen.
But i want to work with events too, like this:

Event == X
\  Event == Y)

But with script command to avoid using variables of course. 
I was searching in the original scripts in RPG Maker MV, but i have no sucess and i don't know if this is possible. 

Thanks.
 
 

Quxios

Veteran
Veteran
Joined
Jan 8, 2014
Messages
1,055
Reaction score
782
First Language
English
Primarily Uses
RMMV
@loustak

If you want to access Spriteset_Map from outside that class, you would do something like:

SceneManager._scene._spriteset._tilemap.addChild(someSprite);But that will only work if you're on scene map, so you might want to add a conditional check like:

var scene = SceneManager._scene;if (scene.constructor === Scene_Map) { scene._spriteset._tilemap.addChild(someSprite);}@TheGamedawg

Best way is to use a plugin. A quick and easy and ugly way is to edit the xparam function like:

//doYourAliasStuffHereGame_Actor.prototype.xparam = function(xparamId) { // You can call the parent function instead of running an alias // but maybe better to call alias for compatibility ? var value = alias.call(xparamId); if (xparamId === 2) { // xparam 2 is cri // Now just add stuff to value, 1 is 100%, 0.5 is 50% 0 is 0% // example of add 5% crit per lvl value += (this.level * 5) / 100; }; return value;};@WesdrasLink

if you want to get events x/ y you use:

Code:
$gameMap.event(eventId).x$gameMap.event(eventId).y
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,282
Reaction score
106
First Language
Irish
Primarily Uses
N/A
I want to build two types of sprite actors:

Spriteset_Battle.prototype.createActors = function() { this._actorSprites = []; for (var i = 0; i < $gameParty.maxBattleMembers(); i++) { if ($gameSystem.isSideView()) { this._actorSprites = new Sprite_Actor(); } else { this._actorSprites = new Sprite_Actor2(); } this._battleField.addChild(this._actorSprites); } };But this does not work. What I want to do is that if Sideview is not on, create a brand new sprite actor, if its sideview, the original sprite actor. Or, better yet, is there a way to show the sprite actor even if Use SV Battle System is not checked?
 

Porcelain

Veteran
Veteran
Joined
Oct 12, 2015
Messages
38
Reaction score
1
First Language
English
Primarily Uses
I want to have enemy state icons drawn the same way as the player characters' (in a straight line of up to 4 icons) rather than flashing between icons. I'm pretty sure the solution is editing these two functions in rpg_sprites.js (Sprite_Enemy):

Sprite_Enemy.prototype.createStateIconSprite = function() { this._stateIconSprite = new Sprite_StateIcon(); this.addChild(this._stateIconSprite);};Sprite_Enemy.prototype.updateStateSprite = function() { this._stateIconSprite.y = -Math.round((this.bitmap.height + 40) * 0.9); if (this._stateIconSprite.y < 20 - this.y) { this._stateIconSprite.y = 20 - this.y; }};
This is the function for drawing player character icons in the battle status window, which I'm trying to use as a reference:

Code:
Window_Base.prototype.drawActorIcons = function(actor, x, y, width) {    width = width || 144;    var icons = actor.allIcons().slice(0, Math.floor(width / Window_Base._iconWidth));    for (var i = 0; i < icons.length; i++) {        this.drawIcon(icons[i], x + Window_Base._iconWidth * i, y + 2);    }};
 
Last edited by a moderator:

Leetstuff

Villager
Member
Joined
Oct 27, 2015
Messages
26
Reaction score
2
First Language
Portuguese
There are these Availability Checks for Skills, Armors, States and Weapons:


$game_actors[X].equips.include?($data_weapons[Y])
$game_actors[X].equips.include?($data_armors[Y])
$game_actors[X].skills.include?($data_skills[Y])
$game_actors[X].states.include?($data_states[Y])
$game_actors[actorid].skill_learn?($data_skills[skillid])


I thought they would exist for Items aswell, but:


$game_party.items.include?($data_items[Y])


Doesn't work.


I'm trying to make a condition for Hime's Hidden Choice, so I'm not using if(){}, since it has to be a Script in this format:


hide_choice( choiceNumber, condition )


What am I doing wrong here? What's the item check script call?
 

Quxios

Veteran
Veteran
Joined
Jan 8, 2014
Messages
1,055
Reaction score
782
First Language
English
Primarily Uses
RMMV
@Leetstuff those calls look like they are from RPG Maker VXA not MV.


For MV Item check is:


$gameParty.items().contains($dataItems[Id]);


you can also use the .hasItem(item, includeEquip) function in game party. If includeEquip is true, it will check if anyone in the party has that item equipped.
 

Leetstuff

Villager
Member
Joined
Oct 27, 2015
Messages
26
Reaction score
2
First Language
Portuguese
@Leetstuff those calls look like they are from RPG Maker VXA not MV.


For MV Item check is:



$gameParty.items().contains($dataItems[Id]);


you can also use the .hasItem(item, includeEquip) function in game party. If includeEquip is true, it will check if anyone in the party has that item equipped.
Thank you! One more thing, in $dataItems[Id], can the id be an array of items? 
 

Quxios

Veteran
Veteran
Joined
Jan 8, 2014
Messages
1,055
Reaction score
782
First Language
English
Primarily Uses
RMMV
Nope just one item at a time. Not sure if there's any built in functions to check for multiple from a single function, it would just be a simple loop.


If you want to do multiple items at once you can do something like:


[array, of, item, ids].every(function(id) { return $gameParty.hasItem($dataItems[id])} );


You can also use .some() if you want it to return true as long as you have 1 of the items


* note there are other ways of doing this, but this was the shortest way I could think of. 
 
Last edited by a moderator:

omen613

Veteran
Veteran
Joined
May 22, 2012
Messages
309
Reaction score
106
First Language
English
Primarily Uses
Hello all I'm trying to make a custom skill requirement using yanfly's skill core script


Its requires a certain party member (not the user) to not be inflicted with state 1 (KO)


This is what I have


<Custom Requirement>


if if $game_actors[3].states.include?($data_states[1])


value = false


else


value = true


</Custom Requirement>


Any help would be much appreciated.
 
Last edited by a moderator:
Joined
Jul 20, 2014
Messages
3
Reaction score
0
Primarily Uses
Hey all. Is there something I'm missing about the various Input methods?


At the moment, my button-mashing minigame is unworkable because you can just hold the button down to win. In RPG Maker VX, Input.trigger would read input exactly once. But the MV methods (isPressed, isTriggered, isRepeated) show no difference from eachother. In addition, holding down the confirm button lags the game as it reads the input every frame.
 

Shinma

Lurker
Veteran
Joined
Dec 29, 2012
Messages
756
Reaction score
337
First Language
English
Primarily Uses
RMMV
Please delete comment. Thanks!
 
Last edited by a moderator:

TheGamedawg

Veteran
Veteran
Joined
Aug 29, 2014
Messages
350
Reaction score
133
First Language
English
Primarily Uses
In the code for rpg_windows.js there's a function for drawHorzLine.  I was wondering if there was something like that for a vertical line too.
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
857
First Language
German
Primarily Uses
No, but it's easy to create you own by taking the horizontal line as a template. The core scripts only use horizontal lines (for the status menu).
 

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

Latest Threads

Latest Profile Posts

I'm currently being attacked by the RPG Maker Hydra: fixing one problem only to have two more rise to take its place.
Hey you! Yeah YOU! Whatcha doin' not backing up your projects? You a masochist or sumthin'? GO BACK UP YOUR PROJECTS! Sheeesh... Didn't think I'd hafta spell it out for yas.
now I need to determine, how MV determines if an auto tile is complete or not.
Edit:From what I can tell it uses Autotile kinds to do that.
Edit 2: The editor determines it and packs picture data for the engine....
Finished with the ground work for my class system, using Ellye's Class Change Equipment and Yanfly's Class Change Core plugins to implement an equip based subclass feature!
Hi people! I was wondering... Here in Brazil, we have a whats app group for we talk about rpg maker and our projects. A more informal way for we meet each other. Is there any whats app group out there? :)

Forum statistics

Threads
94,281
Messages
919,656
Members
124,020
Latest member
6264442
Top