mob |
Problem description: i got this part of the attack system and the monster can attck me but i cant seem to attack, plz help
ID:819040
Jun 16 2012, 7:21 pm (Edited by moderator on Jun 16 2012, 7:22 pm)
Keywords: attack
(See the best response by LordAndrew.)
|
||
Code:
Problem description: i got this part of the attack system and the monster can attck me but i cant seem to attack, plz help | ||
#1 Jun 16 2012, 7:43 pm
|
|
Did you make a attack verb for users?
| |
#2 Jun 16 2012, 7:46 pm
|
|
i have not yet cause i dont know to make one
| |
#3 Jun 16 2012, 7:53 pm
|
||
Its the same thing.
Let me edit this abit
| ||
#4 Jun 16 2012, 7:55 pm
|
||
Attack code is what was wrong, it should be something like
| ||
#5 Jun 16 2012, 7:58 pm
|
|
The attack proc is not wrong only the part of the if damage the thing that is wrong is that he didnt make a attack verb for the players
| |
#6 Jun 16 2012, 7:58 pm
|
||
This should work | ||
#7 Jun 16 2012, 8:03 pm
|
|
im getting a duplicate for that attack verb
| |
#8 Jun 16 2012, 8:04 pm
|
|
Yeah
| |
This seems like an extremely silly way to handle this, you're repeating code when you could easily do:
Of course, that's just an example of simplifying that particular snippet. The whole implementation fails to utilize object-orientated practices. You could be breaking down the Fight() procedure into multiple procedures, which would allow you to modify and allow for special cases for specific mobs. This post elaborates more into that. | ||
#10 Jun 16 2012, 8:10 pm
|
|
i understand, so what would be a better way to fix that?
i got this code from a resourse and isnt my creation. | |
To be honest, the code snippet you found is just all around terrible.
The sequence involving repeatedly calling for(P in oview(#)) and breaking within it is.. why is it doing that. I would suggest having a look at Forum_account's demo here, as it explains AI and shows you how to build upon it to make it both smart and efficient. | |
LordAndrew wrote:
To be honest, the code snippet you found is just all around terrible. i doubt he will understand that is better if he got the falacy turtoial because hes new at coding it will be more simple for him instead then looking in everyone of those codes to find the perfect one http://www.byond.com/forum/?post=109791 | |
#13 Jun 16 2012, 9:38 pm
|
|
i mean im not a full out beginner but i cant create codes from scratch yet. ugh, but thanks guys for trying to help and anymore suggestions will be great
honestly i would erase it all cause i dont like how they roam around, i rather then stay still till they are attacked or have a small view | |
#14 Jun 18 2012, 3:21 am
|
||
This is evidently simplified as I didn't bother to add any target variables and so on, but it serves your purpose. I believe you'd be better off rewriting this entire code snippet. | ||
#15 Jun 23 2012, 8:30 pm
|
|
yea i rewrote it all thanks guys for trying to help
| |