ID:2280871
 

Hey guys, I was just wondering... in many situations I have to execute a proc() that was defined under the parent type /obj in different parent type (eg: /mob)

In some cases I want the procs to be ran at the same time as the player logs in or as long as the server is up, even if no players are online.

I tried many times to get /mob/NPC/proc to work within:

mob
Login()
..()



but this only applies to mobs that haven't been named NPC, my point is, I was wondering if someone could guide me through on how to execute a proc() even though its in a different area of the Parent_Type Code Tree.

My current situation is making it so all of the Survellance Cameras in my game are moving back and forth when the player logs in or if possible, as long as the server is up.

My current Coding is:


Code:
obj
var
Power = 1
PoweredOn = 0

obj
SurvellanceCamera
name = "Survellance Camera"
icon = 'Security Camera.dmi'
Power = 1
PoweredOn = 1
desc = "These Survellance Cameras will help keep this base secure."

obj
SurvellanceCamera
proc
PoweredCameras()
while(PoweredOn == 1)
flick("Movement", src)
sleep(20)


obj/SurvellanceCamera
verb
TurnOnCameras()
set category = "Testing Cameras"
set src in view()
PoweredCameras()


Problem Description


Now the when I use the verb TurnOnCameras(), The closest camera will turn on and do everything I want it to do.
My problems are:
I want to be able to turn them on the moment the client/server
starts up, and my second problem is:
I want to be able to turn all of them on at the same time.

I've tried using the call() proc at the mob/Login() but it didn't do anything **Not sure if I did it right**

I would like to know how to fix this problem and how to move around the Parent_Type in the Code Tree so I can solve these
kinds of problems by myself if possible.

I hope you guys can help and I look forward to hearing back from you.

Thanks in Advance

Why not call PoweredCameras() in obj/SurvellanceCamera/New()?

Also, you might want to read about "Proc Inheritance" in the DM guide's chapter on procs:
http://www.byond.com/docs/guide/chap06.html
Hey guys, I'm still wondering how to move around the Parent Type Code Tree...
Most of the problems I come across are based around the parent or sibling in the code tree.

My current problem is I'm trying to get My Fusion Keypad to open a FusionForceField.
The thing with this is I'm going to want to make it so that I can open different force fields with different Fusion Keypads..


This is my current coding:



obj/var/ID



obj
FusionKeyPad
name = "Fusion KeyPad"
icon = 'Fusion KeyPad.dmi'
icon_state = "Active"
Power = 1
PoweredOn = 1
ID = 111

desc = "Using SoulPrint Identification, Only those with the highest Clearance Level can open the Fusion Force Field Doors."

FusionForceField
name = "Fusion Force Field"
icon = 'Fusion Force Field.dmi'
icon_state = "Active"
Power = 1
PoweredOn = 1
ID = 111
density = 1
HurtLevel = 25
desc = "This Fusion Force Field Door can handle anything you can throw at it, the only thing that can open it is The Fusion KeyPad with the right Clearance Level."

var/obj/FusionIDapproved = 0
var/obj/Connection = 0

obj
FusionForceField
proc
OpenForceField()
if(usr.KeyCard == 1)
while(FusionIDapproved == 1)
flick("Open",src)
sleep(600)
else usr << "<b><font color = red> Access Denied. </font>"

FusionKeyPad
verb
UseKeyPad()
set src in view()
var/obj/FusionForceField/M = (/obj/FusionForceField)
if(usr.KeyCard == 1)
if(M.ID == src.ID)
FusionIDapproved = 1
M.OpenForceField()
else return 1
else usr << "<b> <font color = red> Access Denied. </font>"
I tried using the
 obj/var/ID
so I could match the two Fusion parts together, but I havent found a succesful way to link them. I also don't know how to call the proc
 M.OpenForceField()
from the Fusion Force Field proc. I was hoping someone can clear this up so I can apply what I learn to future problems like this.

Thank You.