How do I make npc's fight each other and pc's, but not fight npc's and pc's on there side?
Because i just relized that when i started making Dynasty Warriors Online. Could someone please help me out?
ID:173887
![]() Nov 3 2003, 7:22 am
|
|
![]() Nov 3 2003, 10:31 am
|
|
I have no clue about how about going to doing this.
|
I am not bumping, you just annoyed me, everyone has a bad comment, i just wanted soem help not someone telling me stuff like that.
Thanks, Nave |
How about making a team variable for each mob, and in the npc's attack, check the variable for what team the mob, who the npc is attacking, is on, and if the mob is on the same team as the npc, then just finish the proc, and if not, then attack.
|
Ok now I have most of it done, but I am confused, I don't know where to put the if blah blah do not attack
heres the code: mob/Enemies/proc/Attack(mob/M) //We need to set this as the default for Attack. |
They keep following me and it look like they are attacking still, here is my code:
mob/Enemies/proc/Attack(mob/M) //We need to set this as the default for Attack. |
I think maybe the problam lies in this peice of code?
mob/Enemies/proc/Wander(walking_delay) //We need to define this before hand as a default for Wander. In this, we made our own argument again. |
Nave wrote:
mob/Enemies/proc/Attack(mob/M)flick("Attack",src) //Flick the attack animation like this. if(Dynasty == src.Dynasty)With this, im assuming that M is the person that the mob is attacking, so shouldnt it be M.Dynasty == src.Dynasty. Also, the if statement should be the first thing that is checked, instead of flicking an attack icon. mob/Enemies/proc/Attack(mob/M) |
Nave wrote:
I think maybe the problam lies in this peice of code? > mob/Enemies/proc/Wander(walking_delay) //We need to define this before hand as a default for Wander. In this, we made our own argument again. <edit> My mistake. What needs to be done i think is to incorporate whats below if(found == 0) into what i wrote above. Hence for(var/mob/PC/M in oview(5)) Hopefully this helps you more. If anyone else can elaborate on this, feel free to do so. Im sorry if this dont work, as i havent had a chance to try it. |
Ive been looking around and i cant seem to find what M means.........i just used it, seeing it from other peoples code
|
Ive been looking around and i cant seem to find what M means.........i just used it, seeing it from other peoples code That sums up your whole problem right there... you're copying things without knowing what they are. Let me tell you what M means. Pay attention because this is actually a good lesson in programming. :P M means nothing. M means everything. M means whatever you tell the computer it means. M is, in short, a variable. What does variable mean? It means something "varies", which means, "It can mean anything." You ever take an algebra class? They want you to figure out what X means, but as soon as you figure out that X = 7, they give you a different problem and it turns out that X = pi squared times the cosine of eleventeen! What gives? What gives is that variables like X and M don't actually mean anything. There is no M until you put something in your code saying that there is an M, and even then, that M doesn't mean anything until you tell the computer what it does mean. It doesn't even have to be M. It could be X. It could be Yellow. It could be Steve. The computer doesn't know the difference. The label (M, X, Steve, whatever) is purely for human eyes, so we can tell the difference between two variables. Why is this important? The computer's not a mind reader. You want to make a proc that has someone attack someone or get something, you need to tell it, in no uncertain terms, exactly what is being attacked or gotten, and we won't understand the terms the computer uses to track these things and it sure as hell doesn't understand us. So you make a label, M. You tell the computer that M is a mob, by actually calling it (the first time you mention M in a bit of code) mob/M, so when you refer to M.HP, it doesn't go "Wait a minute! objs don't have HP! How do I know this isn't an obj!" Then you do something to point the computer to exactly what mob this label you call "M" refers to. For instance, for (var/mob/M in oview(src)) M.hp += green This tells the computer, "First, find me all the mobs that src can see, one at a time. We'll call them M for convenience. Add green to their hp." The key to all this is that the computer doesn't know what M is, it doesn't know what hp is, it doesn't know what green is, and it barely has a clue what mob is to begin with... in the whole equation, only you know what any of those things mean and the computer takes your word for it. If you're just kinda bluffing (M? I know M! M's a good friend of mine!), then the computer, the poor trusting fool that it is, will take your word at face value and blithely generate all kinds of errors. |
Nave wrote:
Ive been looking around and i cant seem to find what M means.........i just used it, seeing it from other peoples code M doesnt mean any thing, the people you have seen defigned M Example mob/proc/Somthing(mob/M) |
OOOOOOH I GET IT.....thanks alot, i thought M was like src, or usr. Well anyways can anyone help me out? The npc's wont attack each other.
|