RPG in a Box

RPG in a Box

View Stats:
[SOLVED]A way to retrieve items data and put into a string?
hello there,
I am trying to show to the player the base damage of an equiped weapon
by modifying a global string every time I equip and un-equip a weapon.
I wrote a script that retrieve an id from the weapon slot and based to what it retrieved,
assign to the global string a string with the min and max damage.
But when play the game and test this "feature" It doesn't take into account the weapons as the player is always unharmed.

//retrieve the id $wpn_id = widget["Equipment_Custom"].element["0006"].item.id; if $wpn_id != null then if $wpn_id.tags contains "ranged" then //ranged weapons don't take into account the attack stats... global.property["damage_per_hit_string"] = str($wpn_id.min_damage - 1) "-" str($wpn_id.max_damage 1); else //...but melee ones do global.property["damage_per_hit_string"] = str($wpn_id.min_damage player.stat["attack"] - 1) "-" str($wpn_id.max_damage player.stat["attack"] 1); end; else //no weapon equiped global.property["damage_per_hit_string"] = str(player.stat["attack"] - 1) "-" str(player.stat["attack"] 1); end;

It seems that the condition $wpn_id != null is always false when it is evaluated.

Edit:
I Solved this problem by taking modifying this line:
$wpn_id = widget["Equipment_Custom"].element["0006"].item.id;
with:
$wpn_id = widget["Equipment_Custom"].element["0006"].item;

Basically I was retrieving only the id, instead of the whole item data.
Last edited by JCtheMowDude; 11 Dec @ 11:46am