Display an image when a critical hit happens?

yorshee

Villager
Member
Joined
Apr 1, 2014
Messages
5
Reaction score
0
First Language
English
Primarily Uses
I'll just like to let you all know before I write this post that I know next to nothing about programming - I'm building my first game just to teach myself.

I'm trying to get an image to pop up for half a second when either an enemy or a playable character lands a critical hit. I'm trying to do this by making the image appear and then disappear as a common event using this code:

@>Show Picture: 1, 'image', Center (0,0), (100%,100%), 255, Normal@>Wait: 30 frame(s)@>Erase Picture: 1 ..and then I'm trying to call the common event with this code in Window_BattleLog (specifically, the part bolded)

#-------------------------------------------------------------------------- # * Display Critical Hit #-------------------------------------------------------------------------- def display_critical(target, item) if target.result.critical $game_temp.common_event_id = 1 text = target.actor? ? Vocab::CriticalToActor : Vocab::CriticalToEnemy add_text(text) wait end end'1' is what I named my common event, is that the same thing as the event ID? Is this even the problem? Sorry if this is a noobish question, as I said, I'm not very experienced with this :(
 

Ruiran

Veteran
Veteran
Joined
Nov 4, 2013
Messages
78
Reaction score
30
First Language
English
Primarily Uses
I'm terrible at scripting, but wouldn't using a Bitmap work easier ?
 
Last edited by a moderator:

yorshee

Villager
Member
Joined
Apr 1, 2014
Messages
5
Reaction score
0
First Language
English
Primarily Uses
I haven't tried tinkering around with bitmaps yet, I'll try that if no other solutions are suggested soon.
 

Evgenij

Veteran
Veteran
Joined
Aug 28, 2013
Messages
349
Reaction score
100
First Language
German
Primarily Uses
N/A
Try this:

Code:
$game_temp.reserve_common_event(id)
 
Last edited by a moderator:

yorshee

Villager
Member
Joined
Apr 1, 2014
Messages
5
Reaction score
0
First Language
English
Primarily Uses
Try this:

$game_temp.reserve_common_event(id)
It works! Thank you! :D

However, it doesn't work if I name the event something different - to anything other than '1'. This happens:

Script 'Window_BattleLog' line 282: NameError occurred.undefined local variable or method '(event name)' for #<Window_BattleLog:0x8969314>Am I confusing the event name with the event ID or something? :S

Also, how do I make the image appear before any of the text does? Like, the first thing that will alert you that you got a critical hit will be the image appearing, and then the accompanying text.
 
Last edited by a moderator:

Evgenij

Veteran
Veteran
Joined
Aug 28, 2013
Messages
349
Reaction score
100
First Language
German
Primarily Uses
N/A
If you want it to be displayed before the text, you will need some more scripting.

I can write you a script, that lets you display an image on an critical hit, if you want.

And for: 

$game_temp.reserve_common_event(id)You can use only Numbers for "id" which correspond to the Common Event ID you want to call.
 

yorshee

Villager
Member
Joined
Apr 1, 2014
Messages
5
Reaction score
0
First Language
English
Primarily Uses
If you want it to be displayed before the text, you will need some more scripting.

I can write you a script, that lets you display an image on an critical hit, if you want.

And for: 

$game_temp.reserve_common_event(id)You can use only Numbers for "id" which correspond to the Common Event ID you want to call.
That would be awesome! :D Thank you so much!

Ideally, I would like the image to appear alongside the text, but if it appears before it then that's okay too.

Yeah, I figured out the ID thing. :p
 

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

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,070
Members
137,577
Latest member
SadaSoda
Top