ID:262872
 
Code:
        DarkProtoman
name = "DarkProtoman"
icon = 'DarkProto.dmi'
HP = 3000
MaxHP = 5000
Strength = 500
Exp_Give = 150 //set the vars
gold_give = 500
var/mob/P //set a new var, the path is /mob/PC, and we will name it for easier typing P.
proc/Alert()
while(src) //While the mob is still here...
if(P in oview(5)) //If there is a PC in the area, as set with the P var above....
step_towards(src,P) //Step towards the PC
for(P in oview(1)) //If the mob is in its view of 1...
if(prob(50))
src.TalefingXX(P)
if(prob(50))
src.LifeSaberX2()
for(P in oview(2))
break
for(P in oview(3))
Multiple_Damage()
for(P in oview(4))
break //All these for() procs make it so when the mob is chasing you, and someone else gets closer to the mob then you are, it will stop chasing you and attack the other person. Also it makes it so you can code in that the mob will do stuff at different ranges. Its a great way to prevent types of Kiting (A.K.A. running away from the mob while another attacks it)
else //Else, in other words if the if statement or statements stated above is false...
step_rand(src) //Step randomly once.
sleep(10) //Wait one second
for(P in oview(5)) //But if a PC appears in sight of it...
break
Bump(mob/M) //Override this to tell what it does
if(istype(M,/mob/Player))
if(prob(50))
src.TalefingXX(M)
if(prob(50))
src.LifeSaberX2()
proc/Attack(mob/M)
if(M.Light ==1)
Strength*=2 //new proc called attack
flick("Attack",src) //"Stick_Attack" is an Icon state in the stick1 file, the flick proc makes it look like its actuly attacking the other mob. This is a visual only, it creats better gameplay, easier on the eyes.
sleep(2) //This give the animation time to play, and sets the attack delay for this mob. Dont put this on PCs or evil little errors will keep popping up. I can make it different though so just ask me how to make a more advanced attack verb for PCs.
var/damage = rand(1,Strength)
M.HP -= damage
view(src) << "[src] attacks [M] by [damage] hits!" //in view of the attacker, show this message...
M.check()
M.Death() //call the death proc to the victim
proc/Multiple_Damage()
var/mob/M
var/temp = src.icon // hold the icon in a variable
var/bshot = 'bshot.dmi'
src.icon = 'bass_summ.dmi'
for(M in oview(3))
if(M.key != "Pharaoh Atem" || M.key != "Supreme Zero" || M.key != "Celta" || M.key != "Hatijack" || M.name != "Dark Protoman" || M.name != "Sirius" || M.name != "Bass BX")
sleep(2)
M.overlays += bshot
M.HP -= 220
sleep(2)
M.overlays -= bshot
sleep(2)
M.check()
M.Death()
view()<<"<B>[src]: Multi Gun!!!!</font><B>"
src.icon = temp // revert the icon back
proc/MultigunX2()
if(src.HP >= 0)
var/mob/M
var/bshot = 'bshot.dmi'
for(M in oview(3))
sleep(2)
M.overlays += bshot
M.HP -= 220
sleep(2)
M.overlays -= bshot
usr.Custom -= 200
sleep(2)
M.check()
M.Death()
src.GUN1=0
src.GUN2=0
if(src.LifeSaber != 1 || src.Talefing != 1)
src.Multigun = 1
proc/LifeSaberX2()
var/LSB = src.Strength / 2
var/Recover = src.Strength / 4
var/mob/M
for(M in oview(1))
if(M.key != "Pharaoh Atem" || M.key != "Supreme Zero" || M.key != "Celta" || M.key != "Hatijack" || M.name != "Dark Protoman" || M.name != "Sirius" || M.name != "Bass BX")
M.overlays += M.z1
sleep(03)
M.overlays -= M.z1
sleep(03)
M.overlays += M.Slashed
sleep(03)
M.overlays -= M.Slashed
sleep(03)
M.overlays += M.z2
sleep(03)
M.overlays -= M.z2
sleep(03)
M.overlays += M.z3
sleep(03)
M.overlays -= M.z3
sleep(03)
M.HP -= LSB
src.HP += Recover
src.ZSABER = 0
src.LIFESWORD = 0
if(src.Talefing != 1 || src.Multigun != 1)
src.LifeSaber = 1
proc/TalefingXX(mob/M in oview(7))
if(M.key != "Pharaoh Atem" || M.key != "Supreme Zero" || M.key != "Celta" || M.key != "Hatijack" || M.name != "Dark Protoman" || M.name != "Sirius" || M.name != "Bass BX")
var/TalefingX = 'Talefing.dmi'
var/tale = usr.MaxHP * (src.FullCustom + usr.MP) - (src.Strength / 4)
src.loc = M.loc
src:y -= 1
M.overlays += M.z1
sleep(03)
M.overlays -= M.z1
sleep(03)
M.overlays += M.lightslsh
sleep(03)
M.overlays -= M.lightslsh
sleep(03)
M.overlays += M.Mura
sleep(03)
M.overlays -= M.Mura
src.loc = M.loc
src:y += 1
M.overlays += TalefingX
sleep(03)
M.overlays -= TalefingX
M.HP -= tale
M.check()
M.Death()
src.CHAOSLIGHT = 0
src.ZSABER = 0
if(src.LifeSaber != 1 || src.Multigun != 1)
src.Talefing = 1


Problem description:when i click on my commands to he use the alert proc, he attacks me too, even with this
if(M.key != "Pharaoh Atem" || M.key != "Supreme Zero" || M.key != "Celta" || M.key != "Hatijack" || M.name != "Dark Protoman" || M.name != "Sirius" || M.name != "Bass BX")
.Why?

"||" means "or". So, no matter what, even if they match one of those, there is no way to match all of them. I think you want to use "&&", which means "and", then if they match any of those, the statement will be false and the code will not execute.
In response to DarkCampainger
well, i did it, and the mob attacked himself o.O
In response to Pharaoh Atem
please help me, i need this for <big>TODAY</big>!!!!
In response to Pharaoh Atem
Do not bump a thread until 24 hours have passed and until the thread no longer appears on the first page of Code Problems. If you need help that immediately, go to a chat program like wiz_chat. The forums are not a real-time environment where you can expect a reply within minutes, let alone hours.

That said, Dark Campaigner gave you the right answer. Either you didn't implement it correctly or there's something else in your code causing the problem.

Of course, why you're hard-coding a list of keys for any reason I don't know either. Admins should be loaded from a file at runtime, never hard-coded, and if you want to check admin status during a proc you should use a var like if(!M.isadmin) instead.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
Do not bump a thread until 24 hours have passed and until the thread no longer appears on the first page of Code Problems. If you need help that immediately, go to a chat program like wiz_chat. The forums are not a real-time environment where you can expect a reply within minutes, let alone hours.

That said, Dark Campaigner gave you the right answer. Either you didn't implement it correctly or there's something else in your code causing the problem.

Of course, why you're hard-coding a list of keys for any reason I don't know either. Admins should be loaded from a file at runtime, never hard-coded, and if you want to check admin status during a proc you should use a var like if(!M.isadmin) instead.

Lummox JR

ok, sorry, but, i dont understand,
if(!M.isadmin)
checks if the Mob isnt an admin? im confused :S
In response to Pharaoh Atem
You need to make the var, and set isadmin=1 to admins.. He gave you a clear answer.
In response to Mysame
please, teach me, i dont understand.

i already defined the var, ok, and now, if i put
if(!M.isadmin)
he will make a think like this
if(M.isadmin != 1)
?
In response to Lummox JR
Lummox JR wrote:
Of course, why you're hard-coding a list of keys for any reason I don't know either. Admins should be loaded from a file at runtime, never hard-coded, and if you want to check admin status during a proc you should use a var like if(!M.isadmin) instead.

Lummox JR

i do it, but, runtime error: <font color = red>Infinite loop suspected--switching proc to background.
If it is not an infinite loop, either do 'set background=1' or set world.loop_checks=0.
proc name: Alert (/mob/NPC/Sirius/proc/Alert)
source file: sdfsd.dm,2355
usr: Pharaoh Atem (/mob/Player)
src: Pharaoh Atem\'s Sirius (/mob/NPC/Sirius)
call stack:
Pharaoh Atem\'s Sirius (/mob/NPC/Sirius): Alert()
Pharaoh Atem (/mob/Player): Alert Mode()</font>
In response to Pharaoh Atem
That's probably because you're constantly calling a proc without a sleep() or spawn().
In response to Mysame
Mysame wrote:
That's probably because you're constantly calling a proc without a sleep() or spawn().

No, that would cause a stack overflow. An infinite loop means he's in a for() or more likely a while() that doesn't sleep and isn't ending. In Alert(), you'll notice that there isn't a sleep() where there needs to be--only one part of the proc has that, and it isn't always reached.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
Mysame wrote:
That's probably because you're constantly calling a proc without a sleep() or spawn().

No, that would cause a stack overflow. An infinite loop means he's in a for() or more likely a while() that doesn't sleep and isn't ending. In Alert(), you'll notice that there isn't a sleep() where there needs to be--only one part of the proc has that, and it isn't always reached.

Lummox JR

how i fix it?
In response to Pharaoh Atem
Pharaoh Atem wrote:
An infinite loop means he's in a for() or more likely a while() that doesn't sleep and isn't ending. In Alert(), you'll notice that there isn't a sleep() where there needs to be--only one part of the proc has that, and it isn't always reached.

how i fix it?

Well gee, reading the post is always a good start.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
Pharaoh Atem wrote:
An infinite loop means he's in a for() or more likely a while() that doesn't sleep and isn't ending. In Alert(), you'll notice that there isn't a sleep() where there needs to be--only one part of the proc has that, and it isn't always reached.

how i fix it?

Well gee, reading the post is always a good start.

Lummox JR

i dont understand really nothing.
i really need this fastly.
In response to Pharaoh Atem
I don't know how you can't understand, but your english skills may explain that. "I really don't understand nothing"? That means that there is nothing you do not understand, hence you should be able to figure it out.

He basically said to make sure you have a delay procedure such as sleep() or spawn() within your loop, and make sure it terminates at some point. I can't imagine someone needing a proc to run continuously, except if maybe it's some sort of auto-AFK system or something similar.

Also, I don't think this is a 'need'. It's more of a want, especially since you can't take the time to make usre your posts are understandable and correct.
In response to CaptFalcon33035
i was thinking...

i will make a stop proc when its an admin, stop and return to "normal non-alert mode"
In response to Pharaoh Atem
!m.isadmin = (m.isadmin!=null) && (m.isadmin!="") && (m.isadmin!=0)

EDIT: That's what I originally wrote, but it's wrong. It should be:

!m.isadmin = (m.isadmin==null) || (m.isadmin=="") || (m.isadmin==0)
In response to Jp
Don't you have that backwards? =/
In response to Detnom
...Yes. I'll fix that. I'm not thinking today.
In response to Jp
Haha, it's alright. I had to read it two or three times myself, at first I wasn't sure if it was correct or not.