-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make ammo effect able to run EoC #75291
Conversation
I'm assuming you're asking why only one message is displayed. diff --git a/src/npctalk.cpp b/src/npctalk.cpp
index 94f785f0dc..cf06a46029 100644
--- a/src/npctalk.cpp
+++ b/src/npctalk.cpp
@@ -4330,11 +4330,11 @@ talk_effect_fun_t::func f_message( const JsonObject &jo, std::string_view member
return [snip_id, message, outdoor_only, sound, snippet, same_snippet, type_string,
popup_msg, popup_w_interrupt_query_msg, interrupt_type, global, is_npc]
( dialogue const & d ) {
- Character *target;
+ Character const *target;
if( global ) {
target = &get_player_character();
} else {
- target = d.actor( is_npc )->get_character();
+ target = static_cast<talker const*>( d.actor( is_npc ) )->get_character();
}
if( !target || target->is_npc() ) {
return; Second issue is that Lines 4339 to 4341 in bfeb1ff
If you meant a condition, then try thisdiff --git a/src/condition.cpp b/src/condition.cpp
index 41e06c54f8..8a5321553f 100644
--- a/src/condition.cpp
+++ b/src/condition.cpp
@@ -1314,6 +1314,13 @@ conditional_t::func f_player_see( bool is_npc )
};
}
+conditional_t::func f_has_beta()
+{
+ return []( dialogue const & d ) {
+ return d.has_beta;
+ };
+}
+
conditional_t::func f_no_assigned_mission()
{
return []( dialogue const & d ) {
@@ -2554,6 +2561,7 @@ parsers_simple = {
{"u_is_furniture", "npc_is_furniture", &conditional_fun::f_is_furniture },
{"has_ammo", &conditional_fun::f_has_ammo },
{"player_see_u", "player_see_npc", &conditional_fun::f_player_see },
+ {"has_beta", &conditional_fun::f_has_beta },
};
conditional_t::conditional_t( const JsonObject &jo ) |
I didn't expect the issue would be in f_message. I also tried to use
Yes, but would it even work? In order to check beta exists you need to reach beta, which is nullptr, no? UPD: no, it works as you expect it, and doesn't cause any errors. Thank you! |
Co-authored-by: andrei <[email protected]>
Summary
None
Purpose of change
I don't like how new damage types are used only because they can run EoC on attack
Describe the solution
Add ammo_effect field, that runs EoC
Testing
That's the problem, i use next EoC to test thing
but for hellish reason result looks like this:
So
u_message
is not run, despiteu_name
being assigned correctly. Any anotheru_
effects do not apply. I have no idea why it happens, my code uses the same tools as any another eoc-running function. I suspectnpc_
do not work correctly eitherSecondly, because of projectile ability to miss the target, EoC can be built either with beta talker as victim, or without beta talker whatsoever. It complicates the thing, because user is not able to use
npc_
functions, because, well, we don't have an effect to check is beta talker presented (and i don't even know can such effect exist).UPD:
Andrei helped to solve both issues, so it's good now (theoretically)
Additional context
@andrei8l sorry to bother you, but may i ask for some help?