ID:262665
 
Code:
mob
proc
Dragonball_Scat()
for(var/obj/dragonball/O in world)
var/x = rand(17,707)
var/y = rand(16,205)
O.loc = locate(x,y,1)
world << "<b><font color = red>The Dragonballs scatter across the earth!<b>"


Ok im makin a dbz game and i wrote my own dragonball code where the dragonballs stack,each one has a weight of 1 and your max weight is 7, once you have 7 you drop them on the floor and wish and the dragonballscatter proc is called,but if any one has a dragonball in there inventory it takes it away without removing 1 weight so they can never pick up 7 balls again, i was wondering if any one knew how to make it so they dont get moved if there in your inventory or if it just creates new balls at the location instead of moving old ones there

mob/proc/DragonBall_Scat()
for(var/ovj/dragonball/O in world)
for(var/client/C in world)
if(O.loc==C.mob)
C.mob.weight--
var/x = rand(17,707)
var/y = rand(16,205)
O.loc = locate(x,y,1)
world << "<b><font color = red>The Dragonballs scatter across the earth!<b>"


Something like that should work. I couldn't think of way to do this without two loops.
In response to CaptFalcon33035
hmm actually i need to make it so it creates new ones there because if the old ones are moved they are still in a pile of 7 and i cant think of a way to split them back up,so ive changed it so they get deleted when you wish and i need to make the scat proc create new ones
In response to Shadow Saiyan
usr << "You have wished"
usr.invorty-dragonballs
db1 loc locate(x,y,z)
db2 loc locate(x,y,z)
//up to 7
db7 loc locate(x,y,z)
world << "The Dragonballs Scatter round the wold"
sorry its not perfect but its the best i can do in short time i didnt make all of it for u but its an idear try and make 1 urself if u have trouble go on develpor how 2 or back here

~JRR-Zero~
In response to JRR-Zero
You really shouldn't help anyone unless you know how to program, or spell variables correctly.
In response to N1ghtW1ng
-_-' it waas a quick bit of help if u want ill prove 2 u i can code by actully making the coding for him but i dont think thats right because IM HELPING not making
In response to JRR-Zero
k ty i got it working now to make it drop dragonball on floor when u log out :)
In response to Shadow Saiyan
k try and make it work tho here ill give it 1 more shot for u
obj/dragonballs/db1
icon = 'ICON.dmi'
icon_state = "ICONSTATE"
verb/Get()
if (usr.gotdb1==0)
set src in oview(1)
new/obj/dragonballs/db1(usr)
usr.gotdb1=1
checkdbz()
src.loc = locate(0,0,0)
var/x = rand(1,300)
var/y = rand(1,300)
src.loc = locate(x,y,1)
else
usr<< "You have this one already"
//------------------------------------------\\
proc/checkdbz()
usr.dballs= (src.gotdb1+src.gotdb2+src.gotdb3+src.gotdb4+src.gotdb5+src.gotdb6+src.gotdb7)
if(usr.gotdb1==1 && usr.gotdb2==1 && usr.gotdb3==1 && usr.gotdb4==1 && usr.gotdb5==1 && usr.gotdb6==1 && usr.gotdb7==1 && usr.haswished==0)
usr.verbs += /mob/dbz/verb/Wish
else
usr.verbs-= /mob/dbz/verb/Wish
mob/var/wishedpower=0
mob/dbz/verb
Wish()
usr.verbs -= /mob/dbz/verb/Wish
usr.random = 2
if(usr.random == 0)
usr << "BWAHHHHHHH.....your wishes are complete..."
usr.gotdb1=0
usr.gotdb2=0
usr.gotdb3=0
usr.gotdb4=0
usr.gotdb5=0
usr.gotdb6=0
usr.gotdb7=0
usr.dballs=0
haswished=1
return
else
usr.random -= 1
switch(input("What will your wish be?") in list("wish1","2","3","4"))
if("wish1")

if("2")
if("3")
if("4")
dballs del()
dballs locloate(rand(x,y,z))

ok this shud give u like 1billion undefine vars LoL but it shud work enjoy
In response to JRR-Zero
Uh, thats from zeta my friend.
In response to Madix
yup thats from zeta and my balls dont even work on the basis of there being 7 different objs, theres is just one obj but it stacks.
Your HTML really needs fixing there. To close the <b> tag you need to use </b>, but before that you should also be closing the <font> tag. You also messed up the font tag, since there should never be space in between an attribute (color) and its value (red). That should read as follows:
world << "<b><font color=red>The Dragonballs scatter across the earth!</font></b>"


Also if you find you're using the same style a lot, I'd recommend putting it into a .css style sheet in a .dms file, and then you can use the <span> tag to use that style. It's convenient especially when you're mixing effects like color and boldface.

Lummox JR
In response to Lummox JR
 mob
proc
Dragonball_Scat()
var/x = rand(103,111)
var/y = rand(103,176)
new/obj/dragonball (x,y,1)
world << "<b><font color=red>The Dragonballs scatter across the earth!</font></b>"


This is my new code but the ball wont appear
In response to Shadow Saiyan
Shadow Saiyan wrote:
 mob
> proc
> Dragonball_Scat()
> var/x = rand(103,111)
> var/y = rand(103,176)
> new/obj/dragonball (x,y,1)
> world << "<b><font color=red>The Dragonballs scatter across the earth!</font></b>"

This is my new code but the ball wont appear


Of course it won't! You didn't define the loc of "dragonball". You need to use Locate()!:
new/obj/dragonball(locate(x,y,z))


O-matic
In response to O-matic
ty they scatter properly now :)

Problem solved topic closed


In response to Shadow Saiyan
I made a demo sort of thing for this.

It will have nearly everything you need.

Dragonball Demo
In response to Shadow Saiyan
mob
Logout()
for(var/obj/dragonball/D in src.contents)
drop(D)// i do really hope you have a drop proc, :) also, incluce the src.weight-- in your drop proc, just to make sure you did :P
Shadow Saiyan wrote:
Code:
> mob
> proc
> Dragonball_Scat()
> for(var/obj/dragonball/O in world)
> var/x = rand(17,707)
> var/y = rand(16,205)
> O.loc = locate(x,y,1)
> world << "<b><font color = red>The Dragonballs scatter across the earth!<b>"
>

Ok im makin a dbz game and i wrote my own dragonball code where the dragonballs stack,each one has a weight of 1 and your max weight is 7, once you have 7 you drop them on the floor and wish and the dragonballscatter proc is called,but if any one has a dragonball in there inventory it takes it away without removing 1 weight so they can never pick up 7 balls again, i was wondering if any one knew how to make it so they dont get moved if there in your inventory or if it just creates new balls at the location instead of moving old ones there


mob
proc
Dragonball_Scat()
for(var/obj/dragonball/O in world)
if(!ismob(O.loc))
var/x = rand(17,707)
var/y = rand(16,205)
O.loc = locate(x,y,1)
world << "<b>The Dragonballs scatter across the earth!<b>"
Shadow Saiyan wrote:
Dragonball_Scat()

Am I the only one that finds it humorous to find the words "dragonball" and "scat" on the same line of code?
In response to PirateHead
LAWL. Scat reminds me of felines.