
-----------------------------------
Archi
Sun Jun 22, 2003 5:32 pm

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"?

-----------------------------------
Homer_simpson
Sun Jun 22, 2003 5:38 pm


-----------------------------------
object oriented programming... using records,classes,arrays for your inventory... 
here's a lil example:

type weapon :
    record
        name : string
        kind : string
        power : int
        speed : 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).kind:="sword"
inventory(1).power:=100
inventory(1).speed:=200

inventory(1).name:="Viking Axe"
inventory(1).kind:="axe"
inventory(1).power:=500
inventory(1).speed:=100
see how much easier it is to do it in OOP!!!

-----------------------------------
Archi
Sun Jun 22, 2003 5:42 pm


-----------------------------------
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?

-----------------------------------
Homer_simpson
Sun Jun 22, 2003 6:08 pm


-----------------------------------
oops yeah it should be 2 for viking axe...



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:

type weapon :
    record
        name : string
        kind : string
        power : int
        speed : int
    end record

type player :
    record
        inventory : array 1 .. 10 of weapon
        race,name : string
        health, mana, level, experience : int
    end record

%now let's declare 3 players
var player1, player2, player3 : player
%now you can input what ever u want to inventory like this :
player1.health:=100
player1.race:="Dumbass"
player1.name:="Homer Simpson"
player1.inventory (1).name := "dwarf battle sword"
player1.inventory (1).kind := "sword"
player1.inventory (1).power := 100
player1.inventory (1).speed := 200


player2.health:=100
player2.race:="Human"
player2.name:="Tony"
player2.inventory (1).name := "Viking AXE"
player2.inventory (1).kind := "AXE"
player2.inventory (1).power := 1000
player2.inventory (1).speed := 100
player2.inventory (2).name := "small AXE"
player2.inventory (2).kind := "AXE"
player2.inventory (2).power := 50
player2.inventory (2).speed := 400

player2.health:=100
player2.race:="elf"
player2.name:="some name"
player2.inventory (1).name := "dwarf hammer"
player2.inventory (1).kind := "hammer"
player2.inventory (1).power := 2000
player2.inventory (1).speed := 100




-----------------------------------
Archi
Sun Jun 22, 2003 6:53 pm


-----------------------------------
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

-----------------------------------
PaddyLong
Sun Jun 22, 2003 6:57 pm


-----------------------------------
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)

-----------------------------------
Archi
Sun Jun 22, 2003 7:03 pm


-----------------------------------
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)

-----------------------------------
AsianSensation
Sun Jun 22, 2003 7:58 pm


-----------------------------------


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.

-----------------------------------
Archi
Sun Jun 22, 2003 9:51 pm


-----------------------------------
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?

-----------------------------------
Andy
Mon Jun 23, 2003 3:39 pm


-----------------------------------
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...
