ID:148598
Dec 20 2002, 12:01 pm
|
|
Ok here's the proplem i cant get my game to work..... right i got no errors and no warnings but i cant get my HP and Wealth all i got at the moment.......and i got my login code to pick genders that dont come upto pick....... i got my monsters that are there but when die they stay there, did drop there items ,and dont attack back but my death check saids its fine im so cunfesd .....can any one help me please ......? thank you
|
Dec 20 2002, 12:27 pm
|
|
Can you list each of your problems, one by one, providing all the relevant code?
|
In response to Crispy
|
|
1.Moster Will not Deseper when dead and will not drop gold or attack back Code is....................................
ob icon = 'person.dmi' //make it so all mobs will be created with the person icon bug //new prototype icon = 'bug.dmi' var HP = 30 //define a new variable called HP, with a value of 30 wealth Login() icon_state = gender //when a player logs in, get them the right icon state for ..() //the gender of their key. Then call the parent! proc DeathCheck() if (HP <= 0) world << "[src] dies!" verb attack(mob/M as mob in oview(1)) usr << "You attack [M]!" oview() << "[usr] attacks var/damage = rand(1,10) world << "[damage] damage!" M:HP -= damage M:DeathCheck() say(msg as text) world << "[usr]: [msg]" And the gold is................................. obj bug icon = 'bug.dmi' gold //define a "gold" prototype, which is a kind of obj icon = 'gold.dmi' //set the default icon var amount //declare a new variable called "amount" verb get() //obj/gold/verb/get() set src in view(1) //src must be close usr << "You pick up [amount] gold." usr.wealth += amount //add to usr.wealth del(src) //delete the gold Del() var/obj/gold/G = new(loc) //create a new obj from the gold blueprint G.amount = rand(1,100) //set its amount variable randomly ..() |
In response to Kolie
|
|
Kolie wrote:
ob Well firstly, this should be mob, not ob, but I'm assuming you accidentally deleted the m when posting this. icon = 'person.dmi' //make it so all mobs will be created with the person icon No wonder it doesn't disappear... you're not telling it to! Add the highlighted line to delete the monster when it dies. verb The above line wasn't complete; I've finished it off for you, in the assumption that again, you accidentally deleted a bit of it while posting. var/damage = rand(1,10) Don't use the : operator here, use the . operator. All the : operator does is assume that the var/proc exists, whether it does or not. Therefore you won't get any compiler warnings about it, and you could potentially get nasty runtime errors. Better safe than sorry. obj Why are you defining /obj/bug? You've already defined a bug (/mob/bug), so you shouldn't need gold //define a "gold" prototype, which is a kind of obj This is why the monsters won't drop gold; you've programmed all objs to drop gold rather than the monsters, which are mobs, not objs. :-) Move everything under obj/Del() to mob/proc/DeathCheck(), making DeathCheck() look like so: proc As for making monsters move around and attack you, that's a little more complex - although certainly not much harder than what you've been doing already. Look up spawn(), sleep(), step_to(), and walk_to() to work out how to make monsters follow you around; then just call your attack verb (verbs are really just procs with extra features) to make the monsters attack the player when they're next to them. |