ID:168801
 
I am wondering How do i go about doing this there arent many demos around say Player A and Player B were fighting how do i make i play B teleports behind Player A with out player A seeing him behind him till Play B starts attacking?

How do i go about this?
William22sa wrote:
I am wondering How do i go about doing this there arent many demos around say Player A and Player B were fighting how do i make i play B teleports behind Player A with out player A seeing him behind him till Play B starts attacking?

How do i go about this?

Would this be in verb form, click form?
(This is untested, but I believe it would work.)

mob
var
isinvis
verb
Teleport()
for(var/mob/M as mob in get_step(usr,usr.dir))
flick("teleportationimage",usr)
usr.loc=M.x+1
usr.invisiblity=1
usr.isinvis=1
usr.dir=EAST
Attack()
//Your attack stuff
if(usr.isinvis)
usr.isinvis=0
usr.invisibility=0

-Sin()
In response to Sinoflife
Now i get this error

attack22a.dm:13:error: if: expected end of statement

on line 13 i have

                if(M.npp == 0)


Thanks in advance
In response to William22sa
Unless that's a boolean expression, it needs to be if( !var )
In response to Sinoflife
There's no place for as in for().
In response to Audeuro
Audeuro wrote:
Unless that's a boolean expression, it needs to be if( !var )

Not needs, but it would be better, as well as being better "etiquette", as it makes it easier to notice we're checking for a null value.

Hiead
In response to DeathAwaitsU
Should i remove that line?
In response to William22sa
No, just change it to if(!M.npp).
In response to Hiead
Actually, it does need it. It not only checks for null, but it also checks for 0 or "". A simple, if( var == 0 ) would not check for all 3, whereas !var would.
In response to Audeuro
Now i get this error

attack22a.dm:13:error: view: expected end of statement

and on that line i have

                view(6) << "<font color = blue><i>[usr] throws a fury of punches at [M]!"


How can i fix this?

In response to Govegtos
Well, in that line your HTML is all wrong. That should be color=blue, not color = blue, and you forgot to close both tags.

However the actual error is in the line before. Often with "expected such-and-such" errors the real error occurs earlier.

Lummox JR