x


[Closed] Money System Please Help!

Hey i would really like to make a weapon system for my FPS RPG (like fallout 3 or Borderlands) anyway i would like so when you kill an enemy they drop money and then you can pick up the money and use it to buy stuff. So can anyone tell me what to do to make the money fall from dead enemies and let the player pick it up and then how to make a store with weapons that you can buy?

more ▼

asked Aug 28, 2010 at 04:45 AM

Ben Palladino gravatar image

Ben Palladino
1 3 2 2

In other words: "Write my game for me!" At least take a stab at learning to script and then if you get stuck on some code people here will help. Try the Lerpz tutorial for starters

Aug 28, 2010 at 05:02 AM Julian Glenn

var money : int; there you go

Aug 28, 2010 at 01:57 PM spinaljack

nay nay - var money : float. So all the micro transactions register 0.00101

Aug 28, 2010 at 07:23 PM OrientalTaste
(comments are locked)
10|3000 characters needed characters left

The question has been closed Apr 24, 2013 at 04:08 AM by Loius for the following reason:

Not appropriate for Answers.


4 answers: sort voted first

If you really want this, you may need to work for it. This tutorials are not showing you exactly how to make a "Money and inventory" system but I think this 29 tutorials are proberly all the help you need to make a inventory system/Money system.

TornadoTwins explains a little of everything about Unity 3D and offers a great insight in scripting. And when you watch all of hes tutorials you will proberly have 99.9 % of what you need to make a system like this. Though a little logical thinking may be needed but dont worry about that ;) I am sure you will have what it takes!

TornadoTwins

Good luck :)

more ▼

answered Jan 26, 2011 at 06:11 PM

OrangeLightning gravatar image

OrangeLightning
6.6k 127 126 175

(comments are locked)
10|3000 characters needed characters left

Dear Ben, I am not going to write your code (because that would not help you), but I will try to get you started... I haven't tested this code, but it is how I would start going about writing it... You will need another script to call the function "Dammage" (by using SendMessage) and you will need to add a lot more, but (I think) this is a start... If anybody else want to edit this (if you see something wrong, or something) feel free to... I Wish You Luck!

var living : boolean; var ammountToDrop : float = 10.5; var health : int = 100; var player : GameObject;

private var damageTaken : int = 0;

function Damage () { if(living = true && damageTaken <= health) { print("Alive And Well"); } else {

Destroy.gameObject; player += ammountToDrop;

}

}

more ▼

answered Jan 26, 2011 at 04:34 PM

AVividLight gravatar image

AVividLight
2.2k 209 143 197

(comments are locked)
10|3000 characters needed characters left

As Spinaljack said, add var money : int; to your player's controls, then add some code onto the enemies that adds money to the player's total when the enemy dies(Because taking the time to pick up all the money would become tedious fast).

As for making a store, all you have to do is come up with your inventory system, then subtract money from your player script when they buy and add the item to their inventory, unless they don't have enough, in which case you can embarrass your players by coming up with clever insults for the shopkeeper to say. Or convince yourself to go above and beyond and come up with a shoplifting system. It'd take quite a bit of effort to do so, however, and you seem inclined to avoid the effort.

more ▼

answered Dec 22, 2010 at 02:56 PM

Christopher K. gravatar image

Christopher K.
44 22 20 29

(comments are locked)
10|3000 characters needed characters left

without drop money and pickup that i can help you

 var money : int = 1000//amout of your money

 var moneyText : GUIText;//To Display Your money


 function Update()
 {
  
  if(money < 0)
  {
   money = 0;
 
  }
 
 }



and For Your Enemy

 var curHealth : int = 100;
 
 var maxHealth : int = 100;
 
 function Update()
 {
  if(curHealth > maxHealth)
  {
   curHealth = maxHealth;
  }
 
  if(curHealth < 0 )
  {
   curHealth = 0;
   
   moneySystem.money += 100;//name of your script moneySystem
  }
 
 }
more ▼

answered Apr 24, 2013 at 04:04 AM

Boeing® gravatar image

Boeing®
0 1 5 6

(comments are locked)
10|3000 characters needed characters left

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x352
x235
x173
x10

asked: Aug 28, 2010 at 04:45 AM

Seen: 4590 times

Last Updated: Apr 24, 2013 at 04:04 AM