ID:174254
 
Hello!

I am trying to make a game, where, after buying the seperate peices, you can fit 4 peices together to make a Beyblade. If you do not know what this is, it doesn't matter whether you think it an item or a weapon. That's not the point. :P

What I am getting at is this:

My buying code is this :

mob
Shop1
name = "Beyblade Shopkeeper"
icon = 'Mobs.dmi'
icon_state = "SK1"
Click()
usr<<"Welcome to my shop!"
switch(input("What would you like to buy?","Beyblade Shopkeeper",text) in list ("Full Beyblades","Attack Rings","Weight Rings","Bases"))
if("Full Beyblades")
if(usr.Cash>=600)
switch(input("What would you like to buy? (Everything listed here costs 600)","Beyblade Shopkeeper",text) in list ("Baku-shin-oh","Roller Attacker","Dragoon S","Raziel","None"))
if("Baku-shin-oh")
usr<<"You bought Baku-shin-oh!!!"
usr.Cash -= 600
usr.AttackRings.Add("Baku-shin-oh")
usr.WeightRings.Add("Baku-shin-oh")
usr.Bases.Add("Baku-shin-oh")
if("Roller Attacker")
usr<<"You bought Roller Attacker!!!"
usr.Cash -= 600
usr.AttackRings.Add("Roller Attacker")
usr.WeightRings.Add("Roller Attacker")
usr.Bases.Add("Roller Attacker")
if("Dragoon S")
usr<<"You bought Dragoon S!!!"
usr.Cash -= 600
usr.AttackRings.Add("Dragoon S")
usr.WeightRings.Add("Dragoon S")
usr.Bases.Add("Dragoon S")
if("Razeil")
usr<<"You bought Razeil!!!"
usr.Cash -= 600
usr.AttackRings.Add("Razeil")
usr.WeightRings.Add("Razeil")
usr.Bases.Add("Razeil")
if("None")
usr<<"You bought nothing!"
else
usr<<"You need 600 cash!"


This works fine, and they get the thing added to their list. Then to let them put it on their Beyblade I put :

mob
verb
CustomAttackRing(attack as null|anything in src.AttackRings)
//Lets them customize their Beyblade
set name = "Customize your Beyblade Attack Ring"
switch("attack")
if("Baku-shin-oh")
for(var/obj/Beyblade/Custom/Attack/A in src.contents)
if(A.name != "N/A")
src.AttackRings += A.name
src.AttackRings.Remove("Baku-shin-oh")
src.AttackRing = "Baku-shin-oh"
A.name = "Baku-shin-oh"
A.Att = 6
A.Def = 4
A.End = 2
if("Roller Attacker")
for(var/obj/Beyblade/Custom/Attack/A in src.contents)
if(A.name != "N/A")
src.AttackRings += A.name
src.AttackRings.Remove("Roller Attacker")
src.AttackRing = "Roller Attacker"
A.name = "Roller Attacker"
A.Att = 2
A.Def = 4
A.End = 4
if("Razeil")
for(var/obj/Beyblade/Custom/Attack/A in src.contents)
if(A.name != "N/A")
src.AttackRings += A.name
src.AttackRings.Remove("Razeil")
src.AttackRing = "Razeil"
A.name = "Razeil"
A.Att = 3
A.Def = 3
A.End = 1
if("DragoonS")
for(var/obj/Beyblade/Custom/Attack/A in src.contents)
if(A.name != "N/A")
src.AttackRings += A.name
src.AttackRings.Remove("DragoonS")
src.AttackRing = "DragoonS"
A.name = "DragoonS"
A.Att = 4
A.Def = 1
A.End = 3
CustomWeightDisk(weight as null|anything in src.WeightRings)
//Lets them customize their Beyblade
set name = "Customize your Beyblade Weight Disk"
switch("weight")
if("Baku-shin-oh")
for(var/obj/Beyblade/Custom/Weight/W in src.contents)
if(W.name != "N/A")
src.WeightRings += W.name
src.WeightRings.Remove("Baku-shin-oh")
src.WeightRing = "Baku-shin-oh"
W.name = "Baku-shin-oh"
W.Att = 2
W.Def = 1
W.End = 3
if("Roller Attacker")
for(var/obj/Beyblade/Custom/Weight/W in src.contents)
if(W.name != "N/A")
src.WeightRings += W.name
src.WeightRings.Remove("Roller Attacker")
src.WeightRing = "Roller Attacker"
W.name = "Roller Attacker"
W.Att = 1
W.Def = 3
W.End = 2
if("Razeil")
for(var/obj/Beyblade/Custom/Weight/W in src.contents)
if(W.name != "N/A")
src.WeightRings += W.name
src.WeightRings.Remove("Razeil")
src.WeightRing = "Razeil"
W.name = "Razeil"
W.Att = 3
W.Def = 3
W.End = 5
if("DragoonS")
for(var/obj/Beyblade/Custom/Weight/W in src.contents)
if(W.name != "N/A")
src.WeightRings += W.name
src.WeightRings.Remove("DragoonS")
src.WeightRing = "DragoonS"
W.name = "DragoonS"
W.Att = 1
W.Def = 4
W.End = 7
CustomBase(base as null|anything in src.Bases)
//Lets them customize their Beyblade
set name = "Customize your Beyblade Base"
switch("base")
if("Baku-shin-oh")
for(var/obj/Beyblade/Custom/Base/B in src.contents)
if(B.name != "N/A")
src.Bases += B.name
src.Bases.Remove("Baku-shin-oh")
src.Base = "Baku-shin-oh"
B.name = "Baku-shin-oh"
B.Att = 2
B.Def = 1
B.End = 3
if("Roller Attacker")
for(var/obj/Beyblade/Custom/Base/B in src.contents)
if(B.name != "N/A")
src.Bases += B.name
src.Bases.Remove("Roller Attacker")
src.Base = "Roller Attacker"
B.name = "Roller Attacker"
B.Att = 1
B.Def = 3
B.End = 2
if("Razeil")
for(var/obj/Beyblade/Custom/Base/B in src.contents)
if(B.name != "N/A")
src.Bases += B.name
src.Bases.Remove("Razeil")
src.Base = "Razeil"
B.name = "Razeil"
B.Att = 3
B.Def = 3
B.End = 5
if("DragoonS")
for(var/obj/Beyblade/Custom/Base/B in src.contents)
if(B.name != "N/A")
src.Bases += B.name
src.Bases.Remove("DragoonS")
src.Base = "DragoonS"
B.name = "DragoonS"
B.Att = 1
B.Def = 4
B.End = 7


Which is AMAZINGLY lengthy as you can see, and doesn't actually work! It doesn't remove the thing from the list, or add it to the var.

I have objects for the 4 things, which define their vars:

obj
Beyblade
Razeil
Weight
Att = 3
Def = 3
End = 5
Attack
Att = 3
Def = 3
End = 1
Base
Att = 1
Def = 4
End = 6
Bakushinoh
Weight
Att = 2
Def = 1
End = 3
Attack
Att = 6
Def = 4
End = 2
Base
Att = 4
Def = 2
End = 3
RollerAttacker
Weight
Att = 1
Def = 3
End = 2
Attack
Att = 2
Def = 4
End = 4
Base
Att = 4
Def = 2
End = 3
DragoonS
Weight
Att = 1
Def = 4
End = 7
Attack
Att = 4
Def = 1
End = 3
Base
Att = 6
Def = 3
End = 1


And I was thinking, that there MUST be a shorter way of doing what I did, and making it work.

Later in the game, (which I haven't coded yet) MANY things, will depend on the Customized Beyblades vars, so I need something that works, and I kinda need it soon.

If you need anymore code, to help me, I will be happy to give it!

Sorry for taking up all your time, but hopefully this will be a decent game, and we will have one more small step against the DBZ Rips :P

~GokuSS4Neo~
I am sorry that I have nothing to pay you with, because I have no BYONDimes and I am very broke. However I really need help on this one, I have spent 3 days (school days :P) thinking on this non-stop, which I am sure is affecting the quality of my work, and homework.
I need this so bad, that if you help me, and the code you give me REALLY helps, I will give you GM powers, and I will ask for a forward on my allowance so that I can pay you over PayPal (probably only about $1, because my allowence has already been forwarded to January).

Please, any help would be more than gratefully accepted!

~GokuSS4Neo~
You didn't really explain what "the list" and "the var" actually are, or what you're trying to add to them. Following your code is a bit difficult because not only is it very long with a great deal of redundant code, but some of the lines are so long that the post scrolls way over to the right (and consequently, your text doesn't wrap in a convenient way).

Maybe if you could be clearer on what you're actually trying to do here, and also trim down the horizontal length a bit, it'd help.

Lummox JR
In response to Lummox JR
I suppose I did it in a very odd way, but it was the only way I could think of.

What I am trying to do, is have an object, called a Beyblade.

You can only use it if you have all 4 peices. A top, middle, middle bottom, bottom. But there are different types of each of the 4 peices. So you can customise it a lot!

I want it so that you can buy peices, or full beyblades from the shop. And customize your one, with some spare peices that are accesable for you to swap around.

Think of it as a customized computer. You can only choose : the screen, ram, hard-drive, and CDRW (for example). Off course there are many different types of each of these, and without anyone of them (except the CDRW, but i need that for the example) you can't use the computer!

Does that make it a bit clearer?

~GokuSS4Neo~

P.s. Thank you for any help!!!

In response to Gokuss4neo
Well that's definitely clearer on your overall goal, but which list and var were you talking about?

Lummox JR
In response to Lummox JR
I must have been sleepy when I wrote than or something :P The "var" i was talking about is the object of their custom Beyblade (which everyone recieves on login)
And the list is their contents.

...VERY SLEEPY!

~GokuSS4Neo~
In response to Gokuss4neo
Hrm. On reviewing your code, I notice errors like this throughout:
switch("base")
There shouldn't be quotes around the var name. This thinks you're using the literal string "base", meaning that only if("base") would respond.

There are similar errors with other vars in switches.

Lummox JR
In response to Lummox JR
Even after correcting these my code doesn't work!

(Also, on later discovery there WAS a var...well actually 4:
AttackRing
WeightRing
Bases
Bitbeast)

~GokuSS4Neo~

P.s. The CDRW in the old example, CAN be optional, as Bit beast can be optional in this!
In response to Gokuss4neo
*Cough* I really need this, and any additional help would be greatly appreciated!

~GokuSS4Neo~

P.s. Thank you Lummox for your help so far!
In response to Gokuss4neo
Gokuss4neo wrote:
*Cough* I really need this, and any additional help would be greatly appreciated!

I think posting the updated code at some point would have helped. When you post, it'll be good if you can restate the problem. It bugs me to have to search a thread for context so I can pick it up again after a while.

Lummox JR
In response to Gokuss4neo
I say keep the code and make it work. Then put it in it's own DM file so it doesn't get tangled in your other code making it hard to read. As long as it works, you can optimize it later. When I get more time I'll work on it.
In response to Lummox JR
Yeh, sorry about that, I understand exactly what you mean!

Okay! Here's the sitch : I have made several objs, under ... I guess you call them categories.

Attack Rings
Weight Disks
Bases
Bit Beast

To make a useable item, you need to have 1 of each of the above, with an optional Bit Beast, however, you could have 1 Blue Attack Ring, 1 Red Base, and 1 Green Weight Disk, OR all Green, e.t.c. So they are fully customizable. Also each obj has its own vars : Atk, Def, End which all add up to make the Beyblades vars.

I had NO clue how to do this so I put together this :

(After small modifications with help from Lummox)

//The Shop you buy the parts from:

mob
Shop1
name = "Beyblade Shopkeeper"
icon = 'Mobs.dmi'
icon_state = "SK1"
Click()
usr<<"Welcome to my shop!"
switch(input("What would you like to buy?","Beyblade Shopkeeper",text) in list ("Full Beyblades","Attack Rings","Weight Rings","Bases"))
if("Full Beyblades")
if(usr.Cash>=600)
switch(input("What would you like to buy? (Everything listed here costs 600)","Beyblade Shopkeeper",text) in list ("Baku-shin-oh","Roller Attacker","Dragoon S","Raziel","None"))
if("Baku-shin-oh")
usr<<"You bought Baku-shin-oh!!!"
usr.Cash -= 600
usr.AttackRings.Add("Baku-shin-oh")
usr.WeightRings.Add("Baku-shin-oh")
usr.Bases.Add("Baku-shin-oh")
if("Roller Attacker")
usr<<"You bought Roller Attacker!!!"
usr.Cash -= 600
usr.AttackRings.Add("Roller Attacker")
usr.WeightRings.Add("Roller Attacker")
usr.Bases.Add("Roller Attacker")
if("Dragoon S")
usr<<"You bought Dragoon S!!!"
usr.Cash -= 600
usr.AttackRings.Add("Dragoon S")
usr.WeightRings.Add("Dragoon S")
usr.Bases.Add("Dragoon S")
if("Razeil")
usr<<"You bought Razeil!!!"
usr.Cash -= 600
usr.AttackRings.Add("Razeil")
usr.WeightRings.Add("Razeil")
usr.Bases.Add("Razeil")
if("None")
usr<<"You bought nothing!"
else
usr<<"You need 600 cash!"

//The stat panel for the user :

mob
Player
Stat()
statpanel("Stats")
stat("Name : ",Name)
stat("Money : ¥",Cash)
statpanel("Beyblade spare parts")
stat("Attack Rings")
stat(AttackRings)
stat("")
stat("")
stat("Weight Disks")
stat(WeightRings)
stat("")
stat("")
stat("Bases")
stat(Bases)
stat("")
stat("")
stat("Bitbeasts")
stat(Bitbeasts)
statpanel("Beyblade parts")
stat("Attack Rings : [AttackRing]")
stat("Weight Disks : [WeightRing]")
stat("Bases : [Base]")
stat("Bitbeasts : [Bitbeast]")

//The player stuff :

mob
Player
icon = 'Mobs.dmi'
icon_state = "Player"
move = 1
HasBeyblade = 0
var
openmenu
move
LaunchedBeyblade
Launched
HasBeyblade
Cash
Name
saved
BBAtt
BBDef
BBEnd
AttackRing
WeightRing
Base
Bitbeast
list/AttackRings = list()
list/WeightRings = list()
list/Bases = list()
list/Bitbeasts = list()
Move() // Move proc
if(move) // If the move var is 1...
..() // Continue process
else // If its not 1...
return

//And the Beyblade parts vars, and customized code :

obj
var
Att
Def
End
obj
Beyblade
Custom
Weight
name = "N/A"
Att = 0
Def = 0
End = 0
Attack
name = "N/A"
Att = 0
Def = 0
End = 0
Base
name = "N/A"
Att = 0
Def = 0
End = 0
Bitbeast
name = "N/A"
Att = 0
Def = 0
End = 0
mob
proc
BeybladeCheck()
//To check if they have a full beyblade
for(var/obj/Beyblade/Custom/Weight/W in src.contents)
if(W)
if(W.name != "N/A")
for(var/obj/Beyblade/Custom/Attack/A in src.contents)
if(A)
if(A.name != "N/A")
for(var/obj/Beyblade/Custom/Base/B in src.contents)
if(B)
if(B.name != "N/A")
usr.HasBeyblade = 1
src<<"You have a complete Beyblade!"
else
src<<"You have no Base!"
src.HasBeyblade = 0
else
src<<"You have no Base!"
src.HasBeyblade = 0
else
src<<"You have no Attack Ring!"
src.HasBeyblade = 0
else
src<<"You have no Attack Ring!"
src.HasBeyblade = 0
else
src<<"You have no Weight Disk!"
src.HasBeyblade = 0
else
src<<"You have no Weight Disk!"
src.HasBeyblade = 0
if(src.HasBeyblade == 0)
src<<"You do not have a complete Beyblade!"
BeybladeStatCheck()
//This is to work out the stats of your beyblade!
BeybladeCheck()//Do this now to make sure they have a full beyblade
if(src.HasBeyblade)
for(var/obj/Beyblade/Custom/Weight/W in src.contents)
src.BBAtt += W.Att
src.BBDef += W.Def
src.BBEnd += W.End
for(var/obj/Beyblade/Custom/Base/B in src.contents)
src.BBAtt += B.Att
src.BBDef += B.Def
src.BBEnd += B.End
for(var/obj/Beyblade/Custom/Attack/A in src.contents)
src.BBAtt += A.Att
src.BBDef += A.Def
src.BBEnd += A.End
src<<"<U>You Beyblades Stats:</U>"
src<<"Attack = [BBAtt]"
src<<"Defence = [BBDef]"
src<<"Endurance = [BBEnd]"
else
src<<"You do not have a complete Beyblade!"
verb
CustomAttackRing(attack as null|anything in src.AttackRings)
//Lets them customize their Beyblade
set name = "Customize your Beyblade Attack Ring"
switch(attack)
if("Baku-shin-oh")
for(var/obj/Beyblade/Custom/Attack/A in src.contents)
if(A.name != "N/A")
src.AttackRings += A.name
src.AttackRings.Remove("Baku-shin-oh")
src.AttackRing = "Baku-shin-oh"
A.name = "Baku-shin-oh"
A.Att = 6
A.Def = 4
A.End = 2
if("Roller Attacker")
for(var/obj/Beyblade/Custom/Attack/A in src.contents)
if(A.name != "N/A")
src.AttackRings += A.name
src.AttackRings.Remove("Roller Attacker")
src.AttackRing = "Roller Attacker"
A.name = "Roller Attacker"
A.Att = 2
A.Def = 4
A.End = 4
if("Razeil")
for(var/obj/Beyblade/Custom/Attack/A in src.contents)
if(A.name != "N/A")
src.AttackRings += A.name
src.AttackRings.Remove("Razeil")
src.AttackRing = "Razeil"
A.name = "Razeil"
A.Att = 3
A.Def = 3
A.End = 1
if("DragoonS")
for(var/obj/Beyblade/Custom/Attack/A in src.contents)
if(A.name != "N/A")
src.AttackRings += A.name
src.AttackRings.Remove("DragoonS")
src.AttackRing = "DragoonS"
A.name = "DragoonS"
A.Att = 4
A.Def = 1
A.End = 3
CustomWeightDisk(weight as null|anything in src.WeightRings)
//Lets them customize their Beyblade
set name = "Customize your Beyblade Weight Disk"
switch(weight)
if("Baku-shin-oh")
for(var/obj/Beyblade/Custom/Weight/W in src.contents)
if(W.name != "N/A")
src.WeightRings += W.name
src.WeightRings.Remove("Baku-shin-oh")
src.WeightRing = "Baku-shin-oh"
W.name = "Baku-shin-oh"
W.Att = 2
W.Def = 1
W.End = 3
if("Roller Attacker")
for(var/obj/Beyblade/Custom/Weight/W in src.contents)
if(W.name != "N/A")
src.WeightRings += W.name
src.WeightRings.Remove("Roller Attacker")
src.WeightRing = "Roller Attacker"
W.name = "Roller Attacker"
W.Att = 1
W.Def = 3
W.End = 2
if("Razeil")
for(var/obj/Beyblade/Custom/Weight/W in src.contents)
if(W.name != "N/A")
src.WeightRings += W.name
src.WeightRings.Remove("Razeil")
src.WeightRing = "Razeil"
W.name = "Razeil"
W.Att = 3
W.Def = 3
W.End = 5
if("DragoonS")
for(var/obj/Beyblade/Custom/Weight/W in src.contents)
if(W.name != "N/A")
src.WeightRings += W.name
src.WeightRings.Remove("DragoonS")
src.WeightRing = "DragoonS"
W.name = "DragoonS"
W.Att = 1
W.Def = 4
W.End = 7
CustomBase(base as null|anything in src.Bases)
//Lets them customize their Beyblade
set name = "Customize your Beyblade Base"
switch(base)
if("Baku-shin-oh")
for(var/obj/Beyblade/Custom/Base/B in src.contents)
if(B.name != "N/A")
src.Bases += B.name
src.Bases.Remove("Baku-shin-oh")
src.Base = "Baku-shin-oh"
B.name = "Baku-shin-oh"
B.Att = 2
B.Def = 1
B.End = 3
if("Roller Attacker")
for(var/obj/Beyblade/Custom/Base/B in src.contents)
if(B.name != "N/A")
src.Bases += B.name
src.Bases.Remove("Roller Attacker")
src.Base = "Roller Attacker"
B.name = "Roller Attacker"
B.Att = 1
B.Def = 3
B.End = 2
if("Razeil")
for(var/obj/Beyblade/Custom/Base/B in src.contents)
if(B.name != "N/A")
src.Bases += B.name
src.Bases.Remove("Razeil")
src.Base = "Razeil"
B.name = "Razeil"
B.Att = 3
B.Def = 3
B.End = 5
if("DragoonS")
for(var/obj/Beyblade/Custom/Base/B in src.contents)
if(B.name != "N/A")
src.Bases += B.name
src.Bases.Remove("DragoonS")
src.Base = "DragoonS"
B.name = "DragoonS"
B.Att = 1
B.Def = 4
B.End = 7
obj
Beyblade
Razeil
Weight
Att = 3
Def = 3
End = 5
Attack
Att = 3
Def = 3
End = 1
Base
Att = 1
Def = 4
End = 6
Bakushinoh
Weight
Att = 2
Def = 1
End = 3
Attack
Att = 6
Def = 4
End = 2
Base
Att = 4
Def = 2
End = 3
RollerAttacker
Weight
Att = 1
Def = 3
End = 2
Attack
Att = 2
Def = 4
End = 4
Base
Att = 4
Def = 2
End = 3
DragoonS
Weight
Att = 1
Def = 4
End = 7
Attack
Att = 4
Def = 1
End = 3
Base
Att = 6
Def = 3
End = 1

//And a part of the login that might affect it:

Load()
if(usr.saved)
var/savefile/F = new(ckey)
Read(F)
usr << "Loaded!"
else
usr << "You've never saved, so you can't load!"
usr << "We shall give you a new character!"
sleep(2)
usr << "Initializing"
sleep(1)
usr<<"."
usr.Cash = 700
sleep(2)
usr<<".."
sleep(1)
usr<<"."
sleep(5)
usr.Name = usr.key
usr.loc = locate(2,2,1)
usr.contents += new /obj/Beyblade/Custom/Weight/
usr.contents += new /obj/Beyblade/Custom/Attack/
usr.contents += new /obj/Beyblade/Custom/Base/
usr.contents += new /obj/Beyblade/Custom/Bitbeast/
usr<<"Complete!"


That SHOULD be all you need.

Thank you again Lummox, and thanks to anyone who used their time veiwing my post!

~GokuSS4Neo~

In response to Yota
Yota wrote:
I say keep the code and make it work. Then put it in it's own DM file so it doesn't get tangled in your other code making it hard to read. As long as it works, you can optimize it later. When I get more time I'll work on it.

That's teh bit I can't do. I am waiting until that works before I optimize!

~GokuSS4Neo~
In response to Gokuss4neo
Heh, I was working on it, and was about to post that I need the rest of the code to test. But that... Here's a trick I like to use when debugging at runtime. For each procedure, put "world << "[varname] - [anothervar] - [more]..."", and include each var that's being processed. As it gets to that point, it will tell you what they are, and if you have no life, you can count each line, and mark the line number in the output. I'm not suer if I'll be able to do this without the enture source. (DME, DMs, DMPs, etc.) Can't test when I don't have the stuff that runs it. If you want to keep it private, then I can't help you.
In response to Yota
Do you have msn? My email is [email protected].

I would be ETERNALLY grateful if you would accept my files and help iron out the bugs. If you have MSN add me as a contact, or you can email me. I much prefer MSN though.

Thank you again!

~GokuSS4Neo~
In response to Gokuss4neo
No, I use AOL and AIM. Page me if possible first.
In response to Gokuss4neo
Hrm... I'm still seeing considerable usr abuse in here. It shows up in odd places in a few procs. You should really sew that up.

As for how you're combining these items, I'm not exactly sure what you're doing to really put them together. Your custom____ verbs seem to set the vars for an obj in contents, only you have a lot of of different objs instead of a single beyblade as would seem to be your goal. Why do you have /obj/Beyblade/Custom/Weight and /obj/Beyblade/Custom/Attack objects? What purpose do these different classes serve if basically all you want to do is change the vars of a single combined object?

Right now the code is overlong, and overwide. At least one thing you can do right now to shore it up is to clean up those nested if() statements and for() loops checking for each part. Use locate() instead of for() to find an object, since you don't care which it is. And if the object isn't found, just set src.HasBeyblade to 0.
src.HasBeyblade = 1   // assume this until we find out otherwise
var/obj/Beyblade/Custom/Base/B = locate() in src
if(!B || !B.name)
src << "You have no base."
src.HasBeyblade = 0
// now do the same for other parts
...
// and bail out if necessary
if(!src.HasBeyblade) return
But ultimately I think you have to lose the /obj/Beyblade/Custom objects, because they seem to be designed as placeholders for creating a Beyblade, but they contribute nothing to making it easier to combine parts; they only make it harder.

Lummox JR
In response to Lummox JR
The only reason for the /obj/Beyblade/Custom things was because I had NO idea how to do it. And I guessed that it would be possible that way. Because you say there is a different, and easier way of doing this, I assume that I shall pretty much have to delete all of my custom objs, procs, and verbs, so I see no reason in me editing these at this point.

Also, if I had just one signle for the object, how would I stop them from having multiple bases, attack rings, and weight disks? Would I have to make more vars? I guess that is what I should do.

I will work on it today (tonight for me) and will post anything I come up with!

Thank you again!

~GokuSS4Neo~
In response to Gokuss4neo
The easiest approach to combining objects is to create the single Beyblade object, and put its components in the contents list. Whenever a part is added or removed, recalculate the Beyblade's vars by adding up the components' attributes.

You can create a Beyblade object on the fly just by using a verb that attaches one of the components to another. It needn't be a complete blade, and you can even give it a var to say so.

I'd ditch the src.AttackRings list and others like it.
obj/Beyblade
var/complete

var/Att
var/Def
var/End

component
base
ring
weight
bit

proc/Combine(obj/Beyblade/component/part)
for(var/t in typseof(.component) - .component)
if(istype(src, t))
if(istype(part, t)) return
break
else if(istype(part, t)) break
var/obj/Beyblade/B = new(loc, src, part)

New(newloc)
for(var/i = 2, i <= args.len, ++i)
if(isobj(args[i])) contents += args[i]

proc/Recalculate()
Att = 0
Def = 0
End = 0
for(var/obj/Beyblade/component/c in src)
Att += c.Att
Def += c.Def
End += c.End
complete = (locate(:base) in src) &&
(locate(:ring) in src) &&
(locate(:weight) in src)
. = complete

proc/Attach(obj/Beyblade/component/part)
var/pt
for(pt in typseof(:component) - :component)
if(istype(part, t)) break
var/obj/O = locate(pt) in src
if(O) O.loc = loc
part.loc = src
Recalculate()

Lummox JR
In response to Lummox JR
That looks a little to complicated for me at this moment in time. Maybe in a few months I will refer back to this post and redo my code, but until then, I shall sitck to this new method I just thought of.

Thank you anyway. And thank you once again!

~GokuSS4Neo~
Page: 1 2