I want a say verb only to talk with mob/player
I want a attack verb only to attack a mob/enemy
but.. this code doesnt work.. any solution?
verb
attack(M as mob/enemy in oview(1))
thanks.
ID:151079
![]() May 15 2001, 8:22 am
|
|
It works. Thank you.
With the verb whisper, in the list to talk, appears too the enemys and me. I only want to see other players. susurrar(M as mob in view(10), msg as text) set category = "Hablar" if (!istype(M)) usr << "¡No puedes hablar a [M]!" return else usr << "susurras a [M]: <font color=blue>[msg]</font>" M << "[usr] te susurra: <font color=blue>[msg]</font>" (ahh,its in spanish :-) |
With the verb whisper, in the list to talk, appears too the enemys and me. I only want to see other players. You'll probably have to create a special proc to handle this, like so: proc/ListNonEnemies(mob/myUsr, myView) var/L[0] // Create a list for(var/mob/M in view(myUsr, myView)) if(!istype(M, /mob/enemy)) L += M // Add mob to list only if not an enemy return L mob/verb/whisper(M as mob in ListNonEnemies(usr, 10), T as text) // And so on... I *think* that should work, but I can't guarantee it! |
Here is the final code:
proc/ListNonEnemies(mob/myUsr, myView) var/L[0] // Create a list for(var/mob/M in view(myUsr, myView)) if(!istype(M, /mob/enemigo) & M!=usr) L += M // Add mob to list only if not an enemy (I add code to evite the player whisper him.) return L verb/susurrar(M as mob in ListNonEnemies(usr, 10), T as text) set category = "Hablar" usr << "susurras a [M]: <font color=blue>[T]</font>" M << "[usr] te susurra: <font color=blue>[T]</font>" |
Ah. You're on the right track, but "as" can only be used with "input types"--mob, obj, num, text, and so on. What you probably need to do is something like this:
attack(mob/enemy/M as mob in oview(1))
if(!istype(M))
usr << "[M] isn't an enemy!"
return
else
// Attack here...