Computer Science Canada RPG Armor/Weapon System |
Author: | Archi [ Sun Jun 22, 2003 5:32 pm ] |
Post subject: | RPG Armor/Weapon System |
In the rpg that i'm making, I'm planning on creating a Workshop where you can combine two of your armor or two of your weapons together to create a better weapon. What would be the easiest way to check what equipment i have equipped and in my "inventory"? |
Author: | Homer_simpson [ Sun Jun 22, 2003 5:38 pm ] | ||
Post subject: | |||
object oriented programming... using records,classes,arrays for your inventory... here's a lil example:
see how much easier it is to do it in OOP!!! |
Author: | Archi [ Sun Jun 22, 2003 5:42 pm ] |
Post subject: | |
that makes sense...except for the viking axe shouldn't it technically be inventory (2)? Also how would i go about doing it for 3 diff characters that use 3 diff weapons?? and also have it check for the weapons in the workshop procedure? |
Author: | Homer_simpson [ Sun Jun 22, 2003 6:08 pm ] | ||
Post subject: | |||
oops yeah it should be 2 for viking axe... Quote: Also how would i go about doing it for 3 diff characters that use 3 diff weapons??
well you can have each player as an object like this:
|
Author: | Archi [ Sun Jun 22, 2003 6:53 pm ] |
Post subject: | |
I'll work on that...now, another question with regards to this..The damage bonus of my weapons are determined by my formula: dmb=lvlrequired+(rmlv+lvl)/.25lvl Where RMLV is a random # between lvr and lvr+lvl So how could I make that work? This is what I got so far but it says that it is a mistake or assigned the wrong value. var rmlv : int randomize var lvl : int := 1 randint (rmlv, 1, 1 + lvl) type weapon : record name : string lvr : int dmb : int end record var inventory : array 1 .. 10 of weapon %now you can input what ever u want to inventory like this : inventory (1).name := "dwarf battle sword" inventory (1).lvr := 1 inventory (1).dmb := inventory (1).lvr + (rmlv + lvl) / .25 * lvl |
Author: | PaddyLong [ Sun Jun 22, 2003 6:57 pm ] |
Post subject: | |
you're getting that error because inventory (1).dmb is an int... but you have a real value (.25) in your equation if you make your equation this... inventory (1).dmb := inventory (1).lvr + round ((rmlv + lvl) / 0.25) * lvl it should work (by adding in the round you are turning what used to be a real value into an integer) |
Author: | Archi [ Sun Jun 22, 2003 7:03 pm ] |
Post subject: | |
did that but its giving me this error: Assigned value is the wrong type for this part of my formula: inventory (1).dmb := inventory (1).lvr + round (rmlv + lvl) / (.25 * lvl) |
Author: | AsianSensation [ Sun Jun 22, 2003 7:58 pm ] |
Post subject: | |
Archi wrote: inventory (1).dmb := inventory (1).lvr + round (rmlv + lvl) / (.25 * lvl) that part, when you use the "/" sign, you get a real number, so use div, or have your round somewhere else. |
Author: | Archi [ Sun Jun 22, 2003 9:51 pm ] |
Post subject: | |
Thanks, now i need to figure out how to really make the workshop work properly. I need someway to check which weapon/armor they have equipped and which they have in their inventory. And use a formula to make the new weapons damage bonus and also rename the current weapon/armor depending on which weapons/armor were combined...You guys have any suggestions? |
Author: | Andy [ Mon Jun 23, 2003 3:39 pm ] |
Post subject: | |
have an array for the weapons and armor var array 1..100 of weapon where weapon is homer's type and is it me or did anyone else notice that we're doing his entire weapon system for him... |