My monsters' gold sprite isnt appearing after i kill it, it stays invisible. Also, i do not have the ability to choose my character, it automatically uses 1 icon. Please direct me to a link that explains these, or tell me yourself if your nice enough =) Thank-You
//First Game
mob
monster
icon='monster.dmi'
proc
DeathCheck()
if (HP<=0)
world<<"[src] is destroyed!"
Del()
var
HP=30
wealth
icon='person.dmi'
Del()
var/obj/gold/G=new(loc)
G.amount=rand(1,000)
..()
Login()
icon_state=gender
..()
verb
attack(mob/M as mob in oview(1))//attack mob within 1 tile
usr<<"You attack [M]"
oview()<<"[usr] attacks [M]!"
var/damage=rand(1,10)
world<<"[damage] damage!"
M.HP-=damage
M.DeathCheck()
say(msg as text) //what the user says goes into mesage as text
world <<"[usr]: [msg]"//the world sees chat text displayed
obj
gold
icon='gold.dmi'
var
amount
verb
get()
set src in view(1)
usr<<"You pick up [amount] gold coins!"
usr.wealth+=amount
del(src)
turf
grass
icon='grass.dmi'
world
turf=/turf/grass
ID:158159
Oct 18 2009, 9:54 am
|
|
Oct 18 2009, 10:07 am
|
|
Well first of all try not to rip all of your coding out of ZBT tutorials. Second I can clearly see the problem with the gold. I have read the tutorial myself and instead of typing 'rand(1-100)' YOU typed 'rand(1-000)' which means that it will select a random value between 1 and 0 and thats immposible. (well in the code's case anyway) You cant have 0.54386 pieces of gold lying on the ground where you killed the monster. The compiler gets confused and instead of sending an error message it just sets the value to 0 or non-existant.
|
plus it automatically chooses one icon because you picked you gender when you made your account did you not? If you picked male, it would set your icon as the male state female w/ the female icon state etc.
|
In response to Brizzel987
|
|
Brizzel987 wrote:
I have read the tutorial myself and instead of typing 'rand(1-100)' YOU typed 'rand(1-000)' which means that it will select a random value between 1 and 0 and thats immposible. (well in the code's case anyway) You cant have 0.54386 pieces of gold lying on the ground where you killed the monster. The compiler gets confused and instead of sending an error message it just sets the value to 0 or non-existant. rand(1,0) results in 1 every time, not any of the other stuff you made up. And there's nothing there that would prevent there from being a gold obj with a value of 0.54386. |
In response to Garthor
|
|
see, what i ment was that the gold has to be 1 or more to actually show up...i think
|
In response to Brizzel987
|
|
Brizzel987 wrote:
see, what i ment was that the gold has to be 1 or more to actually show up...i think Nope, nothing like that anywhere. |
In response to Garthor
|
|
well then...oh wait i forgot that it is not just an obj but also when picked up a variable, so technically, yes, the gold could be 0.543286! thank you for clearing that up.
|
In response to Brizzel987
|
|
Brizzel987 wrote:
Well first of all try not to rip all of your coding out of ZBT tutorials. Second I can clearly see the problem with the gold. I have read the tutorial myself and instead of typing 'rand(1-100)' YOU typed 'rand(1-000)' which means that it will select a random value between 1 and 0 and thats immposible. (well in the code's case anyway) You cant have 0.54386 pieces of gold lying on the ground where you killed the monster. The compiler gets confused and instead of sending an error message it just sets the value to 0 or non-existant. ill show u the game some time if u want i changed a lot of things and that is not all of my code, i left out the title screen and the portals, and i iconned everything+changed a lot of the text when u do things |