Status
Not open for further replies.

jjbob1234

Villager
Member
Joined
Mar 17, 2014
Messages
13
Reaction score
8
Primarily Uses
I'm trying to do some fancy stuff with enemy sprites but I'm not sure where to start, I've been digging through the coding to try and find the hierarchy to affect certain aspects, but it's a little confusing finding which script call will actually affect the sprites not the object.

Basically the main thing I'm trying to do now is to change the blendMode on one enemy sprite from 0 to 1 using a script call.
I'm thinking that if I were able to do this it would cause the enemy sprite to be in an addition blend mode? perhaps there is an easier way to do this that I'm not thinking of?

(What I'm trying to accomplish with this currently is just an invisible enemy without it actually being fully transparent, hoping that it will make the selection flash show up but not the enemy by using addition instead of transparency)

(I can't use a cut out of the actual background image because I have animated backgrounds)
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
36,236
Reaction score
9,681
First Language
German
Primarily Uses
RMMV
I don't know if regular sprites even have a blend mode, but you might achieve something similar by playing an animation with that blend mode on an invisible sprite.
basically transform the sprite into an animation sheet, turn the real battler invisible and have an animation run on the battler even while it is invisibel.
 

jjbob1234

Villager
Member
Joined
Mar 17, 2014
Messages
13
Reaction score
8
Primarily Uses
I don't know if regular sprites even have a blend mode, but you might achieve something similar by playing an animation with that blend mode on an invisible sprite.
basically transform the sprite into an animation sheet, turn the real battler invisible and have an animation run on the battler even while it is invisibel.
I just tried using an animation, the animation doesn't get selected by the cursor, only the enemy sprite does.

A little more information, I'm doing a battle with the background, and I wanted to make the background flash and stuff like a battler.
To do that I wanted to make a sprite that was addition blended so it wouldn't obstruct the background, and still get all the selection flashes damage flashes and stuff.

Edit: Normal enemy sprites do have a blend mode you can see this by killing an enemy and with-in the code of the enemy collapse
Sprite_Enemy.prototype.updateCollapse = function() { this.blendMode = Graphics.BLEND_ADD; this.setBlendColor([255, 128, 128, 128]); this.opacity *= this._effectDuration / (this._effectDuration + 1); };

Edit2: The above code is sort of what I'm trying to access through script call, I just don't know how to access it through the console or script call to test it or how to refer to the specific Sprite_Enemy that is on the screen currently.

$gameTroop.members[1].Sprite_Enemy.prototype.blendMode = Graphics.BLEND_ADD; would make since to me but it doesn't work.
 
Last edited:

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
1,173
Reaction score
723
First Language
Javascript
Primarily Uses
RMMZ
I'm trying to do some fancy stuff with enemy sprites but I'm not sure where to start, I've been digging through the coding to try and find the hierarchy to affect certain aspects, but it's a little confusing finding which script call will actually affect the sprites not the object.

Basically the main thing I'm trying to do now is to change the blendMode on one enemy sprite from 0 to 1 using a script call.
I'm thinking that if I were able to do this it would cause the enemy sprite to be in an addition blend mode? perhaps there is an easier way to do this that I'm not thinking of?

(What I'm trying to accomplish with this currently is just an invisible enemy without it actually being fully transparent, hoping that it will make the selection flash show up but not the enemy by using addition instead of transparency)

(I can't use a cut out of the actual background image because I have animated backgrounds)

I'll admit I'm still a bit confused to exactly what you are aiming for but umm...
Trying to do something like this then?
1652734769555.png

You can achieve such things and much more by using:

The above was achieved with the following setup:
1652734898530.png
 

coyotecraft

Mythographer
Veteran
Joined
Mar 13, 2012
Messages
300
Reaction score
172
First Language
English
Primarily Uses
N/A
I just checked
They do have blending modes.
BattleManager._spriteset.children[0].children[4].children[0]._blendMode = 3

The last [0] corresponds to the Enemy Troop Index
However, I think we'd have to modify the Sprite_Battler.prototype.updateSelectionEffect and maybe a few other effects so that it's not overwriting, returned to normal, whenever the sprite Blinks from the cursor selection. And also maybe consider the collapse effects.

7lOhBIP.png


Is editing the enemy battler graphic to be transparent an option?
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
1,173
Reaction score
723
First Language
Javascript
Primarily Uses
RMMZ
I'll admit I'm still a bit confused to exactly what you are aiming for but umm...
Trying to do something like this then?

You can achieve such things and much more by using:

The above was achieved with the following setup:
Furthering up on what I mentioned.. that will do what you need but then more is needed because when the enemy is attacked it goes through different graphic changes and then reverts to normal.. so to counter that... use the following setup...

This will work exactly as you need...

Use this:

Like this:
1652735667954.png
1652736545805.png
1652735705192.png
Doing that results in this:
Of course you can adjust all that however you want to achieve the exact result you're looking for ;)
 
Last edited:

jjbob1234

Villager
Member
Joined
Mar 17, 2014
Messages
13
Reaction score
8
Primarily Uses
I'll admit I'm still a bit confused to exactly what you are aiming for but umm...
Trying to do something like this then?

You can achieve such things and much more by using:

The above was achieved with the following setup:
I'm just trying to make "nothing" flash from battle damage selection cursor and stuff.
This plugin might come in handy for a few things but it's hard to tell from your picture if the enemy is flashing or not.

I pretty much just want the whole screen to flash when a certain enemy is selected.
I just checked
They do have blending modes.
BattleManager._spriteset.children[0].children[4].children[0]._blendMode = 3

The last [0] corresponds to the Enemy Troop Index
However, I think we'd have to modify the Sprite_Battler.prototype.updateSelectionEffect and maybe a few other effects so that it's not overwriting, returned to normal, whenever the sprite Blinks from the cursor selection. And also maybe consider the collapse effects.

7lOhBIP.png


Is editing the enemy battler graphic to be transparent an option?
This is promising, but when I put that string of code into the debug console all I get is:
Uncaught TypeError: Cannot read property 'children' of undefined
at <anonymous>:1:50

For further explanation, I'm having a battle with the environment, Here's a picture maybe that'll be easier to understand, I just want the whole screen to act as the enemy with all the little color animations and stuff.

1652736070658.png

I can achieve something similar by using a transparent sprite but it effects the transparency of the flashes so it has to be only slightly transparent which makes the screen darker, and this whole image in the background slowly scrolls and loops and morphs so I can't just use a screenshot either without ruining the feel of the graphics for the fight.

Here's a small chunk of the animation Incase you're curious:
TheUniverse.gif
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
1,173
Reaction score
723
First Language
Javascript
Primarily Uses
RMMZ
I'm just trying to make "nothing" flash from battle damage selection cursor and stuff.
This plugin might come in handy for a few things but it's hard to tell from your picture if the enemy is flashing or not.

I pretty much just want the whole screen to flash when a certain enemy is selected.

This is promising, but when I put that string of code into the debug console all I get is:
Uncaught TypeError: Cannot read property 'children' of undefined
at <anonymous>:1:50

For further explanation, I'm having a battle with the environment, Here's a picture maybe that'll be easier to understand, I just want the whole screen to act as the enemy with all the little color animations and stuff.

View attachment 226403

I can achieve something similar by using a transparent sprite but it effects the transparency of the flashes so it has to be only slightly transparent which makes the screen darker, and this whole image in the background slowly scrolls and loops and morphs so I can't just use a screenshot either without ruining the feel of the graphics for the fight.

Here's a small chunk of the animation Incase you're curious:
View attachment 226405

...not sure if you seen my post above this one: click here to view

Furthering up on what I mentioned.. that will do what you need but then more is needed because when the enemy is attacked it goes through different graphic changes and then reverts to normal.. so to counter that... use the following setup...

This will work exactly as you need...

Use this:

Like this:
Doing that results in this:
Of course you can adjust all that however you want to achieve the exact result you're looking for ;)

That covers everything ;)
You can also just change the opacity also to 0 if you want instead of 10... or really adjust this anyway you'd like :)

Edit:
Ohhhh you want the flashing... I get it now... sorry I thought you wanted the exact opposite lol
hmm...
Still I'm sure what I posted could be utilized in someway to achieve that..
Hmm.. I'll go check into that now
 
Last edited:

jjbob1234

Villager
Member
Joined
Mar 17, 2014
Messages
13
Reaction score
8
Primarily Uses
...not sure if you seen my post above this one: click here to view




That covers everything ;)
You can also just change the opacity also to 0 if you want instead of 10... or really adjust this anyway you'd like :)
I didn't realize you had made the opacity 10, that might actually do what I want if I do blendmode + 255 opacity, thanks I'll try that.

(I'm not trying to make the opacity lower I'm just trying to make the background stay visible without muddying it up from traditional transparency)

Let me try that real quick. :kaoluv:
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
1,173
Reaction score
723
First Language
Javascript
Primarily Uses
RMMZ
I didn't realize you had made the opacity 10, that might actually do what I want if I do blendmode + 255 opacity, thanks I'll try that.

(I'm not trying to make the opacity lower I'm just trying to make the background stay visible without muddying it up from traditional transparency)

Let me try that real quick. :kaoluv:
Sooo you want it like this correct?

I achieved that with the following:
1652738317228.png
I gave the enemy a notetag
Code:
<background:true>

This is the picture I used for the enemy:
BG.png

Then this is the plugin setup:
Class: Sprite_Enemy
Property of Function: prototype
Function: initVisibility
Post Script:
JavaScript:
if ($dataEnemies[this._battler._enemyId].meta.background){
  this.blendMode = 1;
};

Class: Sprite_Enemy
Property of Function: prototype
Function: revertToNormal
Post Script:
JavaScript:
if ($dataEnemies[this._battler._enemyId].meta.background){
  this._shake = 0;
}else{
  var f = $_$[v.Class+'.'+v['Property']+'.'+v.Function];
  f.apply(this, arguments)
};
Overwrite: true

Edit:
LMAO after all the testing with the plugin I turned it off and just used the slightly transparent image I posted above and works the exact same way.. so apparently all that was needed is the image I made with the background size that is posted above
..using the image for the enemy that I posted above with no plugins or script looks like this:
 
Last edited:

jjbob1234

Villager
Member
Joined
Mar 17, 2014
Messages
13
Reaction score
8
Primarily Uses
Sooo you want it like this correct?


I achieved that with the following:
View attachment 226410
I gave the enemy a notetag
Code:
<background:true>

This is the picture I used for the enemy:

Then this is the plugin setup:
Class: Sprite_Enemy
Property of Function: prototype
Function: initVisibility
Post Script:
JavaScript:
if ($dataEnemies[this._battler._enemyId].meta.backround){
  this.blendMode = 1;
};

Class: Sprite_Enemy
Property of Function: prototype
Function: revertToNormal
Post Script:
JavaScript:
if ($dataEnemies[this._battler._enemyId].meta.backround){
  this._shake = 0;
}else{
  var f = $_$[v.Class+'.'+v['Property']+'.'+v.Function];
  f.apply(this, arguments)
};
Overwrite: true
It doesn't seem to be actually doing anything with the blendMode on the sprite, Wouldn't a fully opaque black image + what ever is behind it with addition blending applied be invisible until the color of the image is changed?

I noticed you used a semi-transparent image but wouldn't it look the same without the coding?

(I did try it but it looks the same as it did before)
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
1,173
Reaction score
723
First Language
Javascript
Primarily Uses
RMMZ
It doesn't seem to be actually doing anything with the blendMode on the sprite, Wouldn't a fully opaque black image + what ever is behind it with addition blending applied be invisible until the color of the image is changed?

I noticed you used a semi-transparent image but wouldn't it look the same without the coding?

(I did try it but it looks the same as it did before)
Okay finally got it all working nicely.
1652741121982.png
Class: Sprite_Enemy
Property of Function: prototype
Function: initVisibility
Post Script:
JavaScript:
if ($dataEnemies[this._battler._enemyId].meta.background){
  this.blendMode = Graphics.BLEND_ADD;
};
1652741188053.png
Class: Sprite_Enemy
Property of Function: prototype
Function: revertToNormal
Post Script:
JavaScript:
if ($dataEnemies[this._battler._enemyId].meta.background){
  this._shake = 0;
  this.blendMode=Graphics.BLEND_ADD;
}else{
  var f = $_$[v.Class+'.'+v['Property']+'.'+v.Function];
  f.apply(this, arguments)
};
Overwrite: true
Image used:
BG.png

I also had a typo in the previously shown example. I had put "backround" instead of "background in the plugin script that was checking for the notetag *woops*

..but now all is 100% working as it should now :cutesmile::thumbsup-right:
 
Last edited:

jjbob1234

Villager
Member
Joined
Mar 17, 2014
Messages
13
Reaction score
8
Primarily Uses
Okay finally got it all working nicely.
View attachment 226418
Class: Sprite_Enemy
Property of Function: prototype
Function: initVisibility
Post Script:
JavaScript:
if ($dataEnemies[this._battler._enemyId].meta.background){
  this.blendMode = Graphics.BLEND_ADD;
};
View attachment 226419
Class: Sprite_Enemy
Property of Function: prototype
Function: revertToNormal
Post Script:
JavaScript:
if ($dataEnemies[this._battler._enemyId].meta.background){
  this._shake = 0;
  this.blendMode=Graphics.BLEND_ADD;
}else{
  var f = $_$[v.Class+'.'+v['Property']+'.'+v.Function];
  f.apply(this, arguments)
};
Overwrite: true
Image used:

I also had a typo in the previously shown example. I had put "backround" instead of "background in the plugin script that was checking for the notetag *woops*

..but now all is 100% working as it should now :cutesmile::thumbsup-right:
Works perfectly!
I'm using a gradient, now it only shows up when the enemy is being selected! :)
1652743311230.png
Thanks so much for your help :)

Also what are you using to record? I'm in need of something to record beta footage besides what I've been using which just records gifs.
 

coyotecraft

Mythographer
Veteran
Joined
Mar 13, 2012
Messages
300
Reaction score
172
First Language
English
Primarily Uses
N/A
I'll just throw this out there as an alternative idea.

If we modify the SelectionEffect in rpg_sprites.js I think we can just make a special condition for this battler id
Normally the select effect just alternates between 2 blendColor setting.
But you could add an extra condition
If (target._enemyId == *whatever*){ *do something Extra* };

I believe you can change the enemy battler entirely to an opaque square. Alternate it's .alpha between 0 and 1 to make it disappear reappear. Or...well, a lot of things.

MV and MZ have a small bug where they don't like to start a battle with an Enemy using No Battler, although, past the battle startup, you can transform an enemy into one with no battler .
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
1,173
Reaction score
723
First Language
Javascript
Primarily Uses
RMMZ
Works perfectly!
I'm using a gradient, now it only shows up when the enemy is being selected! :)
View attachment 226422
Thanks so much for your help :)

Also what are you using to record? I'm in need of something to record beta footage besides what I've been using which just records gifs.
YAY! That's awesome!
Very much welcome. Super glad I could help out. :cutesmile:

I use SnagIt to record :)
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
9,694
Reaction score
6,161
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

ScreenShot_6_24_2022_9_20_7.png
Here's Mike when you get a preemptive strike in battle. There's another one for when an enemy sneaks up on you too.
Suddenly, games mean nothing. The money spent was worth it to bring souls towards the light of life. May God bless my path forever. I pray that all are shaken for truth and poured out flat on the table of true understanding, knowledge, and wisdom. Bless you.
Finally I bought OMORI...cant wait to get traumatised!!!
Finished making this pretty ambitious forest map. Was wondering what y'all think of it! :kaopride:
1656136876015.png
All this anger everywhere,Who's happy but me?
Seems to be all the people that don't follow Jesus wholeheartedly. My smile might burn you ahhhhhhhhhhh!

Forum statistics

Threads
123,022
Messages
1,153,449
Members
161,365
Latest member
sieuthitien
Top