ID:166889
 
in this code

proc/shockwave_hit(mob/M)
var/obj/gold/g = new (M.loc)
if(M.gold>0) g.amount = rand(1,M.gold)
M.gold -= g.amount
<dm/>

who looses the gold?
the person it hits i beleive(if you have something else to go with that) otherwise it needs to be defined...like,for example:
mob/verb/Shockwave(mob/M in oview(6))
mob/M is whoever you happen to send as an argument through the proc shockwave_hit(mob/M). My guess is the proc runs when the shockwave bumps into something, and finds it to be a mob?
In response to Detnom
thanks
therefore there is no problem here,
how do I give the gold taken to the player?
In response to Eurobusker
proc/shockwave_hit(mob/M)
var/obj/gold/g = new (M.loc)
if(M.gold>0) g.amount = rand(1,M.gold)
M.gold -= g.amount
usr.gold+=g.amount




In response to Dragon_fire6653
Bad dragonfire! No put usr in proc!
In response to Jp
err...
proc/shockwave_hit(mob/M)
var/obj/gold/g = new (M.loc)
if(M.gold>0) g.amount = rand(1,M.gold)
M.gold -= g.amount
src.gold+=g.amount

better?


In response to Jp
I tried it but

loading Graphical MUD Kit.dme
golddrop.dm:7:error:src.gold:undefined var

Graphical MUD Kit.dmb - 1 error, 0 warnings (double-click on an error to jump to it)
In response to Dragon_fire6653
Dragon_fire6653 wrote:
err...
> proc/shockwave_hit(mob/M)
> var/obj/gold/g = new (M.loc)
> if(M.gold>0) g.amount = rand(1,M.gold)
> M.gold -= g.amount
> src.gold+=g.amount
>

better?



proc/shockwave_hit(mob/M)
var/obj/gold/g=new(M.loc)
g.amount=rand(1,M.gold)
M.gold-=g.amount
gold+=g.amount
if(M.gold<0)M.gold=0

Better.
In response to DivineO'peanut
still getting the same output

golddrop.dm:7:error:gold:undefined var

it is defined in my other scripts, is there a problem of syntax?
In response to Eurobusker
Is the procedure defined under /mob? I doubt it is.
In response to Jp
cant find it,
how do I put that in?
and where?
In response to Eurobusker
Eurobusker wrote:
still getting the same output

golddrop.dm:7:error:gold:undefined var

it is defined in my other scripts, is there a problem of syntax?

The problem: gold isn't defined as a var. /obj/gold needs a var called gold.
In response to Jon T
Jon T wrote:
The problem: gold isn't defined as a var. /obj/gold needs a var called gold.

No. No, no, no.

The problem is that there is no "src". So you try to access src.gold and, surprise surprise, you get an error.

What needs to happen here is that shockwave_hit() needs to be defined under /mob, like this:

mob/proc/shockwave_hit(mob/M)
var/amount = rand(1,M.gold)
M.gold -= amount
src.gold += amount
world << "[src] hits [M] with a shockwave, receiving [amount] gold!"


Then src will exist. Note that you must call shockwave_hit() "on" the mob that gets the gold.

I also removed the /obj/gold, since we don't want to drop a gold object; we're just giving the gold directly to a different player.
In response to Crispy
I'm getting this
golddrop.dm:6:error:src.gold:undefined var

I've put all the code here:

http://eurobuskers.free.fr/busking_source.zip

feel free to mess it about, it doesn't work...yet
In response to Eurobusker
mob/var/gold=10
In response to XzDoG
XzDoG wrote:
mob/var/gold=10

I've got that already
In response to Eurobusker


You had just
proc/shockwave_hit()
It should be mob/proc/shockwave_hit(mob/M)
In response to XzDoG
XzDoG wrote:
You had just
proc/shockwave_hit()
It should be mob/proc/shockwave_hit(mob/M)

youre right but as you may have seen I get

Shockwave.dm:53:error:shockwave_hit:undefined proc
Shockwave.dm:54:error:shockwave_hit:undefined proc

The plot thickens!!
In response to Eurobusker
Can you double-click those errors and post the blocks of code they are in? That might help.

By the way, I can't beleive it took so long to identify the src and usr part in giving the gold. Then Crispy finally comes and clears it up. Jp also gave some insight.
Page: 1 2