Various modding questions

Interesting.

Ok, thanks for that Nova.

I'm still not fully understanding the steps and what happens where, but let's leave it at that for now. Thanks.

I've kind of figured out what I need to do.

I also did some testing with the combatdamage hook and afterhitroll hook in combination and found some interesting things which helped me. I'll post them later in sfall thread.
 
1. What is the difference between:

critter_skill_level
( who, skill );

and

has_skill( who, skill );

Any functional or application difference? Not sure which I'm supposed to use.



2. I need to get the "weapon" object as well as attack_type inside the afterhitroll hook script.

I think I can maybe get the weapon using:

critter_inven_obj2(who, INVEN_TYPE_LEFT/RIGHT_HAND)

But I am not sure, and I don't know about the attacktype. I need attack type to distinguish which unarmed attack.





3. Also, where is the active_hand() defined? I wonder if it would be of use here and how it should be used. I'm trying to learn it's correct usage and placement.
 
Last edited:
1. No difference. See define.h:
#define critter_skill_level(X,Y) has_skill(X,Y)

3. It's a sfall opcode, so there's no need to define it in headers like newer sfall metarule functions.
It returns which active item slot the player is currently using: 0 - left, 1 - right.
 
1. No difference. See define.h:
:facepalm: uh, how did I miss that!

Thanks again Nova. And for (3) as well.

So I guess it can't be used on NPCs, I mean do NPCs have 2 item slots? I'm not clear on that, I think I read somewhere that they don't.

Any suggestions about how I should get the active weapon such that it would work for both player AND NPCs?
 
But I am not sure, and I don't know about the attacktype. I need attack type to distinguish which unarmed attack.
for next sfall: get_object_data(combat_data, C_ATTACK_HIT_MODE) returns current attack mode (ATKTYPE_* sfall.h)
for more information, see the get_attack_type function.
 
So I guess it can't be used on NPCs, I mean do NPCs have 2 item slots? I'm not clear on that, I think I read somewhere that they don't.
NPCs have two slots, and they always use weapons from the right slot.
 
get_active_weapon
aah, I had read this one and I thought it was only for dude_obj, I didn't notice the subtle trickery of logic there. Thanks.


for next sfall: get_object_data(combat_data, C_ATTACK_HIT_MODE) returns current attack mode (ATKTYPE_* sfall.h)
for more information, see the get_attack_type function.

Thanks.

I'll try get_attack_type in afterhitroll and see if it works. And I suppose when you say "for more information, see the get_attack_type function." you are speaking figuratively :lol:, cause I found no more information on it. And I checked:
sfall.h
define.h
define_lite.h
define_extra.h
sfall opcode list.txt
sfall function notes.txt
sslc readme.txt
in editor descriptions;

Is there any other source of information for function descriptions and usage?

Particularly I wanna understand which function the C_attack offsets are used in and learn its usage. Are they used in the attack_complex function?

I can't find any information on attack_complex in those documents. Not even in sfall opcode list.

Anyway, thanks for you guy's help, I'm almost done with the mod. It's working out nicely.
 
attack_complex is a vanilla opcode, check commands.doc from BIS mapper.
I don't think it has much help to your damage mod, as it just makes a critter initiate combat with the specified target (usually the player).
By default its arguments are kinda tricky: called_shot & num_attacks are unused, and you can only set the result flags for the target with setting both attacker_results and
target_results equal value (attacker_result does nothing to the attacker itself). That's why 99.9% of use cases in vanilla scripts are simply invoke the basic "attack()" macro.
 
I see.

The only point of interest in to change critical flags in order to influence combat messages, or to influence critical level.

I'm trying to figure out how to do what MR.Stalin said here:

1. how the combat message can be replaced for new event.
use the flags to change the critical states.
#define C_ATTACK_FLAGS_SOURCE (0x14) // see DAM_* values in define.h
#define C_ATTACK_FLAGS_TARGET (0x30) // see DAM_*
Just wanna know where how you use the compute attack data offsets as noted in define_extra. So I can learn any usefulness it might have.
 
Set the combat data via C_ATTACK_* offsets in CombatDamage hook (if the attribute is not covered by the hook arguments), the message printing is after that.
 
Last edited:
I think we are misunderstanding each other a bit and going in a circle, or at least I don't understand what you mean.

There is no C_attack function. There is attack() which is a short hand for attack_complex(), and that's it. (which you already know.)

and in combat damage hook, there is 12 get arguments, and there is the 5 return arguments. (again you know.)

So I don't understand what you mean when you say "set the combat data via C_ATTACK_* offsets in CombatDamage hook".

Set what combat data, via what function? :confused:
 
Last edited:
So I don't understand what you mean when you say "set the combat data via C_ATTACK_* offsets in CombatDamage hook".
Set what combat data, via what function?
In next sfall release (should be in this weekend) with get/set_object_data as Mr.Stalin said.
There's a pointer to the combat data as the new 13th argument for CombatDamage just like SubCombatDamage, so you don't need to call the also-newly-added combat_data function, which does the same to return the pointer. You can check define_extra.h and notes.txt in next release.

var := get_object_data(arg13, C_ATTACK_UNUSED);
set_object_data(arg13, C_ATTACK_MESSAGE, 5000);

The combat_data function is useful in other attack process related hooks when you need to get some extra info from the combat data.
 
Set the combat data via C_ATTACK_* offsets in CombatDamage hook (if the attribute is not covered by the hook arguments), the message printing is after that.
This is only available in SubCombatDamage and it still doesn't work as the set/get functions are broken in the current version of sfall
 
Is there any other source of information for function descriptions and usage?
SFALL opcodes with descriptions in SSE4.0
int get_attack_type - Returns the set attack type for the current weapon in the main interface slot.
(descriptions are only in Russian language.)
 
I see. Sweet!

that settles it.

Edit*
SFALL opcodes with descriptions in SSE4.0
int get_attack_type - Returns the set attack type for the current weapon in the main interface slot.
(descriptions are only in Russian language.)

ahh! ok.
 
I am writing the knockback module and need to check critter flag noknockback.

define_extra shows flag value as: #define CFLG_NOKNOCKBACK 16384
but the offset to get the flag is not clear to me.

There is a flag in:

Code:
// common prototype offsets for get/set_proto_data
#define PROTO_PID             (1)
#define PROTO_TEXTID          (4)
#define PROTO_FID             (8)
#define PROTO_LDIST          (12)
#define PROTO_LINT           (16)
#define PROTO_FLAG           (20)           <---------------
#define PROTO_FLAG_EXT       (24)
#define PROTO_SCRIPTID       (28)


and there is a flag in:
Code:
// critters
#define PROTO_CR_FLAGS                   (32)  // Critter Flags       <-------------
#define PROTO_CR_BONUS_SRENGTH          (176)
#define PROTO_CR_BONUS_PRCEPTION        (180)
#define PROTO_CR_BONUS_ENDURANCE        (184)
#define PROTO_CR_BONUS_CHARISMA         (188)
....
....


I'm guessing its 32. But I'm not sure. Is this right?


Also to check if a critter is already knocked down, its is_critter_prone(who) , right?
 
Last edited:
1. Yes, it's PROTO_CR_FLAGS for CRFL_* flags.
2. Yes, you can check some vanilla scripts for examples. I think it would be more helpful to have a tool to search text in script sources if you want to check practical usage of some vanilla macro/function.
 
Last edited:
Man, that would be great. I wish I knew how to set that up. Can you recommend anything?
 
Back
Top