healthpotion (RPG)

Having issues not related to a specific Sandbox game mode? Get help here!
Please also read the rules for support when posting support requests.
Failure to comply with the forum rules may result in your topic being locked without resolution.
Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

Re: healthpotion (RPG)

Postby Hirato » February 1st, 2012, 9:34 pm

actually it doesn't work.

Code: Select all

r_item_use_new_status 1 $STATUS_HEALTH -0.2 1

This line is incorrect, this command is meant to refer to a statusgroup, not a status effect itself.
The full prototype of that command is "START(new_status, "iif", (int *st, int *el, float *m),". That means in order, it takes 3 arguments which are "statusgroup," "element" and "multiplier".

You're halfway there, to making the best potions you can at the moment.

First, you'll need to create a new ammotype, which contains only that item.
then, you will need to make the "spell" expend one (aka, _cost 1) and use this ammotype.


In the end result, you should be able to equip a potion, which you can use on yourself.
Doing so grants you the healing (or whatever) effect of the potion and removes one instance from your inventory.
Unless the only copy you have is equipped.

That should do it, though you may want to change the associated skill to SKILL_NONE, unless you intend a person's magical affinity to play a major role in your game (eg Arcanum).
I think resistance/threshold only applies to effects deemed hostile, I'm not too sure right now. Just in case you may want to use the element, ATTACK_NONE so it doesn't get filtered.
This is not a url, clicking it is pointless

User avatar
wildflower
Member
Member
Posts: 76
Joined: August 11th, 2011, 5:10 am
Name: Sandie

Re: healthpotion (RPG)

Postby wildflower » February 1st, 2012, 10:05 pm

Hirato wrote:The full prototype of that command is "START(new_status, "iif", (int *st, int *el, float *m),". That means in order, it takes 3 arguments which are "statusgroup," "element" and "multiplier".


I'm sorry to say, but I really don't understand this :oops:
It's not that I don't want to learn it thou, but logic was never my strong side.

What is "iif" ?

And where are the three arguments defined?

User avatar
kddekadenz
Member
Member
Posts: 423
Joined: July 17th, 2011, 11:02 am
Name: kdd
Contact:

Re: healthpotion (RPG)

Postby kddekadenz » February 2nd, 2012, 3:51 am

Doing a healing spell is very simple. I implemented it at my own in Kelgar (you can buy it at the general store).
Kelgar is an advanced RPG beeing developed in Sandbox

User avatar
Sircameron
Member
Member
Posts: 62
Joined: March 6th, 2012, 9:13 pm
Name: Cameron
Location: Indiana

Re: healthpotion (RPG)

Postby Sircameron » April 9th, 2012, 1:16 am

wildflower wrote:
Hirato wrote:The full prototype of that command is "START(new_status, "iif", (int *st, int *el, float *m),". That means in order, it takes 3 arguments which are "statusgroup," "element" and "multiplier".


I'm sorry to say, but I really don't understand this :oops:
It's not that I don't want to learn it thou, but logic was never my strong side.

What is "iif" ?

And where are the three arguments defined?


In the (rpg/games/"game folder"/statuses) folder.. Inside a .cfg file you need to put

Code: Select all

r_status friendly 1
r_status_addgeneric $STATUS_HEALTH +x

(x) = the amount of health you want to heal.

Code: Select all

 r_item_type $ITEM_AMMO//think of this as water
r_item_type $ITEM_WEAPON//think of this as a canteen

you need 2 separate items to make a functioning health potion.. Define one as the ammo(water), and one as the weapon(canteen).. Hirato's info may seem puzzling at first, but his way totally works. Hope i made this a little easier to comprehend

User avatar
kddekadenz
Member
Member
Posts: 423
Joined: July 17th, 2011, 11:02 am
Name: kdd
Contact:

Re: healthpotion (RPG)

Postby kddekadenz » May 28th, 2012, 2:04 pm

Hirato wrote:actually it doesn't work.

Code: Select all

r_item_use_new_status 1 $STATUS_HEALTH -0.2 1

This line is incorrect, this command is meant to refer to a statusgroup, not a status effect itself.
The full prototype of that command is "START(new_status, "iif", (int *st, int *el, float *m),". That means in order, it takes 3 arguments which are "statusgroup," "element" and "multiplier".

You're halfway there, to making the best potions you can at the moment.

First, you'll need to create a new ammotype, which contains only that item.
then, you will need to make the "spell" expend one (aka, _cost 1) and use this ammotype.


In the end result, you should be able to equip a potion, which you can use on yourself.
Doing so grants you the healing (or whatever) effect of the potion and removes one instance from your inventory.
Unless the only copy you have is equipped.

That should do it, though you may want to change the associated skill to SKILL_NONE, unless you intend a person's magical affinity to play a major role in your game (eg Arcanum).
I think resistance/threshold only applies to effects deemed hostile, I'm not too sure right now. Just in case you may want to use the element, ATTACK_NONE so it doesn't get filtered.


I currently trying to implent this in Kelgar, but I always get a invalid ammo error.

/items/29.cfg

Code: Select all

// Weak Healing Spell

r_item_name "Weak Healing Spell"
r_item_icon "items/spells/healing_spell_lvl1.png"
r_item_description "A spell which heals you."
r_item_mdl "kdd/items/scroll01/firearrows_lvl1"
r_item_worth 55
r_item_weight 0.1
r_item_script 7

r_item_use_new_weapon // 0
r_item_use_name "Weak Healing Spell"
r_item_use_new_status 1 $STATUS_HEALTH -0.1 1
r_item_use_slots $SLOT_LHAND
r_item_use_ammo 0
r_item_use_cost 1
r_item_use_target $T_SELF


/ammo/0.cfg

Code: Select all

r_ammo_name "Healing Spell"

r_ammo_additem 29


This should theoretically turn the spell to a one-use-spell, but I do get the invalid ammo error.
Kelgar is an advanced RPG beeing developed in Sandbox

Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

Re: healthpotion (RPG)

Postby Hirato » May 28th, 2012, 10:01 pm

What did I tell you about checking the log for warnings and errors?
in your case r_ammo_additem isn't a valid command, it's r_ammo_add_item
This is not a url, clicking it is pointless

User avatar
kddekadenz
Member
Member
Posts: 423
Joined: July 17th, 2011, 11:02 am
Name: kdd
Contact:

Re: healthpotion (RPG)

Postby kddekadenz » May 29th, 2012, 2:33 am

Hirato wrote:What did I tell you about checking the log for warnings and errors?
in your case r_ammo_additem isn't a valid command, it's r_ammo_add_item


/ammo/README.txt

Code: Select all

//slots
// name[s]
//commands
// - r_ammo_additem index[i]


Whatever, does work fine now.

EDIT:
I'm finished now implementing eating for all the items of Kelgar :D
Kelgar is an advanced RPG beeing developed in Sandbox

gametechish
Member
Member
Posts: 6
Joined: March 31st, 2013, 10:32 am
Name: William Province

Re: healthpotion (RPG)

Postby gametechish » April 1st, 2013, 8:55 am

wildflower wrote:I managed to make a working healing spell :D

Code: Select all

// Healing spell

r_item_name "Healing spell"
r_item_icon "items/healing.png"
r_item_description "A simple healing spell"
r_item_mdl "sandie/scroll"
r_item_worth 25
r_item_weight 1
r_item_script 7
r_item_use_new_weapon // 0
r_item_use_name "Healing spell"
r_item_use_description "A simple healing spell"
r_item_use_new_status 1 $STATUS_HEALTH -0.2 1
r_item_use_cooldown 400
r_item_use_chargeflags (| $CHARGE_RADIUS $CHARGE_MAG)
r_item_use_slots $SLOT_RHAND
r_item_use_skill $SKILL_MAGIC
r_item_use_cost 10
r_item_use_pflags (| $P_VOLATILE $P_TIME)
r_item_use_target $T_SELF
r_item_use_charge 200
r_item_use_basecharge .5
r_item_use_mincharge .5
r_item_use_maxcharge 1.5
r_item_use_elasticity 0
r_item_use_speed 2


Not sure about what all the stuff does yet, and it is very likely that it's not the right way of doing it, But it works :mrgreen:

I know it's not a healthpotion yet, but it is progress and I can use it as a temporary replacement for potions.


if you want to make it a potion you should add

r_item_use_ammo 1

to the end it should make it use itself as ammo


Return to “Sandbox General Support”

Who is online

Users browsing this forum: No registered users and 2 guests