Closed BrunoMine closed 6 years ago
@BrunoMine In the schedule entries, order now is very important. I see your schedule entries array has elements 1, 1, 2. Try using 1, 2, 3 and try again.
Also, small hint:
In the logs I see:
2018-04-17 11:55:38: [Server]: [advanced_npc] INFO: NPC "Kiko" is executing: nil
Instead of nil
, it should show the program name, this could be part of the issue.
Also, I have fixed a small bug around the place-finding code, which might help. Please update your branch to the latest.
Correct the code (also edited in the initial post) and updated advanced_npc, but the problem continues.
2018-04-17 15:41:06: [Server]: [advanced_npc] INFO: Initializing NPC at (128,10,19)
2018-04-17 15:41:06: [Server]: [advanced_npc] INFO: Successfully initialized NPC with name "Joseph", sex: male, is child: nil, texture: {
"mobs_igor3.png"
}
2018-04-17 15:41:07: [Server]: Executing scheduler for NPC "Joseph"
2018-04-17 15:41:07: [Server]: [advanced_npc] INFO: Current process queue size: 0
2018-04-17 15:41:07: [Server]: [advanced_npc] INFO: NPC "Joseph" is executing: nil
2018-04-17 15:41:07: [Server]: [advanced_npc] INFO: NPC "Joseph" is executing: nil
2018-04-17 15:41:07: [Server]: [advanced_npc] ERROR: Attempted to execute program with name nil.
Program doesn't exists.
2018-04-17 15:41:08: ACTION[Server]: 888 sets time to 22000
2018-04-17 15:41:08: [Server]: [advanced_npc] INFO: Time: 22
2018-04-17 15:41:08: [Server]: Executing scheduler for NPC "Joseph"
2018-04-17 15:41:08: [Server]: [advanced_npc] INFO: Current process queue size: 1
2018-04-17 15:41:09: [Server]: Executing scheduler for NPC "Joseph"
2018-04-17 15:41:09: [Server]: [advanced_npc] INFO: Current process queue size: 1
2018-04-17 15:41:10: [Server]: Executing scheduler for NPC "Joseph"
2018-04-17 15:41:10: [Server]: [advanced_npc] INFO: Current process queue size: 1
2018-04-17 15:41:11: [Server]: Executing scheduler for NPC "Joseph"
2018-04-17 15:41:11: [Server]: [advanced_npc] INFO: Current process queue size: 1
2018-04-17 15:41:12: [Server]: Executing scheduler for NPC "Joseph"
2018-04-17 15:41:12: [Server]: [advanced_npc] INFO: Current process queue size: 1
2018-04-17 15:41:13: [Server]: Executing scheduler for NPC "Joseph"
2018-04-17 15:41:13: [Server]: [advanced_npc] INFO: Current process queue size: 1
2018-04-17 15:41:14: [Server]: Executing scheduler for NPC "Joseph"
2018-04-17 15:41:14: [Server]: [advanced_npc] INFO: Current process queue size: 1
The main problem is that the program name is nil, for some reason. I will try to reproduce this issue in my local.
try using mobs_npc (igor)
Found the issue and pushed a fix. Basically the scheduler didn't expect two things:
state process
definedThanks for this! Btw, there is the concept of state process
which I have to define better, but basically it is a process that is run by default when no other process is running , and is run continously. The usecase is for example, being idle, wandering, etc.
You can see two state process implemented, advanced_npc:idle
and advanced_npc:wander
. These processes might give you an idea on how to implement wandering on certain nodes ( I know you do this for your mod)
have you already pushed the fix for the development branch?
I had committed but not actually pushed... sorry. Pushed now!
The problem still persists. Maybe I need to fix something in the code. Do you know what the problem is?
2018-04-18 10:04:09: [Server]: [advanced_npc] INFO: Initializing NPC at (120,10,22)
2018-04-18 10:04:09: [Server]: [advanced_npc] INFO: Successfully initialized NPC with name "Alexis", sex: male, is child: nil, texture: {
"mobs_igor6.png"
}
2018-04-18 10:04:10: [Server]: Executing scheduler for NPC "Alexis"
2018-04-18 10:04:10: [Server]: [advanced_npc] INFO: Current process queue size: 0
2018-04-18 10:04:11: [Server]: Executing scheduler for NPC "Alexis"
2018-04-18 10:04:11: [Server]: [advanced_npc] INFO: Current process queue size: 0
2018-04-18 10:04:12: [Server]: [advanced_npc] INFO: Time: 23
2018-04-18 10:04:12: [Server]: Executing scheduler for NPC "Alexis"
2018-04-18 10:04:12: [Server]: [advanced_npc] INFO: Current process queue size: 0
2018-04-18 10:04:13: [Server]: Executing scheduler for NPC "Alexis"
2018-04-18 10:04:13: [Server]: [advanced_npc] INFO: Current process queue size: 0
2018-04-18 10:04:14: ACTION[Server]: 888 sets time to 22000
2018-04-18 10:04:14: [Server]: [advanced_npc] INFO: Time: 22
2018-04-18 10:04:14: [Server]: Executing scheduler for NPC "Alexis"
2018-04-18 10:04:14: [Server]: [advanced_npc] INFO: Current process queue size: 0
2018-04-18 10:04:15: [Server]: Executing scheduler for NPC "Alexis"
2018-04-18 10:04:15: [Server]: [advanced_npc] INFO: Current process queue size: 0
2018-04-18 10:04:17: [Server]: Executing scheduler for NPC "Alexis"
2018-04-18 10:04:17: [Server]: [advanced_npc] INFO: Current process queue size: 0
2018-04-18 10:04:18: [Server]: Executing scheduler for NPC "Alexis"
2018-04-18 10:04:18: [Server]: [advanced_npc] INFO: Current process queue size: 0
2018-04-18 10:04:19: [Server]: Executing scheduler for NPC "Alexis"
2018-04-18 10:04:19: [Server]: [advanced_npc] INFO: Current process queue size: 0
2018-04-18 10:04:20: [Server]: Executing scheduler for NPC "Alexis"
2018-04-18 10:04:20: [Server]: [advanced_npc] INFO: Current process queue size: 0
2018-04-18 10:04:21: [Server]: Executing scheduler for NPC "Alexis"```
Right, forgot tell you that you need to change the function for schedule entries: Instead of "npc.schedule.entry.set()" the correct function is: "npc.schedule.entry.put()". Arguments are fine, just change "set" for "put"
Ok, now it worked, but why? I thought set
was the most correct because i am setting a new schedule.
The method names follow (or at least try) data structure naming convention. Since schedules are a kind of map, it has:
put
: add new itemget
: get entriesset
: update existing entryIn this case since entry for 22 doesn't exists, it can't update.
I'm just doing initial testing to see the changes. I place a bed and a npc next door, but it seems he does not want to sleep. It gets paralyzed only. After a few tries I just get this message in the debugger.
Debug
register npc mobs redo