ID:1671625
 
(See the best response by Zecronious.)
Code:
mob
Login()
src.loc = locate(1,1,1)
mob
mouse_opacity = 2
turf
var/Infected = 0
var/Virus = list()
var/Type = null
Grass
icon = 'Grass.dmi'
color = "green"
obj
Infected
var/Virus = list()
var/Type
New()
..()
src.Airborne()
proc
Airborne()
..()
if(Type == "Airborne")
//var/Direct = pick("NORTH","SOUTH","EAST","WEST")
walk_rand(src,0,2)
world << "DEBUG:"
//sleep(100)
// src.Airborne()
else
..()
spawn(50)
src.Airborne()
Move()
var/obj/Infected/I = new
I.Virus = "Airborne"
var/turf/InfectedPlace = src.loc
InfectedPlace.Infected = 1
I.loc = src.loc
..()
Click()
world << Type

obj
Infected
icon = 'Infected.dmi'
world
turf = /turf/Grass
maxx = 10
maxy = 10
maxz = 1
mob
verb
Sneeze()
var/RandV = pick("Cold","Flu")
var/obj/Infected/I = new
I.Virus = RandV
var/turf/InfectedPlace = src.loc
InfectedPlace.Infected = 1
I.loc = src.loc
if(RandV == "Cold")
I.Type = "Contact"
if(RandV == "Flu")
I.Type = "Airborne"


Problem description:
(Focusing on airborne more than contact)
Problems Are:

1.When i click on some of them they show nothing its completely blank. When it's suppose to show the virus type

2.The airborne virus is stacking up. How do i stop that, it bothers your eyes when it stacks up to much and i dont want it to be that viewable.

3.How do i make the virus stop going to a place where the virus is in already?

4.The virus also stops moving around after a point.


Okay, so just clarify again what it should be doing versus what it's actually doing. It may just be the way I'm reading it, but the description of the behaviour you want is extremely vague to me.
I believe this should solve 3/4 questions you had. You just have to replace the airborne process you've got with this one.

The only question I can't answer is why Click() isn't working. It depends on the icon you're using. It's quite possible the icon you have has got holes in it and you think you're clicking the icon but you're really clicking what's underneath it.

I'm not entirely sure about that question.

    Airborne()
var/direction
while(src)
direction = pick(NORTH,SOUTH,EAST,WEST)
var/turf/thatDirection = get_step(src,direction)
var/clearDirection = !thatDirection.density

for(var/atom/someAtom in thatDirection)
if(someAtom.density == 1)
if(!(istype(someAtom,/mob)))
clearDirection = 0

if(!(locate(type) in thatDirection) && clearDirection)
step(src,direction)

sleep(10)
Just to be noted I updated this code^

Whatever is there now should be correct.
Density is null error.

R0nny (/mob): Sneeze()
runtime error: Cannot read null.density
proc name: Airborne (/obj/Infected/proc/Airborne)
usr: R0nny (/mob)
src: Infected (/obj/Infected)
call stack:
Infected (/obj/Infected): Airborne()
Infected (/obj/Infected): New()
R0nny (/mob): Sneeze()
In response to R0nny
Best response
I'm not getting that error unfortunately but this might fix it.

    Airborne()
var/direction
while(src)
direction = pick(NORTH,SOUTH,EAST,WEST)
var/turf/thatDirection = get_step(src,direction)
var/clearDirection = 1

if(thatDirection)
clearDirection = !thatDirection.density

for(var/atom/someAtom in thatDirection)
if(someAtom.density == 1)
if(!(istype(someAtom,/mob)))
clearDirection = 0

if(!(locate(type) in thatDirection) && clearDirection)
step(src,direction)

sleep(10)
Apart from that error does it do what you wanted?
In response to R0nny
Could be that you are facing off-screen.

You should check if that /turf exists viaif(thatDirection) JUST before var/clearDirection
obj
Infected
var/Virus = list()
var/Type
New()
..()
src.Airborne()
proc
Airborne()
var/direction
while(src)
direction = pick(NORTH,SOUTH,EAST,WEST)
var/turf/thatDirection = get_step(src,direction)
var/clearDirection = 1

if(thatDirection)
clearDirection = !thatDirection.density

for(var/obj/Infected/I in thatDirection)
if(I.density == 1)
if(!(istype(I,/mob)))
clearDirection = 0

if(!(locate(type) in thatDirection) && clearDirection)
step(src,direction)

sleep(10)
Move()
var/obj/Infected/I = new
I.Virus = "Airborne"
var/turf/InfectedPlace = src.loc
InfectedPlace.Infected = 1
I.loc = src.loc
..()
Click()
world << Type

obj
Infected
icon = 'Infected.dmi'
world
turf = /turf/Grass
maxx = 10
maxy = 10
maxz = 1
mob
verb
Sneeze()
var/RandV = pick("Cold","Flu")
var/obj/Infected/I = new
I.Virus = RandV
var/turf/InfectedPlace = src.loc
InfectedPlace.Infected = 1
I.loc = src.loc
if(RandV == "Cold")
I.Type = "Contact"
if(RandV == "Flu")
I.Type = "Airborne"


runtime error: Maximum recursion level reached (perhaps there is an infinite loop)
To avoid this safety check, set world.loop_checks=0.
proc name:
usr: 0
src: Infected (/obj/Infected)
call stack:
Infected (/obj/Infected): ()
Infected (/obj/Infected): Move(null, 1)
Infected (/obj/Infected): Airborne()
Infected (/obj/Infected): New()
Infected (/obj/Infected): Move(null, 1)
Infected (/obj/Infected): Airborne()
Infected (/obj/Infected): New()
Infected (/obj/Infected): Move(null, 4)
Infected (/obj/Infected): Airborne()
Infected (/obj/Infected): New()
...
Infected (/obj/Infected): New()
Infected (/obj/Infected): Airborne()
Infected (/obj/Infected): Move(null, 2)
Infected (/obj/Infected): New()
Infected (/obj/Infected): Airborne()
Infected (/obj/Infected): Move(null, 1)
Infected (/obj/Infected): New()
Infected (/obj/Infected): Airborne()
R0nny (/mob): Sneeze()
runtime error: Maximum recursion level reached (perhaps there is an infinite loop)
To avoid this safety check, set world.loop_checks=0.
proc name: New (/obj/Infected/New)
usr: 0
src: Infected (/obj/Infected)
call stack:
Infected (/obj/Infected): New()
Infected (/obj/Infected): Move(null, 1)
Infected (/obj/Infected): Airborne()
Infected (/obj/Infected): New()
Infected (/obj/Infected): Move(null, 1)
Infected (/obj/Infected): Airborne()
Infected (/obj/Infected): New()
Infected (/obj/Infected): Move(null, 4)
Infected (/obj/Infected): Airborne()
Infected (/obj/Infected): New()
...
Infected (/obj/Infected): New()
Infected (/obj/Infected): Airborne()
Infected (/obj/Infected): Move(null, 2)
Infected (/obj/Infected): New()
Infected (/obj/Infected): Airborne()
Infected (/obj/Infected): Move(null, 1)
Infected (/obj/Infected): New()
Infected (/obj/Infected): Airborne()
R0nny (/mob): Sneeze()

I don't know whats happening did i do something wrong?
Off top, you want to change this

        New()
..()
src.Airborne()
proc
Airborne()
var/direction


to:

        New()
..()
src.Airborne()
proc
Airborne()
set waitfor = 0 // line added.
var/direction


Why? You want to allow New() to finish. Those errors may go away after fixing that.
In response to FKI
Correct me if I'm wrong, but calling ..() executes the default behavior at that moment, as if you were calling a proc, right?

Meaning waitfor wont change anything, since Airborne() wont be called until the default behavior finishes.
Uhh, i never knew it was so hard to do this. I thought it was a easy creation T.T.
Correct me if I'm wrong, but calling ..() executes the default behavior at that moment, as if you were calling a proc, right?
You are right, but that doesn't change the fact that it wasn't finishing.

Meaning waitfor wont change anything, since Airborne() wont be called until the default behavior finishes.
I'm pretty sure it changes a lot considering the context of the code presented (given what I said above).
I tried starting all over using your codes as refs. But it makes a infinite loop.

obj
Infected
var/Virus = list()
var/Type
New()
..()
src.Airborne()
proc
Airborne(var/obj/Infected/I)
while(src)
directions
var/direction = pick(NORTH,SOUTH,EAST,WEST)
var/Getz = get_step(src,direction)
if(I in Getz)
world << "DEBGUGED2"
goto directions
else
world << "DEBUG3"
walk(src,direction)
world << "[src.x] [src.y] [src.z]"
..()
spawn(500)
src.Airborne()
Move()
var/obj/Infected/I = new
I.Virus = "Airborne"
var/turf/InfectedPlace = src.loc
InfectedPlace.Infected = 1
I.loc = src.loc
..()
Click()
world << Type
In response to R0nny
You just need to think a little critically about what you're doing I think.

I took out some stuff you added that wasn't needed. Maybe it'll help.

Honestly without having access to your game it's not easy.

obj
Infected
var/Virus = list()
var/Type

New()
src.Airborne()

proc
Airborne()
var/direction
while(src)
direction = pick(NORTH,SOUTH,EAST,WEST)
var/turf/thatDirection = get_step(src,direction)
var/clearDirection = 1

if(thatDirection)
clearDirection = !thatDirection.density

for(var/atom/someAtom in thatDirection)
if(someAtom.density == 1)
if(!(istype(someAtom,/mob)))
clearDirection = 0

if(!(locate(type) in thatDirection) && clearDirection)
step(src,direction)

sleep(10)

Move()
var/obj/Infected/I = new
I.Virus = "Airborne"
var/turf/InfectedPlace = src.loc
InfectedPlace.Infected = 1
I.loc = src.loc

Click()
world << Type
Updated one more time, forgot something^
In response to Zecronious
Move is the thing causing the errors.
In response to R0nny
Did you try what I said? (You never clarified so I want to make sure.)
In response to FKI
Didnt work.
In response to R0nny
Post your updated code.
Page: 1 2