The Daily Click ::. Forums ::. Klik Coding Help ::. Need help with a random gun generator similar to borderlands.
 

Post Reply  Post Oekaki 
 

Posted By Message

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
15th November, 2010 at 23:51:06 -

So ive been working on Prefix's and titles similar to borderlands for the past week and ive finally gotten to the point where i can start coding the engine for the random gun drop, so heres how i want it to work.
i want it so when an enemy is destroyed it has the chance to drop a gun, when the gun is dropped the prefix and the title should be randomized (like in borderlands Combustion Hellfire, where as combustion is prefix, hellfire is title.) with of coarse limitations, such as certain titles cannot be given to certain gun types and certain titles cant be given to certain gun companies. my problem is, i dont even know how to go about this at all.
now the look of the gun is completely based off of the title and the type of gun. the gun does not change look even if the prefix is different but the title is the same. (such as a Pounding Rifle looks the same as a Hard Rifle, but they have different stats, But a pounding Savior Looks different from both)
now what i was thinking was make 1 active object for each title, and make each different prefix combination for that title a different animation. with that being said i have no clue how to make it randomly choose a company, than randomly choose a gun type according to the company, than randomly choose a title according to the gun type, and then randomly pick a prefix, and then on top of all that select the right active object, and the right animation to match. anyone have any idea? oh and, how would i factor in the effects of each title and prefix such as damage, clip size, bullet velocity etc

any help would be GREATLY appreciated. i just dont even know where to start

 
[Game design makes my brain feel like its gonna explode.]

monkeytherat

Hero of Time Jr

Registered
  07/11/2010
Points
  1293

VIP MemberI donated an open source project
16th November, 2010 at 00:12:24 -

I suggest you put all of the prefixes and names in an ini file (if you haven't already). Code it so that when an enemy dies, before it gets destroyed it it creates a gun and sets its name and prefix randomly selected from the ini. You can do this by coding

always
-set ini value >prefix< random(#of prefixes -1)
-and set ini value >Name< random(#of names -1)

when enemy health is lower than or equal to 0
-create object gun at 0,0 from enemyu
-set gun prexix to ini value prefix
set gun name to ini value name
-destroy enemy.

I hope that is understandable/ works.

 
If you put a million monkeys at a million keyboards, one of them will eventually write a Java program.
The rest of them will write Perl programs.

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
16th November, 2010 at 00:15:58 -

I havnt had any experience with ini files but i suppose now is a good time to start lol.
You said "-set gun prexix to ini value prefix
set gun name to ini value name "

what should i do for that? should i have it so that each gun title is an active object and have it so each prefix is a different animation?

 
[Game design makes my brain feel like its gonna explode.]

monkeytherat

Hero of Time Jr

Registered
  07/11/2010
Points
  1293

VIP MemberI donated an open source project
16th November, 2010 at 00:30:50 -

I can't really say for sure unless I see the coding... how in the game do you know what your gun is called?

 
If you put a million monkeys at a million keyboards, one of them will eventually write a Java program.
The rest of them will write Perl programs.

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
16th November, 2010 at 00:36:46 -

i wasnt exactly sure how to do that either, couldnt i just have a string object or something created above the gun that retrieves the randomized prefix and Title?

 
[Game design makes my brain feel like its gonna explode.]

monkeytherat

Hero of Time Jr

Registered
  07/11/2010
Points
  1293

VIP MemberI donated an open source project
16th November, 2010 at 00:42:00 -

You could have two strings: one called prefix and one called name. Always set them at x,x from each other (depending on how big you want them) the set the strings to the values in the ini. When you make the weapon, have the strings' postition set to wherever you want them. If you are still confused about inis, I can explain them.

 
If you put a million monkeys at a million keyboards, one of them will eventually write a Java program.
The rest of them will write Perl programs.

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
16th November, 2010 at 00:44:50 -

Yeah that aught to work for the title and what not.
Oh please do, i have no clue how to use an ini file
and could i use the ini file to set how much bullet damage should do and what not?
oh and i forgot to mention, i want it so that the weapons level will be randomized as well, give or take 3-5 levels either way relative to the players current level.

 
[Game design makes my brain feel like its gonna explode.]

monkeytherat

Hero of Time Jr

Registered
  07/11/2010
Points
  1293

VIP MemberI donated an open source project
16th November, 2010 at 01:02:52 -

For weapon damage, you could use alterable values. An also I thought of a somewhat simpler way, but also possibly will make you game bigger in size (fail grammar). It has been a little while since I've hardcore used inis and this may be a bit complicated, so please don't be mad/ upset if any of this information is inaccurate.

First things first you need an ini object in your frame. You can get this just like you create actives or backdrops, but select ini instead. The ini is basically a categorized text file that mmf2/tgf2 can extract information from. Then make alterable values on all your guns for whatever you need (clip size, max ammo, current ammo, max ammo, damage, level...) Now when you create your gun you just have to add to that event

-set level to random(x)-y

and then set the other alterable values before you play the game (in mmf2/tgf2, not the application)

Next for the two strings you want to make the paragraphs on prefix all of your prefixes and the paragraphs for your names all the names. Now when your gun is created simple add to the event

-set position of string 1 to (x, y) and of string 2 to (w, z)
-set paragraph of string 1 to random(# of prefixes - 1)+1
-set paragraph of string 2 to random # of names - 1)+1

okay. Now for the inis. These are what you will use to save your guns level and stuff. (even in between exits / opens)

you need to categorize the ini like this

[shotgun]
level: x
damage: y
current ammo: z

[submachine gun]
level: a
damage: b
current ammo: c

etc. The basic idea is
[category]
value name: value

so you need to code this so that it works. first make allthe categories and stuff by editing something in notepad and saving it as <name>.ini and code

always
-set (in ini) subby ammo to alt value ammo of your gun.

I honestly hope that this makes even a bit of sense to anyone but me...

 
If you put a million monkeys at a million keyboards, one of them will eventually write a Java program.
The rest of them will write Perl programs.

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
16th November, 2010 at 01:11:56 -

It makes sense to a degree, as i said, ive never used ini's, this would be my first time so it aught to be interesting. im sure i can figure something out after enough trial and error using the info you provided.

so from what i understand ini files kinda work in categories, so i would put all the shotgun titles in one category called Shotguns and do the same for all the other types of guns as well correct? now can i do a category, and sub category as well? that way i could incorporate the gun companies as well? such as...
Earth (company)
Shotguns
(shotgun titles)
Pistols
(Pistol titles)
etc.



 
[Game design makes my brain feel like its gonna explode.]

monkeytherat

Hero of Time Jr

Registered
  07/11/2010
Points
  1293

VIP MemberI donated an open source project
16th November, 2010 at 01:17:57 -

I don't think so, but I've never tried... If you get confused on something or anything I say turns out to be wrong, there is a great tutorial on inis here: http://www.clickteam.com/website/usa/img/uploads/tutorials/download/ini_tutorial.pdf

 
If you put a million monkeys at a million keyboards, one of them will eventually write a Java program.
The rest of them will write Perl programs.

7Soul



Registered
  12/08/2008
Points
  167
16th November, 2010 at 01:23:04 -

You don't need 2 strings, have just 1 and set it to "suffix"+" "+"weapon name"

For weapon stats, you could use an array object. You make it so every time the player gets a new weapon, its values are stored on the ini, like this:

X/Y 1 2 3 4 5 6
1

where Y1 is the animation number, Y2 is the suffix ID (stored on the INI), Y3 is the prefix (also on the INI), etc

If you don't know how to use arrays and INIs, i sujest you look up for some tutorials, knowing how to use them is really important when making a game that has many items/weapons

 
n/a

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
16th November, 2010 at 01:32:06 -

Im beginning to see that. prior to this project ive just made simple sidescrollers but this is far more advanced. ill try everything you guys have said. im sure ill figure it out eventually. thanks for the help guys!

 
[Game design makes my brain feel like its gonna explode.]
   

Post Reply



 



Advertisement

Worth A Click