ID:147081
 
mob
Login()
usr.loc=locate(6,7,3)
color = input("what color do you want to be?") in list("Red","Black")
if("Red")
usr.icon='Red ants..dmi'
world<<"[src.key] has logged in as a red ant."
usr.red=1
usr.hp=10
usr.loc=locate(40,39,1)
if("Black")
usr.icon='Black ants.dmi'
world<<"[src.key] has logged in as a black ant."
usr.black=1
usr.hp=10
usr.loc=locate(4,5,1)

Why does it say BLah has logged in as a red ant but then says it again as a black one?
mob
verb
Dig(mob/M in get_step(src,src.dir))
if(src==/turf/Wall)
del(src)

Why does'nt this work?It does'nt delete the wall.
Problem 1:
You're not checking if(color == "Black") or if(color == "Red"), you're just checking if("Black") or if("Red"), which will always be true.

You probably wanted to be using a switch, like this:

<code>color = input(your input here) switch(color) if("Black") if("Red")</code>


Problem 2:
A turf is not a type. You want to check if(src.type == /turf/wall), not if(src == /turf/wall).
In response to Foomer
Ok thanks but dig doesn't delete the wall.
mob
verb
Dig(mob/M in get_step(src,src.dir))
if(src.type==/turf/Wall)
del(src)

Could you try taking a look at this aswell for me?
mob
verb
Attack(mob/M in get_step(src,src.dir))
if(src.fired==0)
src.fired=1
spawn(15)src.fired=0
if(blackq)
if(ahp==0)
world<<"<font color=green>[usr.key] has killed the monkey2!"
world.Reboot()
else if(blackq)
world<<"The monkey2 is being attacked!"
usr<<"You attacked the monkey2!"
M.ahp-=1
else if(redq)
if(ahp2==0)
world<<"<font color=green>[usr.key] won!"
world.Reboot()
else if(redq)
world<<"The red monkey is being attacked!"
usr<<"You attacked the monkey!"
M.ahp-=1
else
src<<"You attacked [M]!"
M<<"[src] attacked you!"
Death()
sleep(1)

Alot of ifs I don't know what to do with and this is where I put them and the death check.
mob
proc
Death(mob/M)
if(M.hp==0)
world<<"<font color=red>[M.key] has been killed by [src.key]"
if(red)
usr.loc=locate(1,2,2)
usr.hp=10
if(black)
usr.loc=locate(1,1,1)
usr.hp=10

mob
monkey2
icon='2.dmi'
icon_state="q"
ahp=25
blackq=1
monkey
icon='monkeydmi'
icon_state="q"
ahp2=25
blackq=1

help?




In response to CodingSkillz2
CodingSkillz2 wrote:
Ok thanks but dig doesn't delete the wall.
> mob
> verb
> Dig(mob/M in get_step(src,src.dir))
> if(src.type==/turf/Wall)
> del(src)
>

Could you try taking a look at this aswell for me?


for this, you have to understand what src implies. The way you are using it, the Dig() verb should be tied to the turf, not to the mob. In this case here, the src is mob. It will never be /turf/wall.

also I believe the check would be if(istype(src,/turf/Wall)
but again, first you need to understand what src referes to.

If you want the verb tied to the mob, try:
mob/ver/Dig()
var/turf/W = get_step(src,src.dir)
if(istype(W,/turf/Wall)
del(W)


In response to Jik
Ok,but no to the other problems.
In response to CodingSkillz2
CodingSkillz2 wrote:
Ok,but no to the other problems.

Sorry, I'm still a noob myself, but I can follow the shorter code. In looking at you second DM snip, I see that you are using the same method of verb/VERBNAME(mob/M in get_step...). I don't know where you got that from, I don't seem to see it done like that anywhere else (not saying it's wrong, but remember... me noob)

I would code it more like this:
mob
verb
Attack()
for(var/mob/M in get_step(src,src.dir))
if(src.fired==0) //assuming that src is the attacker calling this verb...
src.fired=1
.
.
.

I would check through all your verbs to make sure that you are using src right. Remember, src is the owner of the verb. I added the for loop to define the mob(it has to be a mob for the rest to work) M that is in front of the player calling Attack.

It might be easier to use the bump() proc so you have to bump into someone to attack (unless you use it elsewhere) since it already checks that there is something infront of you. you can more easily get the mob by:

mob
Bump(var/mob/M)

this defines M the mob you just bumped into...

As to the problems, You only pointed out that Dig doesn't delete the wall. What is the other problems?
In response to Jik
Actually no,thanks.Your bump idea fixed it all.