bbBank does not exist?

Blitz3D Forums/Blitz3D Beginners Area/bbBank does not exist?

I'm working on an RPG with skills. Each skill gets upto 3 missles that it will shoot when it is cast. Each missle has upto 3 Damage Types (physical, heat, ect). Well, the missle itself has a total damage it will do, and each type gets a percent of that damage when it hits. Well, when I try to create a missle type and set it's bank up, it tells me that the bank doesn't exist! I've been working a couple hours on fixing this, so I decided to come here. Thanks for any help.
My code:

Type Missle
	Field DmgPercent%,Dmg#
	Field DmgValues;bank of types and Percents
	Field Range,Speed;speed of 0 = laser
	Field Eff1.Effect,Eff2.Effect,Eff3.Effect
	Field Image3D,ImageImpact,mpitch,myaw
	Field Parent.Skill
	Field MOrigin.Point
End Type

Function CreateMissleClass.Missle(Dmg%,BankValues,rng#,Sp#);,Img3d,ImgHit,pitch,yaw,Parent.Skill)
	msl.Missle=New Missle
	msl\DmgPercent%=Dmg%
	For c=0 To 5
		PokeByte msl\DmgValues,c,PeekByte(BankValues,c)
	Next
	msl\Range=rng
	msl\speed=sp
	Return msl
	Delete msl
End Function

;Returns a bank with a Damage Type followed by a percent in it
Function CreateTypePercentsBank(a%,b%,c%,d%,e%,f%)
	Local finish = CreateBank(6)
	Local Numb%=1
	If a>0 And a<9 Then
		PokeByte finish,0,a
	EndIf
	If b>0 Then
		PokeByte finish,1,b
	EndIf
	If c>0 And c<9 Then
		PokeByte finish,2,c
	EndIf
	If d>0 Then
		PokeByte finish,3,d
	EndIf
	If e>0 And e<9 Then
		PokeByte finish,4,e
	EndIf
	If f>0 And f<9 Then
		PokeByte finish,5,f
	EndIf
	If (PeekByte(finish,1)+PeekByte(finish,3)+PeekByte(finish,5))<>100 Then
		Repeat
			PokeByte finish,Numb,(PeekByte(finish,Numb)+1)
			If Numb<4 Then Numb=Numb+2 Else Numb=1
		Until (PeekByte(finish,1)+PeekByte(finish,3)+PeekByte(finish,5))=100
	EndIf
	Return finish
	FreeBank finish
End Function

Global BombMsl1.Missle=CreateMissleClass(100,CreateTypePercentsBank(Type_Heat,88,Type_Phy,12,Type_None,0),8,5)



P.S. How do you get that cool little scroll box to put code in? That would be useful =o)




(codebox)
(/codebox)
but of course, with square brackets.

_________________________________________


As for your main question...

Sorry, Not used banks!

msl.Missle=New Missle
msl\DmgPercent%=Dmg%
For c=0 To 5
PokeByte msl\DmgValues,c,PeekByte(BankValues,c)
Next

msl\DmgValues is 0. you have to make it a bank

Confusion sets in... Where does it say that DmgValues=0?

.

You end your CreateTypePercentsBank(a%,b%,c%,d%,e%,f%)
function with Free Bank, and then you return a emty bank pointer in the same function..

Free bank finish
Return finish

Sorry, did't look at it to good.
You did Return finish first before freeing it.