ID:261395
 
I want to make a turf that has density 1 turn to density 0 when a certain mob uses a certain verb.

Gate(turf/Gate as turf in world)
set category = "Mod"
set src in view(1)
set name = "Open Mod Gate"
if (src == Gate)
src.density = 0



Help please
Little Sally wrote:
I want to make a turf that has density 1 turn to density 0 when a certain mob uses a certain verb.

Gate(turf/Gate as turf in world)
> set category = "Mod"
> set src in view(1)
> set name = "Open Mod Gate"
> if (src == Gate)
> src.density = 0

Help please

mob/verb/Open_Gate(turf/Gate as turf in world)
set category = "Mod"
set src in view(1)
set name = "Open Mod Gate"
if(src == Gate)
src.density = 0

Is that what you want?

-Kappa the Imp



In response to Kappa the Imp
IT has no errors but it wont work. Well maybe this will make it easyer. I want the Mod mob to be able to walk through the gate and all others to not be able to.

I attemted to do this but it did not work.

Enter()
set src in view(1)
if(usr.gate == 1)
src.density = 0


it could not find var but I did define

In response to Little Sally
Hmm... try this:
turf
gate
density = 0
Enter()
if(istype(usr,/mob/Mod))
..()

When a mob tries to enter the gate, the gate checks to see if the mob is the type /mob/Mod. If it is, then do what would normally happen. Otherwise, don't do anything.
The istype() proc is extremely useful, so you should definately look that up.
In response to WizDragon
He wants the usr's density 0.
mob/verb/Open_Gate(turf/Gate as turf in world)
if(istype(usr,/mob/Mod))
set category = "Mod"
set name = "Open Mod Gate"
set src in view(1)
src.density = 0

That should work.Or if that doesn't work.Try this.

mob/Mod/verb/Open_Gate(turf/Gate as turf in world)
set category = "Mod"
set name = "Open Mod Gate"
set src in view(1)
src.density = 0





Little Sally wrote:
I want to make a turf that has density 1 turn to density 0 when a certain mob uses a certain verb.

Gate(turf/Gate as turf in world)
> set category = "Mod"
> set src in view(1)
> set name = "Open Mod Gate"
> if (src == Gate)
> src.density = 0

Help please

This looks like a proc, but is not defined as such in your example. If it is a proc, is it owned by the gate turf? If it is, src will always equal gate, though your syntax: (src == Gate) will not do what you want.

turf/gate
proc
open()
set category = "Mod"
set src in view(1)
set name = "Open Mod Gate"
density = 0

close()
set category = "Mod"
set src in view(1)
set name = "Close Mod Gate"
density = 1


You might want to add in code to change the icon state to show visually whether the gate is open or closed.
In response to Kappa the Imp
Kappa the Imp wrote:
> mob/verb/Open_Gate()
> if(istype(usr,/mob/Mod))
> set category = "Mod"
> set src in view(1)
> set name = "Open Mod Gate"
> if(src == Gate)
> src.density = 0
>

That should work.

Shouldn't work at all. The "set" command is run compile-time. You can't nest it in an "if" statement.
In response to Skysaw
There,i think i fixed it now.
In response to Kappa the Imp
Kappa the Imp wrote:
There,i think i fixed it now.

Still looks broken to me.
In response to Skysaw
.....Now i fixed it i took out the if(src == Gate)
In response to Kappa the Imp
Kappa the Imp wrote:
.....Now i fixed it i took out the if(src == Gate)

As I mentioned earlier, the "set" command is run compile-time. You can't nest it in an "if" statement.