mob
NPC
Yusuke
icon = 'NPC.dmi'
icon_state = "Yusuke NPC"
New()
AI()
proc
AI()
while(src)
if(attacker)
walk_to(src,attacker)
if(get_dist(src,attacker) == 1)
Attack(src,attacker,"Str","Injuries",100,0,100)
sleep(5)
Problem description:
Code:
mob Problem description: |
Jul 25 2014, 8:52 pm
|
|
Game runs slow when i run it
|
It's because in the case that there's no attacker, there's no sleep instruction.
You need an else case and a sleep(). |
proc |
//mob ai |
In response to YoungJR1232
|
|
Prob not the best by far but
#define IDLE 0 also i was kinda lazy on this but you shouldn't have all your enemies running this loop constantly you should delete the AI when its not needed just wasting CPU. Also you shouldn't keep recalling walk_to its already a loop in itself pretty much as it will keep going after being called once. |
ok i understand the concept of that but im ttrying to think how to make it so when the mob is attacked then it starts following the attacker any suggestions?
|
In response to YoungJR1232
|
|
YoungJR1232 wrote:
ok i understand the concept of that but im ttrying to think how to make it so when the mob is attacked then it starts following the attacker any suggestions? yes instead of calling AI() when a mob is created call it when they are attacked. |
oh smart thinking and is there a way to call something for a specific mob so like after a verb that relates to combat it runs AI for the certain mob
|
In response to Gokussj99
|
|
It's been a while since I've seen any braced DM.
|