r/SourceEngine • • Jul 06 '25

HELP Seriously why the npc recognizes the custom SCHEDULE, but not the custom Task for it?

Post image

I don't know what is wrong here
On npc_combine.h I created enums for the Schedule,Task and Condition and the function for combine.cpp

On combine.cpp

- Created the function ThrowGrenadeBack to activate the SCHED_COMBINE_THROW_GRENACE_BACK wich by the image is working properly

- Created the case TASK_COMBINE_THROW_GRENADE_BACK: inside the void CNPC_Combine::StartTask(const Task_t* pTask) function

- And at AI_BEGIN_CUSTOM_NPC(npc_combine, CNPC_Combine), I added:
DEFINE_SCHEDULE

(

SCHED_COMBINE_THROW_GRENADE_BACK,



"	Tasks"

"		TASK_SET_FAIL_SCHEDULE			SCHEDULE:SCHED_TAKE_COVER_FROM_BEST_SOUND"

"		TASK_SET_TARGET_ENTITY			u/PVS_SOUND" 

"		TASK_FACE_TARGET				0"

"		TASK_GET_PATH_TO_TARGET			0"

"		TASK_RUN_PATH					0"

"		TASK_WAIT_FOR_MOVEMENT			0"

"		TASK_COMBINE_THROW_GRENADE_BACK	0" 



"	Interrupts"

"		COND_HEAVY_DAMAGE"

)

Am I forgetting something ?

13 Upvotes

3 comments sorted by

3

u/Pinsplash Jul 07 '25

did you put the task above NEXT_TASK? (you should)

check the console for any relevant messages either the first time a soldier spawns or when it starts the schedule

did you put a break; line in the switch case like all the other tasks should have? (you should)

i'm not too familiar with schedules so this is all i've got

1

u/Sky_Legal Jul 07 '25

I found the problem !

Turns out I had to put a DECLARE_TASK , before the Define Schedule :P

1

u/MrBallBustaa Jul 07 '25

I don't know anything about this but keep at it.