Ledorax, on Nov 26 2005, 02:46 PM, said:
Hi everybody,
I'm making a "fire elemental" enemy and, naturally, it's on fire. So, I want the player to be damaged (with a small fire effect too, if that's possible) whenever they hit it. I really can't figure out a way to do this, can you?
Thanks.
View Post
Hello,
Easy way:
You could try adding a cast spell event to the player contact event screen on the NPC. The spell would be casted by the player upon himself with the damage effect and fire burn animation. You may want to add a conditional for if the hero has a ranged weapon, then the spell will not be casted.
disadvantage: I believe that the player will play the casting animation every time he is hit by the spell (you could turn this into a sort of harmed animation is the player has no spells).
Advantage: you can make your own special player animation of being harmed by the fire damage if you choose
Slightly harder way:
create two global variables: let's call them gb_pixel_x, and gb_pixel_y
You will need to find the ratio of pixels to movement tiles in your game. Let's say that the ratio is 30.
create this event string within the Fire NPC's player contact event screen:
1. set global gb_pixel_x to player_x
2. set global gb_pixel_y to player_y
3. set global gb_pixel_x to multiply by 30
4. set global gb_pixel_y to multiply by 30
5. create stamp "(insert fire damage animation)" at "(gb_pixel_x,gb_pixel_y)"
6. set attribute health to subtract (whatever fire damage you want)
7. Play sound "(either player hurt, fire damage or both)
your done!
disadvantage: it will take you longer to make than the previous one.
Advantage: you don't need to worry about the player cast animation if you already have one in place.
Finding the movement tile to pixel ratio (don't worry it's not that hard :))
1. open any one of your maps
2. select change map dimensions
3. whatever number it has in both the movement tile x and y in pixels is the ratio you are looking for.
4. there is no step 4!
This post has been edited by GrahamVH : 26 November 2005 - 11:31 AM