Hitting npc is a perception, more training

main
Cameron Murphy Reikes 2 years ago
parent e6aba970e0
commit 02d4cea01c

@ -1,5 +1,5 @@
// you will die someday // you will die someday
#define CURRENT_VERSION 4 // wehenver you change Entity increment this boz #define CURRENT_VERSION 5 // wehenver you change Entity increment this boz
#define SOKOL_IMPL #define SOKOL_IMPL
#if defined(WIN32) || defined(_WIN32) #if defined(WIN32) || defined(_WIN32)
@ -1631,7 +1631,7 @@ void request_do_damage(Entity *to, Vec2 from_point, float damage)
else if(true) else if(true)
{ {
to->damage += damage; to->damage += damage;
to->aggressive = true; process_perception(to, (Perception){.type = PlayerAction, .player_action_type = ACT_hits_npc});
to->vel = MulV2F(NormV2(SubV2(to->pos, from_point)), 15.0f); to->vel = MulV2F(NormV2(SubV2(to->pos, from_point)), 15.0f);
} }
else else
@ -2640,7 +2640,6 @@ void frame(void)
bool entity_talkable = true; bool entity_talkable = true;
if(entity_talkable) entity_talkable = entity_talkable && !it->is_tile; if(entity_talkable) entity_talkable = entity_talkable && !it->is_tile;
if(entity_talkable) entity_talkable = entity_talkable && it->e->is_npc; if(entity_talkable) entity_talkable = entity_talkable && it->e->is_npc;
if(entity_talkable) entity_talkable = entity_talkable && !it->e->aggressive;
if(entity_talkable) entity_talkable = entity_talkable && !(it->e->npc_kind == NPC_Skeleton); if(entity_talkable) entity_talkable = entity_talkable && !(it->e->npc_kind == NPC_Skeleton);
#ifdef WEB #ifdef WEB
if(entity_talkable) entity_talkable = entity_talkable && it->e->gen_request_id == 0; if(entity_talkable) entity_talkable = entity_talkable && it->e->gen_request_id == 0;
@ -2669,12 +2668,10 @@ void frame(void)
} }
// process dialog and display dialog box when talking to NPC // maybe get rid of talking to
if(player->state == CHARACTER_TALKING) if(player->state == CHARACTER_TALKING)
{ {
assert(gete(player->talking_to) != NULL); if(gete(player->talking_to) == 0)
if(gete(player->talking_to)->aggressive || !player->exists)
{ {
player->state = CHARACTER_IDLE; player->state = CHARACTER_IDLE;
} }
@ -2918,11 +2915,7 @@ void frame(void)
{ {
if(it->npc_kind == NPC_OldMan) if(it->npc_kind == NPC_OldMan)
{ {
bool face_left = false; bool face_left =SubV2(player->pos, it->pos).x < 0.0f;
if(it->aggressive)
{
face_left = SubV2(player->pos, it->pos).x < 0.0f;
}
draw_animated_sprite(&old_man_idle, elapsed_time, face_left, it->pos, col); draw_animated_sprite(&old_man_idle, elapsed_time, face_left, it->pos, col);
} }
else if(it->npc_kind == NPC_Skeleton) else if(it->npc_kind == NPC_Skeleton)

@ -120,7 +120,6 @@ typedef struct Entity
#ifdef WEB #ifdef WEB
int gen_request_id; int gen_request_id;
#endif #endif
bool aggressive;
bool walking; bool walking;
double shotgun_timer; double shotgun_timer;
bool moved; bool moved;

@ -124,6 +124,33 @@ TrainingSample samples[] = {
NPCDoSay(ACT_allows_player_to_pass, "You have the tripod, so let you pass I shall"), NPCDoSay(ACT_allows_player_to_pass, "You have the tripod, so let you pass I shall"),
}, },
}, },
{
.npc_kind = NPC_OldMan,
.perceptions = {
PlayerSay("Hey"),
NPCDoSay(ACT_none, "I'm just sitting here, what are you doing?"),
PlayerAct(ACT_hits_npc),
NPCDoSay(ACT_none, "Looks like you're ready to do what needs to be done."),
PlayerAct(ACT_hits_npc),
NPCDoSay(ACT_fights_player, "I won't stand for this assault."),
},
},
{
.npc_kind = NPC_Blocky,
.perceptions = {
PlayerSay("This crazy old man is circling me"),
NPCDoSay(ACT_none, "Sounds like a problem."),
PlayerSay("Yes, tell him to go away."),
NPCDoSay(ACT_none, "I'm sure it'll be fine"),
PlayerSay("No it won't"),
NPCDoSay(ACT_none, "Nahhhh"),
PlayerAct(ACT_hits_npc),
NPCDoSay(ACT_fights_player, "You don't have a tripod."),
PlayerItemChange(ITEM_Tripod),
PlayerSay("Look! I have the tripod! Please stop fighting me!"),
NPCDoSay(ACT_leaves_player, "As you wish."),
},
},
}; };

@ -2,7 +2,9 @@ Happening by END OF STREAM:
DONE - Payment working DONE - Payment working
DONE - Fixed timesep the gameplay (which means separate player rendering) DONE - Fixed timesep the gameplay (which means separate player rendering)
DONE - Maybe factor actions! into the game to replace ** stuff. In beginning of each line before quotes, have ACT@fights_player, or other actions, and by default ACT@nothing to force AI to say something about what action is performed DONE - Maybe factor actions! into the game to replace ** stuff. In beginning of each line before quotes, have ACT@fights_player, or other actions, and by default ACT@nothing to force AI to say something about what action is performed
- Help you fight and fight you actions DONE - Help you fight and fight you actions
- Handle wanting another request, dirty perception, when already waiting on a request
- Do not use webhooks (shitty, bad idea propagated by bad docs) query stripe for if the payment went through on request if not fulfilled yet
- New characters/items from fate - New characters/items from fate
- New art in - New art in
- Old man in beginning is invincible - Old man in beginning is invincible

Loading…
Cancel
Save