ACTing, attacks.



ACTing

This will teach you to set what ACTing does!

First, go to g.undertale.print script. Then, look for this script:

Here are things we want to modify.
First of all, don't touch first thing there, it's CHECK option (unless you want to modify it too?).
Look at second one, if g.random=actsel_2 (g.random variable is used for many things, I used it to avoid creating too many variables. You'll be seeing it a lot).
Anyway, here is what it does:

clear - clears previously printed text.
Print text.act1 with... - prints text we set earlier.
wait until key [z] pressed - waits until [Z] is pressed.
set g.mon_spareable to 1 - makes monster possible to spare. Remove it and it won't do that.
broadcast g.ev.monturn - tells sprite g_monster that it's his turn. You can replace it with, for example, g.inp.ret2men and it will go back to the menu instead!

Or, if you add block to change text.encounter here different text will show in the menu!
Or, change text.mon_text_bubble to make monster say different things!
Bassicaly, there is no limitation for things you can put there. If you want to see more complicated ACT, chech out my Napstablook battle..

Attacks

Go to g.monster sprite. Look at this script:

I wrote what it does, it's very simple. However, I should explain some things:

-g.f_state is set to monattacks, because clones of g_attack will delete themselves if it's not. g_menu sprite sets it to men when g.inp_ret2men is broadcasted.
-broadcast g.att_xyz makes attack script start. Then, it waits some time until attack ends by using the wait X secs block.
-g.att var is set to end to remove previous changes g_attack script made to it, and to delete the clones,
-glide block is here to move the monster up so it isn't covered by g_arena sprite when it shows.
-as you probably noticed by now, g.inpt_ret2men makes the game go to the menu.


Well, now that we know how g.ev.monturn works we can make our attack! :)
First, let's create our broadcast that will tell g.attack sprite to start attacking. Let's call it g.att_myattack.
Now, for attacks testing I'd suggest calling attack that does nothing by g.ev.monturn. It's called g.att_nothing. End of g.ev.monturn should look like this now:

Now, start project and attack monster/ACT to make it do its turn. Then, It'll look like this:

Now, go to g_attack sprite. Now, add costume that will be your attack. It should be white if you want it to work like normal, but you can set it to green, orange or lightblue for different effects.

I marked colors you can use with, small, black... "frendliness squares".
Anyway, after you made the costume, make the actual attack! Since game is now in monattacks state, you can click your attack script to run it and test it. Here is an example:

This will make your attack go to right side of the screen, and go to left side while spinning. Simple enough.
Now, make arena appear when your attack begins. Go to g_arena sprite and make it show when it receives g.att_myattack. Also, make it broadcast g.soul.gotocenter.
Last thing is making monster use this attack.

Don't forget to make attack end. By the way, you can change some other stuff, like text.mon_text_bubble so monster says other thing next turn.

But. You probably want to make attacks that spawn clones, rigghht?
I's simple actually. What you have to do is, set g.att_var to some value, make g_attack sprite clone itself, and in other script, make it do something when it starts as clone and g.random2 equals value you set.
Here is an example:



Well. Those are all features you need to know to create amazing battles!
Still, there are some things I still haven't told you about, like how to make intro to a battle (like the one that Asgore has).
Tommorow I'll make full tutorial with process of creating a battle.
And eventually, a tutorial for my FULL engine, not just battle engine.




Free Web Hosting