Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Changing weapons stats

zchin

Sponsor

I'm requesting a script that shouldn't be that hard, but what do I know, I'm not a scripter...

Well here's what I would like the script to do: I'l like it to modify a weapon and change it's stats by inputting a script command in an event or something similar.

Thank you and have a nice day!
 
Errr.... not THAT simple....

The simple wayshould be to write the following:

$data.weapons[ <index>].<stat> = <new_value>

where:
  • <index> is the id of the weapon (the number that appear in the weapon list in the database, and that you have to explain how to find it during scripting time (the one equipe by a given character => which character, one in the inventory => how do want to indentify it, etc...)).
  • <stat> is the weapon stat and must be one of the following:
    • name
    • icon_index
    • desctiption
    • note
    • animation_id
    • price
    • hit
    • atk
    • def
    • spi
    • agi
    • two_handed
    • fast_attack
    • dual_attack
    • critical_bonus
    • element_set
    • state_set
  • <new_value> is the new value you want for the stat. Its type is determined by the stat you want to change. It may be a string, number, boolea (true/false) or even an array. Look at the TOG Maker help file

for exemple:

$data_weapons[1].atk = 10

Alas this solution has a couple major drawbacks:

  • It changes the stats of ALL weapons with the same index. That is: if 2 characters have the same weapon, the stats are changes for both of them
  • the changes are not saved
  • I thought of another one, but forgot it....

to resolve that, we have to create another, more complex, class for the $data_weapon variable. By luck, I am working on it, but still don't have THE idea that will resolve all....

See ya later.
 

zchin

Sponsor

Oh thanks a ton, I sorta forgot about this thread...
Anyways, how do I add numbers to these stats?
For example:
Sword STR = 10
uses item
Sword STR = 12
uses item
Sword STR = 14

And so on, how would i be able to do that instead of just setting the stat?

Thank you and have a nice day!
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top