ID:139057
 

mob
verb
Build_Fire()
if(src.log >= 1)
var/obj/fire/F = new /obj/fire
F.loc = get_step(src,src.dir)
else
view() << "[usr] attempts to kindle a fire...But find they have no wood."

var
log

obj
fire
icon = 'textures.dmi'
icon_state = "fire"
luminosity = 3


Okay, there is the code. The problem that I am having is that although I get NO errors, when I go in-game and pick up a log and click "Make Fire" it posts the message saying that I have no wood. How can this be fixed?

Thanks,

Namone


What is the code when you pick up wood?
In response to Lugia319
Sorry I took a while.


Code:

obj
log
icon = 'textures.dmi'
icon_state = "log"


verb
Pick_Up()
set src in oview(0)
usr << "You get [src]!"
Move(usr)

Drop()
usr << "You drop [src]!"
Move(usr.loc)
In response to Namone
You are not adding +1 to the mob's log variable when picking up a log.
In response to Hashir
He should also define his mob/var/log variable as "log = 1", because he's going to get problems trying to add 1 to null.
In response to Nielz
Nielz wrote:
He should also define his mob/var/log variable as "log = 1", because he's going to get problems trying to add 1 to null.


So, something kinda like this?

///////////
//Objects//
///////////


obj

var
log = 1


log
icon = 'textures.dmi'
icon_state = "log"


verb
Pick_Up()
set src in oview(0)
usr << "You get [src]!"

Move(usr)

Drop()
usr << "You drop [src]!"
[src] - 1
Move(usr.loc)





mob
verb
Build_Fire()
if(src.log >= 1)
var/obj/fire/F = new /obj/fire
F.loc = get_step(src,src.dir)
else
view() << "[usr] attempts to kindle a fire...But find they have no wood."
var
log = 1


obj
fire
icon = 'textures.dmi'
icon_state = "fire"
luminosity = 3
In response to Namone
Nielz only told you to make the mob's log var to a value (0), he didn't told you to define a obj var named log.

And use usr.log -= 1 or usr.log += 1 to accomplish what you are trying to do.
In response to Hashir
Hashir wrote:
Nielz only told you to make the mob's log var to a value (0), he didn't told you to define a obj var named log.

And use usr.log -= 1 or usr.log += 1 to accomplish what you are trying to do.

mob
verb
Build_Fire()
if(usr.log += 1)
var/obj/fire/F = new /obj/fire
F.loc = get_step(src,src.dir)
else
view() << "[usr] attempts to kindle a fire...But find they have no wood."
var
log = 0


When I do that I get this.

Error:

loading Colony RP.dme
objects.dm:33:error: : missing expression

Colony RP.dmb - 1 error, 0 warnings (double-click on an error to jump to it)
In response to Namone
Err.

if(usr.log >= 1)


The statement above means IF the verb caller's log var is greater or equal to one, then continue.

if(usr.log += 1)


This statement makes no sense. += is an operator which ADDS a value to a certain variable. It cannot be used in an if() statement.

I said that you should add += in your Pick_Up() verb and -= in your Drop() verb not in the if() statement of your Build_Fire() verb.

Also, I recommend you to read the guide.
In response to Hashir
Hashir wrote:
Err.

> if(usr.log >= 1)

The statement above means IF the verb caller's log var is greater or equal to one, then continue.

> if(usr.log += 1)

This statement makes no sense. += is an operator which ADDS a value to a certain variable. It cannot be used in an if() statement.

I said that you should add += in your Pick_Up() verb and -= in your Drop() verb not in the if() statement of your Build_Fire() verb.

Also, I recommend you to read the guide.


Yeah...I probably should read it more than I have...Thanks for your help.
In response to Namone
You are Welcome.