ID:262209
 
Code:
mob/monsters
proc
idle()
return step_rand(src)

track(mob/M in view(src))
return step_towards(src,M)

flee()
step_away(src, enemy, 9)
if(enemy in view(10))
return
else
Powerup_()

AI_complete()
if(src.Dead==1)
del(src)
else
while(src.HitPoints >= src.MaxHitPoints)
for(var/mob/M in view(src))
while(!src.Dead && M.client && (M in view(src)))
if(src.HitPoints<src.MaxHitPoints&&src.dif >= 6)
src.fearc()
else
src.enemy = M
var/dist = get_dist(src,M)
if(dist == 1)
src.Attack(enemy)
if(dist ==4)
if(enemy in view(src))
src.track(enemy)
else
src.idle()
if(dist > 1&&dist < 4)
if(enemy in view(src))
src.track(enemy)
else
src.idle()
sleep(5)
while(src.HitPoints*4 < src.MaxHitPoints)
src.Powerup_()

sleep(30)
sleep (30)
return 1

//------------------//

mob/monsters
New()
..()
spawn() AI_complete(src)

var
enemy =0

proc
fearc()
if(src.HitPoints < src.MaxHitPoints)
src.flee()
Attack(mob/M in view(1))
if(M.NPC==0)
M.HitPoints -= src.HitPoints
var/ran = (rand(1,3))
if(ran == 1)
flick("punch",src)
view(6)<<"<b><font size = 1><font color = yellow>[src] punches [M] in the face!"
M.Update(src)
if(ran == 2)
flick("kick",src)
view(6)<<"<b><font size = 1><font color = yellow>[src] kicks [M] in the stomach!"
M.Update(src)
M.DeathCheck(src)
return
Powerup_()
var/aurao =0
retry
if(enemy in view())
src.flee()
if(src.HitPoints > src.MaxHitPoints)
spawn(5) AI_complete(src)
if(src.HitPoints < src.MaxHitPoints)
if(aurao == 0)
aurao = 1
src.HitPoints += src.MaxHitPoints / 15
sleep(10)
goto retry
else
return

mob
Move()
if(src.move ==0)
return
..()




//*Monsters*//
mob/monsters
var/dif
Raditz
name = "(EN) Raditz"
HitPoints = 1200
MaxHitPoints = 1200
Dead = 0
icon = 'Raditz.dmi'
NPC = 0
Strength = 30
Defense = 100
dif = 2
Race = "Raditz"


Problem description:

My radditz when u in range he attacks you but he wont move. he just stands there hes suppose to move but he dosent.
I am pretty sure you are using view() wrong. Try oview(src,6)
In response to N1ghtW1ng
Nope, he still dosent move



Dam it .....anyone?
In response to Dranzer_Solo
Any suggestions?
In response to Dranzer_Solo
mob/monsters
var/mob/target
New()
..()
Search()
proc
Search()
if(src.target)
step_to(src,target)
else if(locate(/mob) in oview(7))
for(var/mob/M in oview(7))
src.target = M
else step_rand(src)
sleep(5)
Search()

var/dif
Raditz
name = "(EN) Raditz"
HitPoints = 1200
MaxHitPoints = 1200
Dead = 0
icon = 'Raditz.dmi'
NPC = 0
Strength = 30
Defense = 100
dif = 2
Race = "Raditz"

You can go from there, right? I'm not sure how well it works. Check it and tell me what happens.
In response to Truculent
I think you need to have spawn() Search() . I might be wrong though.
In response to Truculent
Still cant get him to move -_-
In response to Truculent
If Search() keeps calling itself without spawn(), the game is going to crash. You also are using oview() incorrectly, as was pointed out earlier in the thread. Since this is a proc and usr doesn't enter into it, that should be oview(src), since oview() defaults to usr as a frame of reference.

Lummox JR
Well, you're doing a few thingshere that are wrong and need to be changed right away. For starters:
if(enemy in view(10))

There are two problems with that. One is that there's no reason to use view() instead of oview(), which is a little safer for this job. Another is that view() and oview() have usr as a default frame of reference, so you absolutely must specify src as a reference when using this in an AI proc, like so:
if(enemy in oview(10, src))


Another thing that needs to change right away is the abuse of goto. The goto command is like usr in procs or the : operator. There's a purpose for it, and a time and place to use it, but unless you absolutely know what you're doing and it's a very very unusual circumstance, you should never use it. Take a look at this snippet:
Powerup_()
var/aurao =0
retry
if(enemy in view())
src.flee()
if(src.HitPoints > src.MaxHitPoints)
spawn(5) AI_complete(src)
if(src.HitPoints < src.MaxHitPoints)
if(aurao == 0)
aurao = 1
src.HitPoints += src.MaxHitPoints / 15
sleep(10)
goto retry
else
return

That's a completely, unquestionably bogus use of goto. This can and should be done with a simple loop. That loop looks something like this:
Powerup_()
do
if(enemy in oview(src))
src.flee()
if(src.HitPoints > src.MaxHitPoints)
spawn(5) AI_complete(src)
break
if(src.HitPoints < src.MaxHitPoints)
src.HitPoints += src.MaxHitPoints / 15
sleep(10)
else
break
while(1)

Given that the logic of your loop is a little weird to follow anyway, I'd suggest looking that over for anything wrong as it could be a source of your troubles. Notice there's no clear condition on when to exit the loop; if HitPoints hits or passes its max value, the loop will run one more time. Usually with while() or do-while() it's customary to have some sort of end condition, like while(HitPoints<MaxHitpoints). Another reason it's always better to use while() instead of goto is that you then have a clear layout of the logic involved. (I also removed the aurao var entirely, since it wasn't doing anything whatsoever.)

Lummox JR
In response to Lummox JR
Ok i changed all of it and now it works :)+


Thanks for your help
Don't rip other people's coding.
In response to DeathAwaitsU
-_- I did not rip other peoples coding
In response to Dranzer_Solo
Funny then how it looks like the old AI system of Clan DBGT 2.
In response to DeathAwaitsU
I replaced mine with a newer(and better) one, and gave him the old one upon request.

[edit] It looks like alot of that has been altered from the original state too, though I lost the old version and can't tell for sure.[/edit]