var
list/coinlist = new
proc/globalLoop()
while(1)
for(var/obj/coin/coin in coinlist)
coin.gotoTarget()
sleep(world.tick_lag)
obj
coin
icon = 'Money.dmi'
density = 0
var value
var mob/combat/player/target
var/rank
var/stepcount
bronze
icon_state = "bronze"
rank=1
silver
icon_state = "silver"
rank=2
gold
icon_state = "gold"
rank=3
diamond
icon_state = "diamond"
rank=4
glide_size = 2
proc/gotoTarget()
if(!target) del src
// if(ActionLock("coinlock", world.tick_lag)) return
step_towards(src,target)
stepcount++
if(stepcount>35)
target.addCoin(rank,value)
del src
// if(target.x == src.x && target.y == src.y && target.z == src.z)
if(target.loc == src.loc)
target.addCoin(rank,value)
del src
proc/generateCoins(rank,count,mobloc,atom/target)
var coins = round(count / 333)
var rmnd = count % 333
var/obj/coin/setcoin = new
switch(rank)
if(1)
setcoin = new /obj/coin/bronze
if(2)
setcoin = new /obj/coin/silver
if(3)
setcoin = new /obj/coin/gold
if(4)
setcoin = new /obj/coin/diamond
for(var/i=coins,i>0,i--)
// new setcoin
setcoin.value = 333
setcoin.pixel_x += rand(0,5)
setcoin.pixel_y += rand(0,5)
setcoin.loc = mobloc
setcoin.target = target
coinlist += new setcoin
if(rmnd > 0)
setcoin.value = rmnd
setcoin.pixel_x += rand(0,5)
setcoin.pixel_y += rand(0,5)
setcoin.loc = mobloc
setcoin.target = target
coinlist += new setcoin
Problem description:
The desired result is to have multiple coins spawn on the ground and instead only 1 coin spawns on each type. they also don't move or get added to coinlist. I also receive this error:
runtime error: Cannot create objects of type /obj/coin/bronze.
proc name: generateCoins (/proc/generateCoins)
usr: Guest-156831082 (/mob/combat/player)
src: null
usr.loc: LightDirt13 (23,22,1) (/turf/Environment/Ground/Dirt/LightDirt/LightDirt13)
call stack:
generateCoins(1, 3, LightDirt06 (23,23,1) (/turf/Environment/Ground/Dirt/LightDirt/LightDirt06), Guest-156831082 (/mob/combat/player))
the slimeblue (/mob/combat/enemy/slimeblue): React()
/value (/value): Subtract(2)
damageEnemy(Guest-156831082 (/mob/combat/player), the slimeblue (/mob/combat/enemy/slimeblue))
Guest-156831082 (/mob/combat/player): Bump(the slimeblue (/mob/combat/enemy/slimeblue))
Guest-156831082 (/mob/combat/player): Move(LightDirt06 (23,23,1) (/turf/Environment/Ground/Dirt/LightDirt/LightDirt06), 1)
Guest-156831082 (/client): default action("north")
Guest-156831082 (/client): key down("north", Guest-156831082 (/client))
Guest-156831082 (/client): KeyDown("north")
runtime error: Cannot create objects of type /obj/coin/silver.
proc name: generateCoins (/proc/generateCoins)
usr: Guest-156831082 (/mob/combat/player)
src: null
usr.loc: LightDirt13 (23,22,1) (/turf/Environment/Ground/Dirt/LightDirt/LightDirt13)
call stack:
generateCoins(2, 1, LightDirt06 (23,23,1) (/turf/Environment/Ground/Dirt/LightDirt/LightDirt06), Guest-156831082 (/mob/combat/player))
the slimeblue (/mob/combat/enemy/slimeblue): React()
/value (/value): Subtract(2)
damageEnemy(Guest-156831082 (/mob/combat/player), the slimeblue (/mob/combat/enemy/slimeblue))
Guest-156831082 (/mob/combat/player): Bump(the slimeblue (/mob/combat/enemy/slimeblue))
Guest-156831082 (/mob/combat/player): Move(LightDirt06 (23,23,1) (/turf/Environment/Ground/Dirt/LightDirt/LightDirt06), 1)
Guest-156831082 (/client): default action("north")
Guest-156831082 (/client): key down("north", Guest-156831082 (/client))
Guest-156831082 (/client): KeyDown("north")