ID:2297315
 
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 haven't found a successful 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.




Hey guys, I'm still working on my game, and I realized that using flick() proc to open the fusion force field, doesn't work because flick() is only meant in this case to show movement and what I actually wanted to do was change the icon_state and density temporarily.
I think the reason I picked flick() in the first place is because of the convienience of the paramaters which I couldn't get working.

Now my problem is more understood that it's the icon_state I have to change, But I can't figure out how to get the icon_state changed because it is actived by a brother on the same tree and I never learned how to get around the coding tree without using var procedures.
I did manage to piece together a code that compiles, but the fusion force field still won't open. Later on I want to add DblClick() to the Fusion Key Pad, thats why I had to use to different objects for this.

This is what I have so far:


obj/Fusion
FusionKeyPad1
name = "Fusion KeyPad"
icon = 'Fusion KeyPad.dmi'
icon_state = "Active"
Power = 1
PoweredOn = 1


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

FusionForceField1
name = "Fusion Force Field"
icon = 'Fusion Force Field.dmi'
icon_state = "Active"
Power = 1
PoweredOn = 1

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."
//I actually don't know how to change the icon_state without using the "var/obj/b" and using "b.icon_state ="...
//Since this didn't work I gave the usr a message: "You open the Fusion Force Field"
//When I click OpenForceField, the Fusion Force Field stays "Active" and density = 1 (Which I don't want) but the usr gets his message
//that he opened the force field. This means the code is completely being read, but the b variable isn't.



//Is there any way to link the Fusion Force Field with the KeyPad enough to change the Force Fields Icon from the Keypad(and density)


FusionKeyPad1
verb
OpenForceField()
set src in view()
var/obj/b = (/obj/Fusion/FusionForceField1)
if (usr.KeyCard == 1)
b.icon_state = "Open"
b.density = 0
usr << "You open the Fusion Force Field"
sleep(600)
b.icon_state = "Active"
b.density = 1

else usr << "<b><font color = red> Access Denied. </font>"



Any help on this issue would be grately appreciated.
Thank You.
var/obj/b = (/obj/Fusion/FusionForceField1)


This is not right. You want an actual reference to the force field object instance you are opening. What you have is a variable containing an object type which is used to create an object instance.

An example of something that may help you towards your goal:
var obj/f = locate(/obj/force_field) in get_step(usr, usr.dir)

// ...which is identical to:
var obj/force_field/f = locate() in get_step(usr, usr.dir)


Then you would go on to set the icon_state, density, and so on, of f, accordingly.
Coco50Nitty wrote:
else usr << "<b><font color = red> Access Denied. </font>"

Omg plz always close your HTML tags or you make HTML-Jesus cry.