vsirin
First time out of the vault
![](https://www.nma-fallout.com/xencustomimages/nma/nma_0.gif)
So I dug up this old post and pretty much worked my way backwards from there, with much help (copying) from NovaRain's old post here.
Good news is, the tip about global, indiscriminate knockback - it works great. With melee weapons.
Here's the code I used for that:
Alas, my guns don't seem to be doing the job. At all. Any of them. The old post I linked to earlier led me to believe that it should indeed work on guns, so I'm probably doing something wrong.
It gets worse: I frankensteined up another script that actually checks for the specific weapon and then applies the knockback if it's the right gun. No dice. Hell, this one doesn't even work if I switch the target out to a spear.
So what am I doing wrong, in both cases? Thank you for your time!
Good news is, the tip about global, indiscriminate knockback - it works great. With melee weapons.
Here's the code I used for that:
Code:
#include "sfall.h"
#include "DEFINE.H"
#include "itempid.h"
procedure map_update_p_proc begin
if game_loaded then begin
set_attacker_knockback(dude_obj, 0, 8);
end
end
It gets worse: I frankensteined up another script that actually checks for the specific weapon and then applies the knockback if it's the right gun. No dice. Hell, this one doesn't even work if I switch the target out to a spear.
Code:
#include "sfall.h"
#include "DEFINE.H"
#include "itempid.h"
#define get_active_hand(slot) if (active_hand == 0) then slot := INVEN_TYPE_LEFT_HAND; \
else slot := INVEN_TYPE_RIGHT_HAND
procedure map_update_p_proc begin
if game_loaded then begin
variable critter := get_sfall_arg;
variable slot, item, i := -1;
if (critter == dude_obj) then begin
get_active_hand(slot);
item := critter_inven_obj(critter, slot);
end else begin
item := critter_inven_obj(critter, INVEN_TYPE_RIGHT_HAND);
end
if (obj_pid(item) == PID_SPEAR) then i := 42;
end
if (i == 42) then begin
set_weapon_knockback(self_obj, 0, 5);
end
end
So what am I doing wrong, in both cases? Thank you for your time!