Menu

#1961 set_schedule_type not working?

Unimplemented
closed-invalid
nobody
None
5
2016-06-26
2016-06-25
No

It appears some of the Usecode isn't working as expected. I wanted to try to make the automaton guards in Skullcrusher responsive, since they are stuck in Waiting unless attacked. It appears that using set_schedule_type does not work as expected, possibly if the NPC is in Waiting or Sleep as their current activity?

In this first snip of code, double-clicking the guard at the western gate of Skullcrusher does cause Flag 123 to be set, so the code is running, but no change in the NPC's schedule when I check via F2.

void Guard17 object#(0x4be) () // Automaton at entrance, NPC 190, Guard17, should talk when gate is opened. Flag 613 to test.
// Door open = Shape 936, sliding door frame 1, Quality 91. Non-open door is 303, same quality
{
if (event == DOUBLECLICK)
gflags[FOUND_FISHNETS] = true;
Guard17->set_schedule_type(STANDTHERE);
}

I also tried this on the automaton at sea, and if he is in Sleep the flag isn't set. If he is in Waiting it does set.

void Ded_Automaton object#(0x4b9) () // DED_AUTOMATON, NPC185 is unused in-game so good for testing purposes.
// His default schedule includes Sleep, Loiter, and Preach, never in Waiting.

{
if (event == DOUBLECLICK)
gflags[FOUND_FISHNETS] = true; // Flag 123, easy to remember.
Ded_Automaton->set_schedule_type(STANDTHERE);
}

In neither case do they switch their Current Activity to StandThere, #10. The Sleep disallowing things makes some sense, but how do I make them take action if they are in either Waiting (gflags works) or Sleep (gflags does not work) if I can't tell them what their current activity should be via new usecode?

Discussion

  • Knight Captain

    Knight Captain - 2016-06-25

    Looks like UI_set_schedule_type works correctly, but per the reference, that should be the same as using the NPC->set_schedule_type. http://exult.sourceforge.net/seventowers/ucc_ref.php?TYPE=5&DATAFILE=get_schedule_type

    To make this more confusing, the existing SIfixes code that uses NPC->set_schedule_type seems to work.

     
  • Knight Captain

    Knight Captain - 2016-06-25

    Looks like I messed up here, Guard17 should be GUARD17, as per the si_npcs.uc list.

     
  • Marzo Sette Torres Junior

    • status: open --> closed-invalid
     
  • Marzo Sette Torres Junior

    Hint: if it works on the original game and in mods, then it is not a bug.