How to get power (various ways)

NED

Well-known member
I would like the game system to allow getting power in various ways...

1-by attacking [I can't activate it!]
2-by using taunts (freespecial) [how it works in non attacking moves?]
3-by items (this one is OK)
The power don't have to build up by waiting!

This is what I have in my settings:
HEADER:
Code:
mp 100# magic points
typemp 1

I can't understand how to build up power/magic in various ways.
 
theres this script from g.i joe
it makes the player lose mp
void mpcost( int Cost)
{// Spend some MP
    void self = getlocalvar("self");
    int MP = getentityproperty(self,"mp");

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

notice this line... !!!
changeentityproperty(self, "mp", MP-Cost); //Spend!

i havent tested it but the (MP-Cost) could be changed to (MP+Cost)
this could add the number (cost) to mp
like @cmd mpcost 10
gives +10 to mp

Code:
void mpcost( int Cost)
{// Spend some MP
    void self = getlocalvar("self");
    int MP = getentityproperty(self,"mp");

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

but then theres the problem if the player has 100% mp
this could make the mp infinite if the player doesnt use it with special moves...

bloodbane might need to add there an if mp!=100
 
Seems good, but about this code, how to precise that attacks will buid up magic bar?

=All attacks (but not super)
=taunts (progressive)
 
mpcost is function and it will only run on frame where it's declared.
So try it first! :)

Let's use modified version then:
Code:
@script
    void self = getlocalvar("self");
    int MP = getentityproperty(self,"mp");

    if(frame==1){
      changeentityproperty(self, "mp", MP+10);
    }
@end_script

Declare this in animations you want to gain MP.

frame==1 means, you get MP in 2nd frame. You can change this to any number.
 
OK!
This time I understand how it works!

(I was thinking to put it like other scripts in a single file  :-\)

Thanks a lot, I'll try it.
 
Any way will do, this is just example of using @script tag. You can make a function of this, insert in animation script then call it with @cmd if you like :)
 
Thanks, Do you mean using an alternate way can charge less the txt file of character?
By using only minimal cmd in character file and most of the scipt coding in a separate file??

This is what I would aim.
Because this cmd coding "IN" character anims is a bit heavy :-[

Can you be more specific about how to use it?
 
Well, @script tag and @cmd have their own advantages and disadvantages.

@script tag is not practical and make entity text file longer BUT it's great way to learn script for newbies. OTOH I usually use @script tag for unique scripts which is entity specific.

@cmd is practical and great to reuse since it's simple. It's best used for generic functions you use often such as velocity control and script based jumpframe.
And it helps shortening entity text file especially if the function is really long.

Can you be more specific about how to use it?

You need little creativity to move functions from @script tag to animation script. Anyways, let's take above script:

    void self = getlocalvar("self");
    int MP = getentityproperty(self,"mp");

    if(frame==1){
      changeentityproperty(self, "mp", MP+10);
    }

To convert this to a function in animationscript, you can do it like this:

void MPGain()
{
void self = getlocalvar("self");
    int MP = getentityproperty(self,"mp");

    changeentityproperty(self, "mp", MP+10);
}

This would work and you can call this with @cmd MPGain (case sensitive!)

However, it's not flexible and you're stuck with only 10 unit MP gain. So a good way is to allow variable gain by adding parameter like this:

void MPGain(int Gain)
{
void self = getlocalvar("self");
    int MP = getentityproperty(self,"mp");

    changeentityproperty(self, "mp", MP+Gain);
}

This works like before except now you have to specify mp gain like this: @cmd MPGain 10.

HTH
 
Back
Top Bottom