Hey scriptin' peeps, how's your Christmas been, mine's mneh. Now that we got the pleasantries out of the way, it's time for da business with the question asking and the like, y'know, where noobies like me ask something and then some helpful person will provide me with an answer, yeah, those!
TODAY'S QUESTION!!!
I have been trying out having items work on certain characters EXAMPLE!!! A Repair Kit on a robot, which will only heal the robot but not a human. I almost had the idea work, unfortunately, the item recovery rate was a bit wonky and wouldn't recover the set amount that was supposed to work, I don't know if it's a bug in the recovering element system or not, but that's a problem that I don't intend to deal with. ALSO, the other problem with this is if I made a reviving item, the items that work on humans also work on robots, which is a big no no for me. I'm trying to see if there is a script to have it so that doesn't happen. So I can make a Repair Kit recover a robot, and a Phoenix Down recover a human.
Any answers you wonderous script peeps you? 😀
Say you want the repair kit to heal 120 as an example and you're robot is actor 7. Damage formula could be:
b.id == 7 ? 120 : 0
For the other healing items you'd reverse it, having them heal robot for 0 and replacing the second zero with the formula used to heal everyone else.
(Note that I'm not at a computer so while I think that's right there could be a syntax error somewhere)
the formula could run any valid RGSS3 code... :3
As a player though, I'd rather you disable targetting to the actors that cannot be healed by that item... 🙂
I'm trying to do that, I sorta got it working. My only gripe now is just reviving characters with said forumla. I.E Pheonix DOwn on human and Repair Kits on Robots. (NOT humans. lol.)
for the robot
b.id == ROBOT_ID ? b.remove_state(1) : 0
Note: 1 is the death state
or if you need some more lines
if b.id == ROBOT_ID;b.remove_state(1);b.hp+=VALUE;end;0
Alrighty, it's working... save for the recovering HP part... it's not recovering the HP, I even did your added line part formula... is there something I'm doin' wrong? X_X;
EDIT: Oh wait, it does the recovering, it just didn't show the pop-up number... that's weird...
EDIT 2: Now am I able to put percentages of HP recovering I can do with this formula or can it only be a set number?
you can do anything in the damage formula as long as you calculate it yourself.
b.mhp would be the maximum HP of the target, 0.45 * b.mhp would be 45% of the maximum HP.
Well it didn't show the number because the actual return line was 0... You could remove the ;0 at the end and see what happens
Alright! I guess that makes sense.
And last of all questions... now to make the Pheonix Down work on all characters except the robot, the process for that is confusing me a little. I tried adding ors inbetween the b.id == numbers. But it keeps crashin' am I doin' somethin' wrong with that too I'm assuming? 😛
EDIT: Yeah, I did what you said and got rid of the end part of the 0 and it fixed itself, thanks for that one. 😀
do the reverse...
if b.id != ROBOT_ID;b.remove_state(1);b.hp+=VALUE;end
or if that doesn't work
if (not b.id == ROBOT_ID);b.remove_state(1);b.hp+=VALUE;end
Awesome! And that should take care of everything........... except one tiny little detail...
The value part, I tried the percentage of HP thing like Andar mentioned for the value of HP recovery, it doesn't seem to want to recover that 25%. What part am I missing on that? It looks like this...
if (not b.id == 3);b.remove_state(1);b.mhp+=0.45;end
Anything wrong? :3
Yeah, you're trying to increase mhp using the + operator, which doesn't work (if you're curious why, you can try to look for my tutorial about increasing params)
that should be like this since what you want is to increase/heal HP equal to 45% of his mhp
if (not b.id == 3);b.remove_state(1);b.hp+=b.mhp*0.45;end
or
if (not b.id == 3);b.remove_state(1);b.hp=b.mhp*0.45;end
So, I did what you showed... but this one is just weird now... the HP number or whatever is showing like 250.34 (current) /569 (max) X_x;
...Yeah, instead of percentage of HP recovered, I think I'll just stick to having a set amount recovered instead...
But aside from that, thanks for all the help ya'll. Appreciated muchly. 😀
ah, yeah because the resultant can be a float since .45 is a float... so
if (not b.id == 3);b.remove_state(1);b.hp+=(b.mhp*0.45).to_i;end
this will turn the 45% of the mhp into an integer before adding it to the hp
Ah, there we go, now that solves it. Awesomness. Thanks muchly, considered this answer solved!