Need help creating a Skill

Morpheus

Jack-of-Trades
Veteran
Joined
Mar 14, 2012
Messages
231
Reaction score
85
First Language
english
Primarily Uses
N/A
Basically I was wondering (without scripting but if there's a script to do it I will) how/if I can make a move so that when an enemy has less than 20% HP the move is an instakill, otherwise it does 1 damage. Is this possible? 

EDIT: Also I just encountered another problem. Im using a sideview battle system, so when I use a certain skill to change the actors graphic (like a transformation skill) during the battle even though the skill is set to "Battle only" the graphic stays the same after the battle. Anyone have a clue how I could change the actors graphic only in battle but have it change back after the battle?
 
Last edited by a moderator:

Zoltor

Veteran
Veteran
Joined
Jan 18, 2014
Messages
1,550
Reaction score
211
First Language
English
Primarily Uses
Basically I was wondering (without scripting but if there's a script to do it I will) how/if I can make a move so that when an enemy has less than 20% HP the move is an instakill, otherwise it does 1 damage. Is this possible? 
Hime has an effects manager script that lets you assign conditions to effect of skills, and items.

http://www.himeworks.com/2012/10/05/effects-manager/

That will allow you to do that.
 
Last edited by a moderator:

Zoltor

Veteran
Veteran
Joined
Jan 18, 2014
Messages
1,550
Reaction score
211
First Language
English
Primarily Uses
I appreciate the response, but is there a...simpler script than that one? I can't even find where or what I would notetag in the skill.
I doubt it, as this is pretty simple to use as it is. The more flexible/things you want a script to be able to do, the more complex the implementation of such is generally.

Unless someone creates the entire skill(coincidently, the exact skill you want) through scripting, and uploads said script, all script revolving around custom settings are gonna be like this or a lot less user friendly..
 
Last edited by a moderator:

Alexander Amnell

Jaded Optimist
Veteran
Joined
Mar 17, 2012
Messages
3,404
Reaction score
1,733
First Language
English
Primarily Uses
N/A
1. Input this code as the skills damage formula.

b.hp <= (b.mhp * 0.2) ? 999999 : 12.  Have the skill that transforms the actor activate a switch in the common event that changes the graphics and such, then have another common event run on a parallel process that activates when that switch is on and changes the graphic/class/whatever back to normal. (by default said common events do not run during battle, so it will not take effect till after the battle is over.)
 
Last edited by a moderator:

Zoltor

Veteran
Veteran
Joined
Jan 18, 2014
Messages
1,550
Reaction score
211
First Language
English
Primarily Uses
1. Input this code as the skills damage formula.

b.hp <= (b.mhp * 0.2) ? 999999 : 12.  Have the skill that transforms the actor activate a switch in the common event that changes the graphics and such, then have another common event run on a parallel process that activates when that switch is on and changes the graphic/class/whatever back to normal. (by default said common events do not run during battle, so it will not take effect till after the battle is over.)
Lol that's another way to do it, have it do so much dmg if the target is below a certain %, that it would kill it just from the damage.
 
Last edited by a moderator:

Alexander Amnell

Jaded Optimist
Veteran
Joined
Mar 17, 2012
Messages
3,404
Reaction score
1,733
First Language
English
Primarily Uses
N/A
Lol that's another way to do it, have it do so much dmg if the target is below a certain %, that it would kill it just from the damage.
Isn't that what he/she asked for? For some reason if you try to add state 1 (death) to a target directly in a damage formula it causes problems like not properly disposing the target battler's image and sometimes even crashing which is why I opted for strait damage instead. Though it should work fine since 999999 is by default the maximum hp a battler can have and even if he/she's using a script that ups the max stats as long as there is 0 variance and the damage is upwards of 20% of the enemy with the highest hp possible's max hp then it'd still work.
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
If you don't know what the max hp is for the given target you can just ask the target to give it to you

Code:
b.mhp
 
Last edited by a moderator:

Zoltor

Veteran
Veteran
Joined
Jan 18, 2014
Messages
1,550
Reaction score
211
First Language
English
Primarily Uses
Isn't that what he/she asked for? For some reason if you try to add state 1 (death) to a target directly in a damage formula it causes problems like not properly disposing the target battler's image and sometimes even crashing which is why I opted for strait damage instead. Though it should work fine since 999999 is by default the maximum hp a battler can have and even if he/she's using a script that ups the max stats as long as there is 0 variance and the damage is upwards of 20% of the enemy with the highest hp possible's max hp then it'd still work.
No he/she asked for Death, so natuarally people would tie the Death state to it.

Yea, that's why I offered the Hime's script.(not to mention you can do even more thing with this script)

Yea I know, It's all good, both ways are viable.

To OP: If you go the max dmg forula route, make sure you create a new element for it, so only enemies you want to be immune/resistant against it, will be.
 

Alexander Amnell

Jaded Optimist
Veteran
Joined
Mar 17, 2012
Messages
3,404
Reaction score
1,733
First Language
English
Primarily Uses
N/A
If you don't know what the max hp is for the given target you can just ask the target to give it to you

b.mhp
I like seeing a row of 9's pop up during insta-kills personally, but yeah, replacing the damage for the true statement to b.mhp would guarantee it kills anything though it also means that the insta-kill wouldn't be consistent and could deal say 2 damage to a slime with 10 hp max and then turn around and deal 2000 damage to an enemy that has 10000 which might look kind of strange in game at times. (+ players tend to almost universally love 'overkill' so if it's gonna kill it regardless then...)
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
If you like to see 9's, but is not sure how many 9's you need, you can check how many digits there are.

There are likely sophisticated math ways or more efficient ways to do it but I would just turn it into a string and get the length and then abuse the fact that multiplying a string with a number gives you that many repetitions of the string

("9" * b.mhp.to_s.size).to_iBut, as a developer, you know what the largest HP is, so you should be able to get away with 999999. Just add more 9's if you think you'll have enemies with more HP.And if you don't know for some reason, perhaps your game allows enemies and actors to get 9999999999999999999999999999999999 HP or something, then I guess you can go with the digit counting approach. Seeing 9999999999999999999999 and 999999999999999999999 probably isn't going to look too inconsistent.

There is a method called param_max that defines the absolutely max param you can have for a particular parameter.

Just do this

Code:
b.param_max(0)
This is likely better than using mhp or hardcoding arbitrarily long numbers.
 
Last edited by a moderator:

Rycoria

Creator of Riley
Veteran
Joined
Sep 25, 2013
Messages
58
Reaction score
11
First Language
English
Primarily Uses
Hey guys can I just ask something about the damage formula? I didn't know you could do things like that. So just making sure it's like

Condition ? Effect if condition is true : effect if condition is false

Is this correct?
 

Mouser

Veteran
Veteran
Joined
Aug 19, 2012
Messages
1,245
Reaction score
264
First Language
English
Primarily Uses
Hey guys can I just ask something about the damage formula? I didn't know you could do things like that. So just making sure it's like

Condition ? Effect if condition is true : effect if condition is false

Is this correct?
Yes. That's a standard Ruby command (in most programming languages actually).

The "?" is called the 'ternary operator' because it takes 3 terms rather than the right hand/left hand that other operators do.
 
Last edited by a moderator:

Rycoria

Creator of Riley
Veteran
Joined
Sep 25, 2013
Messages
58
Reaction score
11
First Language
English
Primarily Uses
Thanks I appreciate it. My coding language is limited to c, java and Python, and a bit of others but I've never encountered it before.
 

Mouser

Veteran
Veteran
Joined
Aug 19, 2012
Messages
1,245
Reaction score
264
First Language
English
Primarily Uses
Thanks I appreciate it. My coding language is limited to c, java and Python, and a bit of others but I've never encountered it before.
Most project design style documents prohibit its use.

It's way too easy to screw things up if you use it for anything but the simplest of expressions. Anything you can do with a ternary you can do with an if/else, so it's not a required operator by any means. In this case, since you're limited in what you can put in the formula box, it does come in handy.

My personal rule(s) of thumb:

1) Everything must be on one line, no compound expressions.

Technically you could put a whole code block for the "true" and "false" results - you can even put another ternary operator expression for each, and give them their own code blocks if you're submitting something for an 'obfuscated code' contest.

2) It must be immediately apparent what's going on.

In practice I'll use it for a return value, where the true and false statements are a single word: "return foo?bar1:bar2", or sometimes as a parameter in order to pass one of two variables:"foo(bar?var1:var2)". I think I may have used it one place to call a combat skill based on whether or not the attacker was an actor: "(actor?) ? method1(args):method2(args)"

If there is ANY possible confusion about the line, write it as an if/else. If you feel it needs extra commenting to explain it, write it as an if/else. If you're writing code with plans to distribute it to other people and have them understand it - you guessed it, write it as an if/else.

It's really a relic of a time back when programmers needed to write "terse" code, because every byte counted.

Classic example (using C):

example 1:

strcpy (s, t)char *s, *t;{ while ((*s=*t) !='\0'){ s++; t++; }}
Example 2:

strcpy(s, t)char *s, *t;{ while (*s++ = *t++);}
Both of those do exactly the same thing, but the first example was considered very wasteful and inefficient.

The second example, being much more terse, was considered far better coding style.

Today, we're somewhere in the middle of the two extremes, for the most part. Make your code terse, but readable, and be liberal with your comments. The person updating it someday may be you, and if you haven't seen it for a year or more it may as well have been written by somebody else. If you are writing for somebody else... I don't think I've ever heard somebody throw a fit because code was overly commented.
 
Last edited by a moderator:

Rycoria

Creator of Riley
Veteran
Joined
Sep 25, 2013
Messages
58
Reaction score
11
First Language
English
Primarily Uses
Most project design style documents prohibit its use.

It's way too easy to screw things up if you use it for anything but the simplest of expressions. Anything you can do with a ternary you can do with an if/else, so it's not a required operator by any means. In this case, since you're limited in what you can put in the formula box, it does come in handy.

My personal rule(s) of thumb:

1) Everything must be on one line, no compound expressions.

Technically you could put a whole code block for the "true" and "false" results - you can even put another ternary operator expression for each, and give them their own code blocks if you're submitting something for an 'obfuscated code' contest.

2) It must be immediately apparent what's going on.

In practice I'll use it for a return value, where the true and false statements are a single word: "return foo?bar1:bar2", or sometimes as a parameter in order to pass one of two variables:"foo(bar?var1:var2)". I think I may have used it one place to call a combat skill based on whether or not the attacker was an actor: "(actor?) ? method1(args):method2(args)"

If there is ANY possible confusion about the line, write it as an if/else. If you feel it needs extra commenting to explain it, write it as an if/else. If you're writing code with plans to distribute it to other people and have them understand it - you guessed it, write it as an if/else.

It's really a relic of a time back when programmers needed to write "terse" code, because every byte counted.

Classic example (using C):

example 1:

strcpy (s, t)char *s, *t;{ while ((*s=*t) !='\0'){ s++; t++; }}
Example 2:

strcpy(s, t)char *s, *t;{ while (*s++ = *t++);}
Both of those do exactly the same thing, but the first example was considered very wasteful and inefficient.

The second example, being much more terse, was considered far better coding style.

Today, we're somewhere in the middle of the two extremes, for the most part. Make your code terse, but readable, and be liberal with your comments. The person updating it someday may be you, and if you haven't seen it for a year or more it may as well have been written by somebody else. If you are writing for somebody else... I don't think I've ever heard somebody throw a fit because code was overly commented.Lol definintely. I know I for one always get pissed when dealing with code that's not indented nicely, has stupid variable names, or worst of all, brace brackets that don't start a new line like:

while{

blah

}

Oh god that killed a part of my soul to type. It gives me headaches. Would it kill people to type

while

{

blah

}

For the record I added spaces before blah but mobile text editing is weird.

I mean seriously. Readability is very important, even though the end user will never see it. I appreciate the explanation and tips.
 
Last edited by a moderator:

DorkLord

10th Level Google Mage
Veteran
Joined
Aug 1, 2013
Messages
47
Reaction score
26
First Language
English
Primarily Uses
N/A
Basically I was wondering (without scripting but if there's a script to do it I will) how/if I can make a move so that when an enemy has less than 20% HP the move is an instakill, otherwise it does 1 damage. Is this possible? 

EDIT: Also I just encountered another problem. Im using a sideview battle system, so when I use a certain skill to change the actors graphic (like a transformation skill) during the battle even though the skill is set to "Battle only" the graphic stays the same after the battle. Anyone have a clue how I could change the actors graphic only in battle but have it change back after the battle?
Another alternative you could use is a battle condition that gives a big DEF debuff and/or weakness to all attack types to the enemy on the condition that their HP is below X%.
 

Morpheus

Jack-of-Trades
Veteran
Joined
Mar 14, 2012
Messages
231
Reaction score
85
First Language
english
Primarily Uses
N/A
1. Input this code as the skills damage formula.

b.hp <= (b.mhp * 0.2) ? 999999 : 12.  Have the skill that transforms the actor activate a switch in the common event that changes the graphics and such, then have another common event run on a parallel process that activates when that switch is on and changes the graphic/class/whatever back to normal. (by default said common events do not run during battle, so it will not take effect till after the battle is over.)
You are a freaking genius. (Sorry I haven't been home for a week) Both of those solve my problem. If I could, I would shake your hand, sir. You have my eternal gratitude.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,867
Messages
1,017,062
Members
137,575
Latest member
akekaphol101
Top