1
2
In response to Ter13
|
|
Yeah I get that pretty well I think. Like you said, I am tired so I can't think if i would just pop it under the other code or in somewhere else but I get what all of that coding does. that bottom set of code lost me though :p
|
In response to Blanke
|
|
Swap the last line I listed in that post with the line in mob/NPC/monster/proc/pursue() with the line that just says: "src.attack()". Just replace that line, and now it ought to work-ish.
|
In response to Ter13
|
|
gah, more issues.
Attacking.dm:36:error:src.damage:undefined var And that is when I replaced the thing. to mae it src.attack(src.target,src.damage) |
In response to Blanke
|
|
You have to define a variable called damage under the mob/NPC/Monster.
Then, you have to set it to an arbitrary value. Or perhaps a not-so arbitrary value. |
In response to Ter13
|
|
there isn't any errors. But there isn't any monster activity still X_D Well, I am tired now and dont want to code until i get the monsters attackin... So if you could maybe contemplate and think of something to make the mosnters attack Ter13? I will look over the code myself, I doubt I will find anything though. I am not too good of a coder :p Well, night everyone. Thanks for the help guys and thanks in advance Ter13 uf ya get the rest of the code for me =D
|
In response to Blanke
|
|
Works fine on my end.
Everything I gave you works great for me. I just slapped up a project with unmodified code, and it worked great. Must be something on your end interfering with my snippet... I had to make a slight change to the code though, monsters could be pinged if they already had a target, just forgot to add the line, but I edited it back in in my prior posts. |
In response to Ter13
|
|
Well, I'm still up :p I will just post all of my coding thus far. it isn't much. and I will shorten what I can.
mob I know, your code is like 65% of it XD |
In response to Blanke
|
|
Wow you provided way too much info here man, but I took a stab at what looked like the problem. I tried to rewrite it for you to be a little more efficient and working, so let me know how it turns out.
mob EDIT: I messed up your timing a little, so I fixed it. |
In response to The Naked Ninja
|
|
TNN, I really don't want to be rude, but you took a stab, and somehow managed to decapitate yourself.
You completely screwed the pooch when trying to fix this snippet, and didn't read half the posts in the thread. Don't mislead him, having a loop in every successful move, in this case, is actually much more efficient than the alternative. Second, you made the Move function LESS efficient in most cases, you completely misunderstand the use of find_target after losing the first target, and you just generally completely ruined the entire system. Well done. Couldn't have thrown the wrench at a better cog myself. |
In response to Ter13
|
|
He linked me to this post, I looked at what I saw wrong and I made it work better IMO. I didn't have time to read every post in this topic and I feel my method was alot better than what was given to him in the first place.
Recalling a procedure is redundant, and I explained the loop to him. I also didn't remove the find_target procedure, I simply said that it's meaningless with every player's step calling the focus of surrounding mobs. Whoever gave him this code is a horrible programmer, I figured it was his and I tried to make sense of it in the time allotted, I apologize if you fail to understand. -Ken P.S: The loop is much more efficient than the prior method, I'd like to know where you get your information. This whole snippet itself is terrible though, like I said I tried to make it a little better. I also directed him to a few useful libraries that would better aid him in learning to program, including Dantom's "Your First World". |
In response to The Naked Ninja
|
|
Speaking of efficiency, I think working with <code>area.Entered()</code> and <code>area.Exited()</code> to activate AI, while more complicated to implant, would be more efficient cpu-wise. I dislike checking nearest 12 squares every movement a player makes (which is probably over 20 times a second when 20 players are logged in).
|
In response to The Naked Ninja
|
|
Thanks a lot for that NN, I was wondering though. Cold I get those links again? Or the link to the topic you posted them in? I exited out of byond before I got to look at anything besides the first world thing.
|
In response to Blanke
|
|
Most of the good links can be found on The Start Page or Newbie Questions. Both of which I feel should be heavily publicized.
|
In response to The Naked Ninja
|
|
Okay. I remember most of the names of the libraries you mentioned. I will definetely look into them. Thanks again The Naked Ninja. :)
|
In response to The Naked Ninja
|
|
I'm sorry, TNN, the find_target function is NOT unnecessary. If one player moves out of the monster's range, it will search for other players already in the range. If it loses the target, and another player is standing right next to it, the monster will not chase the player until the other player moves.
Second, for the entire function being terrible, I'd like to know what you are talking about. The fact of the matter is, TNN, your method of doing this is more laggy than mine is. Second, your "fixed" version leaves a lot of functional bugs in the code. Third, you didn't even read half the posts in this thread. You can't just waltz in here, and start changing code you don't understand. If you didn't fully understand the snippet, you can't possibly be helping. |
In response to DivineO'peanut
|
|
What about area edges? You could literally walk up to a monster, and attack it, if you were on the edge of one area, and it was on the edge of another.
My method really doesn't cause a lot of lag, it seems like it would, but when you look at how little that loop is doing, and consider the alternatives, it's not at all that bad. |
In response to Ter13
|
|
You are nitpicking where it is not necessary. Obviously steps would be taken to avoid these sort of situations. For example: each area will have a "nearby" list which lists areas nearby that area, and when a client enters an area, every monster in that area and its nearby areas ping()s. Opposite when a client exits that area.
The concept is what's important here, not potent problems within the programming design of the concept. My method really doesn't cause a lot of lag, it seems like it would, but when you look at how little that loop is doing, and consider the alternatives, it's not at all that bad. That is true. Your method could probably handle 50 players at a time on a good server, but your method should also take a 100, or 200 players into consideration. When designing a system, you don't think about the average situation, but rather the high-end exceptional. |
In response to DivineO'peanut
|
|
Well then, I guess what I will do now then is look at the libraries I was given, and see what I can engender from those sources. Then I will paste Ter13's code by itself into an environment (You said it worked by itself) and then search for a good way to get things started.
|
1
2
Here, I'll give you an easy way to fix the problem.
This way, you can actually just change the pursue function's attack line to:
This way's kind of backwards, and I don't usually do it this way, but it's the quickest approach, and I don't want to stay awake much longer.
And still keep your attack verbs relatively the same.
Let me know if I lost you.