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 ?
JavaScript questions that don't deserve their own thread
● ARCHIVED · READ-ONLY
-
-
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.
-
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 ? -
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? -
How do you make it so the critical hit rate (CRI) goes up on level ups?
-
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? -
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) -
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.
-
@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 -
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? -
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):
This is the function for drawing player character icons in the battle status window, which I'm trying to use as a reference:SpoilerSprite_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; }};
SpoilerCode: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); }}; -
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? -
@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 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? -
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. -
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. -
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. -
Please delete comment. Thanks!
-
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.
-
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).