The Daily Click ::. Forums ::. Klik Coding Help ::. Creatable Weapons
 

Post Reply  Post Oekaki 
 

Posted By Message

Blackstorm



Registered
  29/08/2002
Points
  439
19th June, 2004 at 00:10:37 -

Does anyone know how to save weapons using the array object or the file object? I need it so that you can make a weapon with multiple attributes (power, distance, etc.) and use it on a character. The system will be similar to the Machines of Destruction weapon system.

 
Wise sayings:
"A pint of example is worth a gallon of advice."
"Do unto others as you want done unto you."
"An idea is nothing without effort."
"HOLY CRAP!"

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
19th June, 2004 at 02:49:54 -

I think it would be a good idea to use an ini file here. This is what you have to do:

Start of frame - set counter(speed) to [load value from ini]

Player presses 'shoot' - create bullet at player, set speed to counter(speed)

So what you are doing is loading a value from the ini file, then temporarily storing it in a counter. Then when you program requires the data you get it from the counter. You could always just get the data straight from the ini but if you shot many bullets this might slow things down.

Here's an example of what your ini file might look like:

[Weapon1]
Name="Colt 45"
Power=20
Image="game\images\colt45.jpg"
Distance=4

[Weapon2]
Name="Colt 5000XXX"
Power=2000000
Image="game\images\coltX.jpg"
Distance=400

[Numofweps]
number=2

So recapping:
Load things you need from the ini file into counters.
When you need to fire take the data from the counters.

Just edit the ini file in notepad for testing but if you want to release a weapon editor, then do so.





 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

RapidFlash

Savior of the Universe

Registered
  14/05/2002
Points
  2712
19th June, 2004 at 16:27:55 -

Arrays would be the ideal way to do this (quick and easy), but MMF's arrays are annoying to use, and if you don't have too much information to save, use Andy's idea.

 
http://www.klik-me.com

Blackstorm



Registered
  29/08/2002
Points
  439
19th June, 2004 at 18:35:46 -

Oh yeah, I have a LOT of info to save...
Damage, Fire Damage, Ice Damage, Electric Damage, Range, Projectile Speed, Length, Defense, Fire Defense, Ice Defense, Electric Defense, Shield HP, and Regeneration Speed.
LOTS of stats. I definitly need to use an array.

 
Wise sayings:
"A pint of example is worth a gallon of advice."
"Do unto others as you want done unto you."
"An idea is nothing without effort."
"HOLY CRAP!"

Muggus

Possibly Insane

Registered
  31/07/2002
Points
  2958
20th June, 2004 at 02:19:26 -

You can save alot of things into an INI, just like Andy said. You may need to run a fastloop or something to get it all in there.
You have all of that info saved for each weapon in an INI, then load it into Global values or a list box, or something you could display it in the game. Then you could save it back into the INI.

If you know what I mean.

 
MUGGUS
Come and annoy me more at
www.muggus69.tk
STOUT ANGER!!!

ben_02



Registered
  15/05/2002
Points
  366
20th June, 2004 at 07:48:01 -

Actually a word of advice:

Don't use an INI file, because you may want to store weapons with a player, then modify them later on. The problem I had with Machines of Destruction was if you modified a weapon you'd bought, I had to make it check if it had been modified before you played a game. Otherwise you could make a really cheap gun, then upgrade it, and score a free superweapon.

Use the String Parser Object, and store weapons in a big string like this:

"5|12|6|Machine Gun|6|3"

where each token is an attribute of the weapon. This way you can store the string whereever you like in your game, instead of having to refer to the INI.
If you use an INI, you'll have the problem I did.
See 3ee.com for how to use String Parser.

 
n/a

Kramy



Registered
  08/06/2002
Points
  1888
20th June, 2004 at 12:26:28 -

Probably just stick with the array. You can perform calculations directly using the values from the array, correct?

It seems kind of pointless to use an INI to load values into an array so you don't need 5600 counters.

 
Kramy
   

Post Reply



 



Advertisement

Worth A Click