Item properties.

Jaymonius

Veteran
Veteran
Joined
Mar 22, 2012
Messages
243
Reaction score
76
First Language
English
Primarily Uses
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? :D
 
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
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)
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
So I can make a Repair Kit recover a human, and a Phoenix Down recover a human.
Those are both human...


You could use a common event, save the target into a variable via the damage formula then check it on a common event, if it's correct, proceed with whatever should happen, if not, give back the item if you want.. Or you could try to find a custom target selection script that will allow you to make an item only be able to target a certain actor/s. IDK if those exist though
 

Jaymonius

Veteran
Veteran
Joined
Mar 22, 2012
Messages
243
Reaction score
76
First Language
English
Primarily Uses
Those are both human...

You could use a common event, save the target into a variable via the damage formula then check it on a common event, if it's correct, proceed with whatever should happen, if not, give back the item if you want.. Or you could try to find a custom target selection script that will allow you to make an item only be able to target a certain actor/s. IDK if those exist though
Fixed. :p

Custom target selection, I'll do a quick google search on that...

EDIT: OHHHHHHHHHH!!! I didn't know that the forumla had stuff like that, alright, I'll do a quick test on this Alex. That is bloody interesting!
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
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... :)
 
Last edited by a moderator:

Jaymonius

Veteran
Veteran
Joined
Mar 22, 2012
Messages
243
Reaction score
76
First Language
English
Primarily Uses
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.)
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
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
 

Jaymonius

Veteran
Veteran
Joined
Mar 22, 2012
Messages
243
Reaction score
76
First Language
English
Primarily Uses
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?
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
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.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
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
 
Last edited by a moderator:

Jaymonius

Veteran
Veteran
Joined
Mar 22, 2012
Messages
243
Reaction score
76
First Language
English
Primarily Uses
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? :p

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. :D
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
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
 

Jaymonius

Veteran
Veteran
Joined
Mar 22, 2012
Messages
243
Reaction score
76
First Language
English
Primarily Uses
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
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
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
 
Last edited by a moderator:

Jaymonius

Veteran
Veteran
Joined
Mar 22, 2012
Messages
243
Reaction score
76
First Language
English
Primarily Uses
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. :D
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
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
 
Last edited by a moderator:

Jaymonius

Veteran
Veteran
Joined
Mar 22, 2012
Messages
243
Reaction score
76
First Language
English
Primarily Uses
Ah, there we go, now that solves it. Awesomness. Thanks muchly, considered this answer solved!
 

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

Latest Threads

Latest Posts

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,865
Messages
1,017,059
Members
137,575
Latest member
akekaphol101
Top