Need help with a pretty complicated boss fight (Solved!)

So, Here's the thing. I want to make a boss fight That's in real time. He has 3 actions.
1st one : Teleports at the player and slashes
2nd one : Teleports 5 cases up away from the player, and shoots something that goes down and damages the player if hit.
3rd one : Teleports in the middle top of the map, and does a massive beam that insta kills.

I know how to make the damage, etc. I also know about the Map X and Map Y variables, but i am still having a lot of trouble with the 1st and 2nd one.

In my version, there is 2 common events for the slash. The monster who will perform the animation, and the slash which is an animation for like the "swing" effect. I want the monster to be 1 case up from where the player WAS at the moment of him teleporting, and the slash to be where the player WAS also. I do not know if this is possible, but if it is, Please send help =( (PS: In most of my tries, the slash was actually following the player, and i didn't really want that. Also, i noticed that the character does not get damaged if he doesn't move (but if he moves, he does.).

Also, i made 3 random variables for which attack the monster will choose. But as of right now, i only have trouble with the 1st attack.
Thank you and excuse me for my not-so-good english ^^
To not have the slash following the player, place an invisible event in front of the boss when it teleports, and execute the slash on it, instead of on the player.

For action 2, move boss by player x-5, y or player x, y-5.
What do you mean when you say "the slash was actually following the player"? Could you elaborate this a bit more?
Problem is : I want the boss to teleport one block on top where the player is, and the slash where the player is so it looks like he's attacking him. This means it could be anywhere on the map depending on the players' Map X and Map Y's coordinates.
Heirukichi : Basically, i tried to keep updating the players' Map X's and Map Y's, But the slash kept following the players movement starting to where the slash teleported, making it impossible to actually dodge it.

Also, thanks for telling me how to do action 2. Appreciate it.

EDIT : this is why i can't really make the invisible event in front of the boss, i think?
Also, i'm going to add a picture.
unknown.png

PS: In this frame, the slash actually passed the player but i swear it hits him! 😀

EDIT 2 : To get the boss to teleport at players' y-5,x, what do i have to do exactly? i'm scared to screw up pretty bad, but i think i'm supposed to substract 5 from the players Y, and then teleport the boss?
You don't have to keep udating player X and Y when your slash starts. Set two variables equal to player X and Y respectively and use those variables instead of player X and Y in your slash. Only update them when the boss teleports in front of the player. If you keep updating coordinates used for the slash animation of course it follows the player.

If you need player x and y to check if the slash hits then just use two different variables to store X and Y when the slash animation starts.
EDIT 2 : To get the boss to teleport at players' y-5,x, what do i have to do exactly? i'm scared to screw up pretty bad, but i think i'm supposed to substract 5 from the players Y, and then teleport the boss?
Okay, I worded that pretty badly yesterday, lol. Basically, when the boss decides to teleport, it records the player's x & y into variables. Then, take 5 times the size of a tile (48 by default) into another variable, and subtract it from the player y variable, so it will teleport 5 tiles above the player.
Okay, I worded that pretty badly yesterday, lol. Basically, when the boss decides to teleport, it records the player's x & y into variables. Then, take 5 times the size of a tile (48 by default) into another variable, and subtract it from the player y variable, so it will teleport 5 tiles above the player.

Really, Really sorry for that, but :
So, from what i understand, i take the players' x & y into variables, and to make the boss teleport for the gun attack, i make another variable 5 times the size of the tile which is 48, then i substract the thing i get from multiplying the size of the tile (5*48 i assume) and substract it to the players Y variable, And then make the projectile come out from the boss (spawn using a switch) and it'll go down until it eventually hits a wall, does a "splash" animation and disappears. Correct me if i'm wrong ^^'


Heirukichi : How to i stop updating X & Y ? Where do i put the thing that makes it update exactly? This is pretty confusing for me.
As of right now, i have a Parallel process running which constantly updates the players X and Y's. I removed it, and tried to put it when the attack starts. However, it still follows the player. I have no idea how to make it stop updating it.

I guess it's my fault for wanting to make something that big, haha.
Then, take 5 times the size of a tile (48 by default) into another variable
This is a VX Ace thread so tiles are 32x32 and not 48x48 as in MV. However if you are moving within the grid tiles size should already be taken into account. Moving the event at ($game_player.x, $game_player.y - 5) means teleporting 5 tiles above the player as x (respectively y) is different from real_x (respectively real_y), which is the sprite position in pixels.
How to i stop updating X & Y ?
I am afraid you have to provide a few screenshots or pseudo-code summaries of your events. How can I know how to stop updating them without taking a look at your events? Knowing how to achieve this is within the scope of my abilities, reading people minds is still out of my reach. XD
Ahaha, Sorry! All of that Map X and Map Y stuff is still new to me.
At the moment, i decided that my events were messy as hell, so i deleted them all. I would love it if you could give me a proper way to update then stop updating.
However, if you still need the screenshots and i have to recreate them, it would look a little bit like that :
Picking the attack (randomised) :
unknown.png


The slash animation/attack :
upload_2019-3-9_14-23-50.png


common event : (it's just the animation tbh, i don't want the boss to actually DAMAGE the player, but rather have the slash damage him.)
upload_2019-3-9_14-24-39.png


Hope it helps.
Also thanks for the answers!

EDIT : Also, i'm not sure about the teleporting. I tried to playtest it, but the monster didn't teleport (but the slash did!). And yes, it was following him. (may have done something wrong in the animations though since it was kinda clunky, but i can figure this out by myself.)
Ok, first of all it is a good practice to put everything in a single event and use that event to update graphics for other events. In the end it is pointless to continue running your parallel process event while the slash animation is being displayed. The boss cannot perform a different attack in the mean time, can it?

That said in your event you are rolling variable 24 (the one used to determine random attacks) twice and I am quite sure the last one is useless. If the first screenshot is a parallel process event it starts from the very beginning as soon as the last command is completed. No need to roll that number again. And on top of it you are moving your event to $game_player.y - 32...that is basically the same as moving at the top of the map unless your map is bigger than 32 tiles. As stated in my previous post map coordinates are NOT pixel coordinates. So $game_player.y - 1 already means 32 pixels above the player.

In your second event you changed position for the slash event while you are supposed to change position of both boss and slash. I am going to show you how I would do this. I am going to use a few script calls instead of event commands. Those are things you can do with event commands but if I start posting pseudo-code with event commands it takes many more lines.
Spoiler: How I would do it
Here is how I would set up my parallel process event to roll random attacks (I am omitting the part where you roll the random number and all three conditional branches):
Code:
wait(10)
$game_variables[26] = $game_player.x
$game_variables[23] = $game_player.y - 1
slash = $game_map.events[slash_event_id_goes_here]
$game_map.events[boss_event_id_goes_here].moveto($game_variables[26], $game_variables[23])
slash.moveto($game_variables[26], $game_variables[27])
# I do not know what is stored in variable 27 though
$game_switches[31] = true
# changing the switch here does not require you to change event graphics in the slash event
# your event has an animation together with damage so the player cannot really avoid it
# add a proximity check to see if the player is still close enough.
3.times do
  wait(2)
  slash.direction += 2
  # proximity check goes here (possibly trigger a switch)
end
Here you can check for the switch you changed in the proximity check to see if the player was hit. If the switch is on subtract as much hp as you want then move your slash backward (as in your event) and add a "wait(20)". That's it. Unfortunately I cannot help you more than this because I do not know how you organized your sprites so I cannot really say if there is a better way to change your graphics. It would be ideal to include your other animation here as well. This way you can only use a single event.
Spoiler: How to perform a proximity check
To perform a proximity check you have to see how much distance there is between two characters (events are characters and $game_player is also a character).
Code:
variable_id = pick_an_id_for_a_variable_to_store_distance
c1_id = put_your_first_character_id_here # either event id or 0 for player
c2_id = put_your_second_character_id_here #either event id or 0 for player
c1 = (c1_id == 0 ? $game_player : $game_map.events[c1_id])
c2 = (c2_id == 0 ? $game_player : $game_map.events[c2_id])
$game_variables[variable_id] = (c1.x - c2.x).abs + (c1.y - c2.y).abs
This applies to everything as long as you insert the right IDs. After the check just compare the variable you picked to the maximum proximity you need and if its value is less than that number those two characters are close enough to trigger the proximity effect.
Whoa ! Thanks for the answer !
Just a thing, in the first one, i actually forgot to teleport the boss in the recreation, oops ^^'
In variable 27, the players' Map Y is stored without the -1. Messy as hell, i know.
I was wondering, Would it help if i posted the whole project in here?
EDIT: without the RTPs as i am assuming you already have them ^^
As long as it is limited to just one or two events having the whole project here would not be that useful. What would be extremely useful is to see your sprites (provided that you can show them), knowing the events involved in the process and how the attack animation should be performed. Those informations are enough to figure out the whole thing. Of course if you find it difficult to explain feel free to upload your project but honestly the less I have to download, the happier I am.

Back to the topic. To teleport your boss event somewhere you can just add this:
Code:
$game_map.events[boss_event_id].moveto($game_variables[variable_storing_player_x], $game_variables[variable_storing_player_y_minus_1])
where the teleport is supposed to happen.
Don't worry. It's only 7MB ^^
Really, REALLY Sorry if i'm such a pain. I just really want to get this game out. (also, it's a demonophobia parody, so yep.)
Also, this is the compressed file, proof :
upload_2019-3-9_19-33-49.png

Would be really nice if you helped me out in there.
http://ge.tt/3xlcJuu2
Somehow I cannot download the file from my browser. Is it not easier to give me those IDs and upload a single (or two) images?
Oof, sure.
Part 1 of slash :

Scavor_Slash1.png

And then, i switch to the 2nd part. this is where the player actually gets hurt. (the 1st one was a "warning"). Or atleast, that's what i want it to be.
Scavor_Slash2.png

EDIT : Also, the "slash" itself looks like that : (1st frame is him teleporting. It plays for one or two frames before he teleports so theres a somewhat cool effect. He does the Slash 1 animation when he finally teleported to his destnation.)
Scavor_Teleportslash.png
Good, now that I saw those sprites I understand how your animation works. I am going to write something so that your boss event will be event 1 in the map while the slash animation will be event 2 (just do not forget to set your slash animation event to be "Above Characters" so that you can actually place it on the player sprite. The parallel process event here will be the boss event itself. This one only deals damage if the player is IN FRONT of the boss event.
Spoiler: What to put in your conditional branch after rolling the random attack
Code:
newx = $game_player.x
newy = $game_player.y
boss = $game_map.events[1]
slash = $game_map.events[2]
3.times { boss.direction += 2; wait(2) }
$game_switches[31] # I am using the same you used
boss.moveto(newx, newy - 1)
wait(2)
slash.transparent = true
slash.moveto(newx, newy)
slash.direction -= 2
slash.transparent = false
boss.direction += 2
2.times do { wait(2); slash.direction -= 2; boss.direction += 2 }
if (($game_player.x == slash.x) && ($game_player.y == slash.y))
  $game_party.members.each { |m| m.change_hp(-60, true) }
end
Oh! Thank you!, However, this is probably the last question(s) i have before i'm actually done with this:
1-Do i remove these?
unknown.png


2-Do i add/remove anything from the slash event?

3-Do i only put the script in the conditional branch after rolling the random attack or do i add variable operations,common events, etc

4-As i'm not really familiar with all these "advanced" rpg maker making, I don't really know if i'm supposed to use the script command, and then cut it and add another script like this (cause there's not enough place) :
upload_2019-3-10_8-32-44.png

Because if it IS like that, I get an error when i try to boot it up. Checking the error and the script panel, i'm pretty sure that the error is in the script i wrote in there. So i assume (x2) That i did it wrong (im not questioning stuff that i don't know hah)

5-(last one) : Do i rename my slash/boss event?

Thank you for your time.
  1. Yes, the script itself covers pretty much everything so you can simply delete what you had in there.

  2. The slash event can simply be blank at this point, the boss event is what moves everything. just leave a second page for the slash event that triggers when switch 31 is on and does nothing.

  3. If you put the code there that should sufficie. However, as I said in one of my previous posts you can do that with just event commands so it is up to you to decide if you want to use the script call itself or if you want to use event commands in your conditional branch. Whichever you chose you have to put it in the conditional branch after rolling your attack.

  4. The fact that it does not fit is definitely causing problems. Splitting a script call in two different parts is possible but it depends on how the script call is written. Basically since I created a variable called "slash" and one called "boss" in the script call those two are lost when the script call where I created them ends. When you try to access those from the second part of the script it does not find them. Another thing causing an error is the comment being divided in two lines. The line with "used" is something the engine does not recognize as a method.

  5. This is not necessary. The way I called it in the script call is just a variable named that way. Since that variable is a reference to your event and events can be obtained from their ID renaming them is just a way to make it easier for you to remember what each event is meant to do.
Try this one and see if it fits. Unfortunately I am from mobile right now so I have no way to access the engine and test it myself.

Spoiler: First script call
Code:
p=$game_player; nx=p.x; ny=p.y
boss = $game_map.events[1]
s = $game_map.events[2]
3.times { boss.set_direction(boss.direction + 2); wait(2) }
$game_switches[31] = true
boss.moveto(nx, ny - 1); wait(2)
s.transparent = true; s.moveto(nx, ny)
s.set_direction(s.direction - 2); s.transparent = false
boss.set_direction(boss.direction + 2)
Spoiler: Second script call
Code:
boss = $game_map.events[1]
s = $game_map.events[2]
p = $game_player
2.times do
  wait(2); boss.set_direction(boss.direction + 2)
  s.set_direction(s.direction - 2)
end
if ((p.x == s.x) && (p.y == s.y))
  $game_party.members.each do |m|
    m.change_hp(-60, true)
end; end

If these two fit the box you should get no error. And of course be sure that no line is longer than what fits in a single line.

Just keep in mind that i did not turn the switch off on purpose. If you turn it off the slash event will once again be a blank event with no graphics at all. For that reason you should decide when to turn that switch off and properly time that action.

Just add a wait event command at the end of the script call and turn the switch off after that.

Spoiler: EDIT: single script call if you are using big enough box
Code:
p=$game_player; nx=p.x; ny=p.y
boss = $game_map.events[1]
s = $game_map.events[2]
3.times { boss.set_direction(boss.direction + 2); wait(2) }
$game_switches[31] = true
boss.moveto(nx, ny - 1); wait(2)
s.transparent = true
s.moveto(nx, ny)
s.set_direction(s.direction - 2)
s.transparent = false
boss.set_direction(boss.direction + 2)
2.times do
  wait(2); boss.set_direction(boss.direction + 2)
  s.set_direction(s.direction - 2)
end
if ((p.x == s.x) && (p.y == s.y))
  $game_party.members.each { |m| m.change_hp(-60, true) }
end
Heyo. First one fits in fine, however, the 2nd one requires one more line ( 🙁 ), i tried putting only one "end" to no avail. Still error.
unknown.png
Just put a semicolon and another end after the last one. The last line should look like this:
Code:
end; end

Original thread: https://forums.rpgmakerweb.com/threads/need-help-with-a-pretty-complicated-boss-fight-solved.106584/