Help with Float/Flight Mode and Moves Draining MP?

Psykai

Well-known member
Hello ^_^ I hope I'm posting this in the right place. I've recently dove into trying to learn this engine and currently working on one of my characters. I've been trying to get her to float/levitate when pressing Jump in the air using the tutorial found here: http://www.chronocrash.com/forum/index.php?topic=1189.0

I had some trouble getting it working though. I copied across the scripts and keyscripts to the appropriate places and made sure her character file loads them and also copied the follow1 animation setup across (simply changing the frame paths to her floating sprites) so that I could make sure it worked before tweaking any of the numbers, but in-game she would simply freeze in the air for a second and drop down. For some reason changing her Jump Type to 7 7 (like Iron Man in the preview) instead of the 3 3 I had her at worked and allowed her to float briefly and be controllable but she still dropped down after only a second or so (without me pressing Jump). I noticed Iron Man's Jump animation was really long compared to hers and I'm not sure why I thought it might be related but I extended hers to be roughtly the same length and that allowed her to float properly (only cancelling if I hit Jump again). In other words, most of my achievements with her so far have been total accidents ^_^"

EDIT: Forgot I'd also changed the @cmd floater 48 to 120 to make it work too but again that shouldn't have to be the case if 48 was working fine for Iron Man ^_^"

She still seems to randomly lower herself once after beginning to float (like she drops in height slightly, but only once) but doesn't fall out of the animation all together, so it's manageable, though I'd still like to figure out why it didn't work properly and how I might be able to fine tune it ^_^"

What I would like though is for her MP to drain as long as she is using this floating animation and I can't for the life of me find anything about that in the manual. I looked through everything relating to MP but couldn't find anything relating to having animations drain MP as long as they're being performed. I heard it might require scripting for something like that but I'm not sure where to look for them ^_^" If someone could point me in the right direction and maybe give a pointer on how to use the script (I have zero experience with them) that would be great.

Somewhat related to this is that for her Block, she creates a magic shield around her and it can be held down indefinitely. I would like for this to also drain MP as long as it is active.

Hope I provided enough info ^_^ Any help is appreciated.
 
Damon Caskey said:
Sounds like somebody is making Twilight Sparkle. ;)

I'm about to hit the road, but if Bloodbane or O Ilusionista don't beat me to the punch I'll see what I can do later. Tagging myself (Damon Caskey) so I'm less likely to forget. :P

DC
I may be ;D She's probably one of the hardest ones I could've picked to do first and I haven't even gotten to figuring out how to create a deployable shield that allies can stand in lol

By a lot of trial and error by examining other mods I was able to (mostly accidentally ^_^") get her to float properly, so now the main thing is getting the MP to drain as long as she's doing it, and same with her blocking. I know I can make it so that ALL characters take chip damage to their MP whilst blocking but I don't want it to affect everyone. I'd like each character to function differently, so some will do a short a block animation that negates damage, some can hold it but take chip damage to HP or MP, some can hold and drain MP for as long as the button is held, etc.

By a lot of trial and error I somehow managed to figure out a teleport too by looking at Nightcrawler in Infinity War xD She can't teleport wherever the player chooses like I originally planned, but tapping U,U+Special will teleport her forwards and D,D+Special will teleport her backwards, which is fine 'cause it feels more retro than having full freedom of where she moves. I just can't believe I actually got it working xD
 
I just can't believe I actually got it working xD

That's the joy of modding and creating :D

Back to topic, I believe your character is using script so I can suggest some scripts to solve your problems. I assume you don't move the script file so it should be script.c in data/scripts folder.

First of all, to lose or spend MP you can use this function:
Code:
void mpcost(int Cost)
{// Spend some MP
    void self = getlocalvar("self");
    int MP = getentityproperty(self,"mp");

    changeentityproperty(self, "mp", MP-Cost); //Spend!
}

Copy that to script.c and use it with @cmd like this:

@cmd mpcost 10

That will deduct 10 MP unit from your MP

Now for this one:
What I would like though is for her MP to drain as long as she is using this floating animation...

Just declare that mpcost function in FOLLOW1 like this:
Code:
anim	follow1
	loop	1
	delay	1
	offset	66 135
	bbox	44 44 30 74
	frame	data/chars/Ironman/j0.gif
	delay	8
	@cmd	keyflip 0
	@cmd	keymove 1.2 0.6
	@cmd	floater 49
	frame	data/chars/Ironman/j0.gif
	frame	data/chars/Ironman/j1.gif
	frame	data/chars/Ironman/j0.gif
	@cmd	keyflip 0
	@cmd	mpcost 5
	@cmd	keymove 1.2 0.6
	frame	data/chars/Ironman/j1.gif
	frame	data/chars/Ironman/j0.gif
	@cmd	keyflip 0
	@cmd	keymove 1.2 0.6
	frame	data/chars/Ironman/j1.gif

As for losing flying status after losing MP, you can change animation with this function:
Code:
void aniLimit(void Ani, int Frame, int Limit)
{// Change current animation if MP falls below limit
    void self = getlocalvar("self");
    void MP = getentityproperty(self,"mp");    

    if (MP < Limit){
      changeentityproperty(self, "animation", openborconstant(Ani),2);
      updateframe(self, Frame);
    }
}

Just like before, copy that function to script.c
Declare it like this:
Code:
anim	follow1
	loop	1
	delay	1
	offset	66 135
	bbox	44 44 30 74
	frame	data/chars/Ironman/j0.gif
	delay	8
	@cmd	aniLimit "ANI_FOLLOW2" 0 5
	@cmd	keyflip 0
	@cmd	keymove 1.2 0.6
	@cmd	floater 49
	frame	data/chars/Ironman/j0.gif
	frame	data/chars/Ironman/j1.gif
	frame	data/chars/Ironman/j0.gif
	@cmd	keyflip 0
	@cmd	mpcost 5
	@cmd	keymove 1.2 0.6
	frame	data/chars/Ironman/j1.gif
	frame	data/chars/Ironman/j0.gif
	@cmd	keyflip 0
	@cmd	keymove 1.2 0.6
	frame	data/chars/Ironman/j1.gif

This means when ironman's MP drops below 5, he will change animation to FOLLOW2

Somewhat related to this is that for her Block, she creates a magic shield around her and it can be held down indefinitely. I would like for this to also drain MP as long as it is active

I might answer this in next post but I'd like to ask couple things first:
1. Is she using BLOCK animation for this?
2. If yes, is she using holdblock 1 command?
3. When she run out of MP, will she resume blocking without shield or will she not block at all?
 
Thank you very much! That worked perfectly and her float now drains MP and switches to jump pose when she runs out ;D

For her block, yeah she's using regular BLOCK anim and using holdblock 2 which apparently isn't even in the manual so I'm not sure where I got that number or why I used it, lol. When she runs out of MP she shouldn't be able to block at all ^_^
 
Sorry buddy, I had no time to help you. But I am glad you are enjoying it. Like BB said, its the joy of creating :)

using holdblock 2 which apparently isn't even in the manual
Holdblock uses a boolean value, so its either 0 or 1 - 2 or 99 won't make any difference. And it's on the manual for sure:
holdblock {bi}

**FIXED - see Damon Caskey comment bellow **
 
That's not correct O Ilusionista, there is a huge difference between holdblock 1 and 2. They work in conjunction with Blockpain animations.

Firstly, a quick note that Blockpain is not pain as if the block got broken through - it's meant to be a blocking impact animation like SNK tends to use. And while in Blockpain,you are still considered blocking.

Anyway...

When you use holdblock 1, you can hold block until you block an attack and go into the Blockapin animation. But as soon as Blockpain is finished, you go back to idle even if you are still holding block button. With holdblock 2, if you keep holding the block button, you go directly back to a blocking stance.


HTH,
DC
 
Damon Caskey  oh really? Thanks for the info. Man, need to fix that on the manual!
Specially when it says its a boolean value - it won't makes sense to call it boolean if accepts more than 2 values.

Edit: fixed.

edit 2: the version on WIKI manual has it and have more information about it. I am gonna fix this.
 
Thank you for the answers :)
I asked cause there might be problem and it is. Apparently holdblock 1 doesn't loop BLOCK animation causing MP cost or any features unusable. So you'll have to remove that command
Worry not, there's a script solution to replace that command and you already have the function so I only need to give you example on how to set it:
Code:
anim	block
	delay	1
	offset	40 89
	bbox	20 10 50 80
	frame	data/chars/Ironman/v1.png
	delay	10
	@cmd	keyflip	0
	@cmd	aniLimit "ANI_IDLE" 0 5
	frame	data/chars/Ironman/v1.png
	@cmd	keyflip	0
	@cmd	mpcost 5
	frame	data/chars/Ironman/v1.png
	@cmd	keyflip	0
	frame	data/chars/Ironman/v1.png
	@cmd	keyint "ANI_BLOCK" 0 "S" 0
	frame	data/chars/Ironman/v1.png

This BLOCK animation will loop as long as Special button is held. While looping, 5 MP unit is deducted per loop. If MP falls below 5, animation is ended and goes to IDLE
keyflip is function to flip facing direction by holding left or right. It's already available also :)

In order for aniLimit to work properly, you need to update it into this:
Code:
void aniLimit(void Ani, int Frame, int Limit)
{// Change current animation if MP falls below limit
    void self = getlocalvar("self");
    void MP = getentityproperty(self,"mp");    

    if(MP < Limit){
      if(Ani == "ANI_IDLE"){
        setidle(self);
      } else {
        changeentityproperty(self, "animation", openborconstant(Ani),2);
        updateframe(self, Frame);
      }
    }
}

You might want to play around with delay, number of frames and mp cost to get balanced value

HTH
 
I actually managed to resolve this ^_^ She uses holdblock 2 along with this animation:
Code:
anim	block
	loop	0
	blockback	1
	delay	6
	offset	44 69
	bbox	37  47  17  22
	@cmd	mpcost 2
	@cmd	aniLimit "ANI_IDLE" 0 5
	sound 	data/chars/twilightsparkle/twiboltsfx1.wav
	frame	data/chars/twilightsparkle/block01.gif
	frame	data/chars/twilightsparkle/block02.gif
	frame	data/chars/twilightsparkle/block03.gif
	frame	data/chars/twilightsparkle/block04.gif
	frame	data/chars/twilightsparkle/block05.gif
	loop	1
	frame	data/chars/twilightsparkle/block04.gif
	frame	data/chars/twilightsparkle/block05.gif
The MP cost kicks in with each loop and if she runs out of MP she switches to idle ^_^
 
Back
Top Bottom