Quote: "Why is there a -1 in the parenthesis"
No need for the -1, my mistake
Quote: "
For i=0 to 10
addItemToInventory( rnd(2)+1 , rnd(10) )
Next i
"
The rnd(10) is the amount of items you want to add to the inventory.
The rnd(2)+1 is the item you want to add.
The itemID is the place in the blueprint array where the weapon data is located
So using a 1 for the itemID will add the longsword, 2 will add the bow and 3 the dagger.
In the function I first loop through the inventory to check if the item is already in the inventory,
if it already is there we increase the current count of the item and exit the function.
if it isn't there we will insert a new item at the bottom of the array.
Function addItemToInventory( itemID as integer , count as integer )
For i=0 to array count( playerInventory(-1) )
if playerInventory(i).id = itemID
inc playerInventory(i).count, count
exitfunction
endif
Next i
array insert at bottom playerInventory()
playerInventory().count = count
playerInventory().id = itemID
endFunction
If you don't get the itemID's then take a close look at this part:
for i=0 to array count( playerInventory() )
id = playerInventory(i).id ` take the id of the weapon from the inventory
print " ",playerInventory(i).count,"x"
print " name: ",BluePrint(id).name$
print " damage: ",BluePrint(id).damage#
print " weight: ",BluePrint(id).weight#
print ""
next i
Quote: "
Do I even need the WeaponID var that I made
"
Nope, actually.. you only need my code