Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (1 invisible), 672 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to approach storing a big list of stats for weapons? #468718
10/13/17 19:09
10/13/17 19:09
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
Hello,

How would you approach making a big data file that would store a big group of weapons, and stats relating to each weapon?

For example, like in an excel sheet, you would have each column be a single weapon, and the first row would be the model file, the second row would be the durability, the 3rd row would be the piercing damage, swing speed, etc etc.

How would you make that for your game, as well as be able to read it? I supposed I could use multiple arrays, but that isnt very intuitive to look at while coding.

Re: How to approach storing a big list of stats for weapons? [Re: jumpman] #468719
10/13/17 19:12
10/13/17 19:12
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Create your own struct!
http://www.conitec.net/beta/structs.htm

Then save it either via game_save or with your own save function.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: How to approach storing a big list of stats for weapons? [Re: Superku] #468720
10/13/17 21:05
10/13/17 21:05
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Hi,

What you can do is create a struct with all the data of the item type (including the item name as string, bmap, sounds etc).
Now for every item type (e.g. Club, Bow) you can create a struct which holds the data for the item type.

MY_ITEM_STRUCT data_club;

And than set all the values for it in some startup function.

Code:
void struct_startup() {
 data_club.name = str_create("Club");
data_club.attack = 6;
...
}



Now you just have to store somewhere what type of item(s) each player/entity has and add that to player/entity the stats. E.g. in an other struct or in the entity skills or such.
There is alot of possibilities with structs and I recommend also read the pieces about struct array which are also very usefull (e.g. to store data for each seperate item or e.g. for each player).

Last edited by Reconnoiter; 10/13/17 21:09.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1