ID:146054
 
Code:
mob/Jutsu/verb/Summon()
set category = "WOOT"
set name="Summon"
var/list/animal = list("Gama","None")
var/animall = input(src) in animal
switch(animall)
if("Gama")
if(usr.maxcp >= 800)
view(4)<<"[usr]: Die!"
sleep(10)
usr.cp -= usr.maxcp
usr.stamina -=usr.stamina
view(4)<<"Gama Appears!"
var/mob/enemy/Gama/M = new/mob/enemy/Gama (locate(usr.x+1,usr.y,usr.z))
M.owner=usr
sleep(300)
del(M)
else
src<<"You need over 800 CP to summon Gama!"
return

mob/verb/Attack(mob/M in get_step(usr,dir))
set name="Punch"
if(M.owner==src)
return
else
world<<"DEBUGGED!"


Problem description: The summoned gama attacks its owner. How can I stop this?

<font color=red><font size=-5>
I think it's in this line cause if im right when u click the verb it's sending the attack to usr and u are the usr lol so ur ganna have to make it (mob,dir)) ir somthing like that.


mob/verb/Attack(mob/M in get_step(usr,dir))


<font size=-5><font color=red>
I may be wrong but try this



 mob/verb/Attack/a=locate(/mob) in get_step(usr,usr.dir)
set name="Punch"
if(M.owner==src)
return
else
world<<"DEBUGGED!"
In response to Underoath Productions
Underoath Productions wrote:
<font color=red size=-5>
I think it's in this line cause if im right when u click the verb it's sending the attack to usr and u are the usr lol so ur ganna have to make it (mob,dir)) ir somthing like that.</font>

> mob/verb/Attack(mob/M in get_step(usr,dir))
>


Wrong. And for pete's sake, close your font tags.

Format:
get_step(Ref,Dir)

Returns:
The location of the new position.

Args:
Ref: Starting point or object.
Dir: One of NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST.

Calculate the position of a step from Ref in the direction Dir.
I can't see the attacking part itself, but you'll want to do a check to see if M is a client, enemy, or whatever you want able to attack. If you want your pet to attack something, you could do it like;
mob/verb/Summon_Attack(mob/A in get_step(usr,usr.dir))
for(mob/enemy/gama/M in view(usr,9))
if(M.owner==usr)
if(istype(A,/mob/enemy))
Attack(M,A)
mob/verb/Attack()
set name="Punch"
var/mob/M = locate(M in get_step(src,src.dir))
if(!M) return
if(src.owner==M)
return
else
world<<"DEBUGGED!"


I think you had M and src backwards, and there's no real reason to choose a mob in the square ahead of you, just have it locate one automatically. Give that a try, should work according to what your code looks like it's trying to accomplish.
In response to DerDragon
DerDragon wrote:
there's no real reason to choose a mob in the square ahead of you, just have it locate one automatically.

So, if there were 5 mobs in one square ahead of you, you'd have to attack them all if you only wanted to attack one?
In response to Sinoflife
You will attack the first one in the turf's contents list first. This is MUCH more feasible than selecting from a menu each time you swing. Chances are, mobs are dense, and there would only be one mob per turf anyways. I'm not a fan of click-per-swing combat systems in BYOND to begin with, but if I were to do it, this is definitely how. I'd probably run a check to make sure I'm attacking a hostile, or perhaps the last mob I was swinging at to begin with. Maeva uses round based combat, you target a mob and you automatically swing/fire as many times as you can per round, unless of course you're using spells or abilities instead. Movement is also handled automatically for players on slower connections which would be taken advantage of during lag.
In response to DerDragon
Ah, right.