GORIS SCRIPT fit the Non Helmet PA. Second Round!

Hi there.

When I was doing my party orders mod I came up with that problem as well. I really didn't bother much with it and moved on.

You can try a different order for the instructions or put in yet another animation, though I doubt Fallout can manage so much animations without messing the proper sequence.

If it helps you this is the part of the code of my mod where the holster weapon is run (note the comments):

Code:
procedure put_away_weapon(variable oC) begin 
 
	inven_unwield(oC);	// unwields without animation 
	reg_anim_clear(oC); 
	/*reg_anim_begin(); 
	  reg_anim_animate (oC, ANIM_put_away, -1); 
	reg_anim_end();*/ 
	//inven_unwield(oC);	//unwields with animation but weapon anim stays (not good) 
 
	iNum_npcs += 1; 
	oWho := oC; 
end

try the function inven_unwield() before and after an anim_clear instruction to see the problems in each case.

Edit: it seems inven_unwield is always without animation for the dude_obj. Oh well.
 
Well, my endless quest with FO's fucked up engine continues....

My next question is:

Does anyone have any experience using the anim function?:

fallouteditor9.png


(from the mapper doc)

My problem is with the 'direction' integer. It's set at 0 to run in the default direction (forwards) but i really need it to run backwards. Setting it to anything other than 0 will make it do so, but the animation appears to crap out on the last frame, and then stall. Then ALL animations from then on stall on the last frame!! :shock: :crazy:

Am i doing something wrong? Or this is just another broken engine function?
 
Josan12 said:
Well, my endless quest with FO's fucked up engine continues....

Modder's bane.

My problem is with the 'direction' integer. It's set at 0 to run in the default direction (forwards) but i really need it to run backwards. Setting it to anything other than 0 will make it do so, but the animation appears to crap out on the last frame, and then stall. Then ALL animations from then on stall on the last frame!!


Personally I have no idea. I always try to keep myself a mile away from FO scripted animations. Your best bet is to post the relevant code here to see the potentially wronginess(?) of it and/or check other scripts where that function is used.

Maybe the problem lies in using specific animations. Or not.
 
@Josan12

I'm not sure I understand your question exactly, but over in the RP 2 suggestions thread (page 34) I posted an example that makes heavy use of the anim command in a scripted dance sequence. If you look at that maybe it would help you in understanding the animation commands better.
 
Ok, i found a way round the problem. When the script changes the ART_FID, I used a different critter PID for the reverse animation.
But in case anyone ever ends up trying to use the reverse function of the anim command, i strongly suspect it's broken.

Now for my next question :crazy: :mrgreen:

Here's my code:

Code:
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_ROCKET_LAUNCHER) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_ROCKET_LAUNCHER)

Instead of INVEN_TYPE_RIGHT/LEFT_HAND is there a way i can just say 'active item slot'??
 
Ok, reading my post i can see again i'm not being very clear about my problem. Here's my full code:

In obj_dude combat_p_proc:

Code:
procedure combat_p_proc begin

 //bigguns
 if (spec_ani != 1) and 
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) == PID_POWERED_ARMOR) or 
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) == PID_HARDENED_POWER_ARMOR) and
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_FLAMER) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_FLAMER) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_PLASMA_RIFLE) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_PLASMA_RIFLE) or
  (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_LASER_RIFLE) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_LASER_RIFLE) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_LASER_RIFLE_EXT_CAP) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_LASER_RIFLE_EXT_CAP) or
  (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_M60) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_M60) or
  (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_LIGHT_SUPPORT_WEAPON) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_LIGHT_SUPPORT_WEAPON) or
  (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_YK42B_PULSE_RIFLE) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_YK42B_PULSE_RIFLE) or
  (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_IMPROVED_FLAMETHROWER) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_IMPROVED_FLAMETHROWER) or
(obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_TURBO_PLASMA_RIFLE) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_TURBO_PLASMA_RIFLE) 
 
then begin
 art_change_fid_num(dude_obj, FID_HAPOWR);
 anim(dude_obj, ANIM_falling, 0);
 spec_ani := 1;
display_msg("combat start");
 end

 
 //miniguns
else if (spec_ani != 1) and 
(obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) == PID_POWERED_ARMOR) or 
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) == PID_HARDENED_POWER_ARMOR) and
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_MINIGUN) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_MINIGUN) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_AVENGER_MINIGUN) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_AVENGER_MINIGUN) or
  (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_VINDICATOR_MINIGUN) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_VINDICATOR_MINIGUN) or
  (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_GATLING_LASER) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_GATLING_LASER)
 
then begin
art_change_fid_num(dude_obj, FID_HAPOWR);
 anim(dude_obj, ANIM_up_stairs_right, 0);
spec_ani := 1;
 display_msg("combat start");
end

 //RK Launcher
else if (spec_ani != 1) and 
(obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) == PID_POWERED_ARMOR) or 
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) == PID_HARDENED_POWER_ARMOR) and
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_ROCKET_LAUNCHER) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_ROCKET_LAUNCHER)
 
 then begin
art_change_fid_num(dude_obj, FID_HAPOWR);
 anim(dude_obj, ANIM_up_stairs_left, 0);
spec_ani := 1;
 display_msg("combat start");
end

 //Hammers
else if (spec_ani != 1) and 
(obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) == PID_POWERED_ARMOR) or 
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) == PID_HARDENED_POWER_ARMOR) and
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_SLEDGEHAMMER) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_SLEDGEHAMMER) or
  (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_SUPER_SLEDGE) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_SUPER_SLEDGE)
 
 then begin
art_change_fid_num(dude_obj, FID_HAPOWR);
 anim(dude_obj, ANIM_down_stairs_right, 0);
spec_ani := 1;
 display_msg("combat start");
end

 //Rifles
else if (spec_ani != 1) and 
(obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) == PID_POWERED_ARMOR) or 
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) == PID_HARDENED_POWER_ARMOR) and
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_ASSAULT_RIFLE) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_ASSAULT_RIFLE) or
  (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_ASSAULT_RIFLE_EXT_MAG) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_ASSAULT_RIFLE_EXT_MAG)
  (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_SHOTGUN) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_SHOTGUN) or
  (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_ASSAULT_RIFLE_EXT_MAG) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_ASSAULT_RIFLE_EXT_MAG)
 
 then begin
art_change_fid_num(dude_obj, FID_HAPOWR);
 anim(dude_obj, ANIM_down_stairs_right, 0);
spec_ani := 1;
 display_msg("combat start");
end

//all other weapons
else if (spec_ani != 1) and 
(obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) == PID_POWERED_ARMOR) or 
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) == PID_HARDENED_POWER_ARMOR) 
then begin
 art_change_fid_num(dude_obj, FID_HAPOWR);
 anim(dude_obj, ANIM_magic_hands_up, 0);
 spec_ani := 1;
display_msg("combat start");
 end
// end
 
 end

As you can see, i've had to set the game to use different 'transition animations' for different weapons. This is due to the graphics engine limitations. A bit ridiculous i know, but a man's gotta script what a man's gotta script.

But aside from this, you can see all it really does is: IF the dude is wielding x weapon, and is wearing power armor, THEN change the critters art, play a transition animation (helmet on/off)

Then, in critter_proc:


Code:
procedure critter_p_proc begin

 //bigguns
  if (not(combat_is_initialized)) and (spec_ani == 1) and
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) == PID_POWERED_ARMOR) or 
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) == PID_HARDENED_POWER_ARMOR) and
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_FLAMER) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_FLAMER) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_PLASMA_RIFLE) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_PLASMA_RIFLE) or
  (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_LASER_RIFLE) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_LASER_RIFLE) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_LASER_RIFLE_EXT_CAP) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_LASER_RIFLE_EXT_CAP) or
  (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_M60) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_M60) or
  (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_LIGHT_SUPPORT_WEAPON) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_LIGHT_SUPPORT_WEAPON) or
  (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_YK42B_PULSE_RIFLE) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_YK42B_PULSE_RIFLE) or
  (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_IMPROVED_FLAMETHROWER) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_IMPROVED_FLAMETHROWER) or
(obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_TURBO_PLASMA_RIFLE) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_TURBO_PLASMA_RIFLE) 
 
 then begin
       //Combat end animation
     art_change_fid_num(dude_obj, FID_NAPOWR);
     anim(dude_obj, ANIM_falling, 0);
      spec_ani := 0;
      
   display_msg("combat end");
   end
 
  //miniguns
else if (not(combat_is_initialized)) and  (spec_ani == 1) and 
(obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) == PID_POWERED_ARMOR) or 
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) == PID_HARDENED_POWER_ARMOR) and
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_MINIGUN) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_MINIGUN) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_AVENGER_MINIGUN) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_AVENGER_MINIGUN) or
  (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_VINDICATOR_MINIGUN) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_VINDICATOR_MINIGUN) or
  (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_GATLING_LASER) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_GATLING_LASER)
 
then begin
art_change_fid_num(dude_obj, FID_NAPOWR);
 anim(dude_obj, ANIM_up_stairs_right, 0);
spec_ani := 0;
 display_msg("combat end");
end

//RK Launcher
else if (not(combat_is_initialized)) and (spec_ani == 1) and 
(obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) == PID_POWERED_ARMOR) or 
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) == PID_HARDENED_POWER_ARMOR) and
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_ROCKET_LAUNCHER) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_ROCKET_LAUNCHER)
 
 then begin
art_change_fid_num(dude_obj, FID_NAPOWR);
 anim(dude_obj, ANIM_up_stairs_left, 0);
spec_ani := 0;
 display_msg("combat end");
end

 //Hammers
else if (not(combat_is_initialized)) and (spec_ani == 1) and 
(obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) == PID_POWERED_ARMOR) or 
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) == PID_HARDENED_POWER_ARMOR) and
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_SLEDGEHAMMER) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_SLEDGEHAMMER) or
  (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND)) == PID_SUPER_SLEDGE) or
 (obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND)) == PID_SUPER_SLEDGE)
 
 then begin
art_change_fid_num(dude_obj, FID_NAPOWR);
 anim(dude_obj, ANIM_down_stairs_right, 0);
spec_ani := 0;
 display_msg("combat end");
end

//all other weapons
 else if (not(combat_is_initialized)) and (spec_ani == 1) and
(obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) == PID_POWERED_ARMOR) or
(obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_WORN)) == PID_HARDENED_POWER_ARMOR) then begin
      //Combat end animation
 
     art_change_fid_num(dude_obj, FID_NAPOWR);
     anim(dude_obj, ANIM_magic_hands_up, 0);
           // reg_anim_begin();
           // reg_anim_animate(dude_obj, ANIM_magic_hands_up, -1);
           // reg_anim_end();
   
      spec_ani := 0;
      
   display_msg("combat end");
   end

This, essentially, does the reverse.


The player is supposed to just have x weapon equipped, start combat, initiate the combat proc animation and art change, then finish combat and initiate the critter_proc art change back and animation.


My problem is this:
If the player switches item slots, they can skip the combat_proc variable set and the game will endless play the critter_proc transition animation. I know it's to do with the variable setting. But as i'm a noob scripter (i'm an art guy really) i can't figure it out. So i'm sure one of you expert scripters can show me how i can solve this. As i posted above - i suspect if there was an argument i could use to replace the LEFT/RIGHT HAND with just 'active item slot' it would solve this, though i'm not sure if it exists/is possible.

PS - what does "!" mean in a script? :oops:
 
Instead of INVEN_TYPE_RIGHT/LEFT_HAND is there a way i can just say 'active item slot'??

You can just make a macro to avoid typing that much.


PS - what does "!" mean in a script?

Logical negation. A != B means A not equal B. In some languages you use ! instead of NOT.
 
pelicano said:
Instead of INVEN_TYPE_RIGHT/LEFT_HAND is there a way i can just say 'active item slot'??

You can just make a macro to avoid typing that much.

Umm, ok, thanks, I've got an idea what a macro is but it might be
better to leave that until i've some more basics down!

PS - what does "!" mean in a script?

pelicano said:
Logical negation. A != B means A not equal B. In some languages you use ! instead of NOT.

Ahh. I see. Thanks. So am i correct in thinking A := B means A DOES equal B?

But back to my problem. After more testing, it appears my problem is actually something quite different. The script above sucessfully changes the art FID. BUT, when i go into the inventory screen it changes right back to the FID the armor defines! (in my case, NAPOWR)

This MUST be a common problem! Surely someone has experience of this and why it's happening, and what i can do to the above script to solve it?
 
I'm sorry, but is this topic about Power Armored Deathclaw?? :shock:

If so, I'll get anxious to see the critter animation \o/
 
Josan12 said:
Umm, ok, thanks, I've got an idea what a macro is but it might be
better to leave that until i've some more basics down!

Macros. When you type FID_HAPOWR you are using a macro (defined in the file ARTFID.H). Macros are a good thing.

In your case you could try this:
[spoiler:71f6fcf514]#define is_armed(x) (((obj_item_subtype(critter_inven_obj(x,1))) == item_type_weapon) or \
((obj_item_subtype(critter_inven_obj(x,2))) == item_type_weapon))
#define dude_current_wpn ((critter_inven_obj(dude_obj,1) + critter_inven_obj(dude_obj,2)) * is_armed(dude_obj))
#define pid_dude_weapon obj_pid(dude_current_wpn)

And then just use pid_dude_weapon instead of obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_RIGHT_HAND))... obj_pid(critter_inven_obj(dude_obj,INVEN_TYPE_LEFT_HAND))...
[/spoiler:71f6fcf514]

Do you use the sfall compiler? In that case I've got a shorter version to check if the dude_obj is holding a big gun, a minigun, whatever, using the weapon proto offsets.

So am i correct in thinking A := B means A DOES equal B?

Yes but don't mix it with A == B.
A := B is an assignation. A == B is a logic operation.

Inside IF's and other conditional structures you use A == B.

But back to my problem. After more testing, it appears my problem is actually something quite different. The script above sucessfully changes the art FID. BUT, when i go into the inventory screen it changes right back to the FID the armor defines! (in my case, NAPOWR)

This MUST be a common problem! Surely someone has experience of this and why it's happening, and what i can do to the above script to solve it?

While the inventory screen is open no script is run so you have to "reapply" the fid change every time. Check if the player is wearing the proper armor and if the fid is the correct one every frame/heartbit.
 
pelicano said:
In your case you could try this:

#define is_armed(x) (((obj_item_subtype(critter_inven_obj(x,1))) == item_type_weapon) or \
((obj_item_subtype(critter_inven_obj(x,2))) == item_type_weapon))
#define dude_current_wpn ((critter_inven_obj(dude_obj,1) + critter_inven_obj(dude_obj,2)) * is_armed(dude_obj))
#define pid_dude_weapon obj_pid(dude_current_wpn)

Thanks. But ... where would i put this?

EDIT: from the guide you linked me (thx) am i correct in understanding it goes in command.h? Does it matter where in command.h?

Do you use the sfall compiler? In that case I've got a shorter version to check if the dude_obj is holding a big gun, a minigun, whatever, using the weapon proto offsets.

No - i'm just using the basic watcom complier. Should i be using the sfall compiler?

While the inventory screen is open no script is run so you have to "reapply" the fid change every time. Check if the player is wearing the proper armor and if the fid is the correct one every frame/heartbit.

Ok. Well, i tried putting this:

Code:
      if (combat_is_initialized) and (spec_ani == 1) then begin
        art_change_fid_num(dude_obj, FID_NAPOWR);
      end

in combat_p_proc but no joy. Do you know of a 'heartbeat' proc i can run this under that will work in-combat?? Critter_proc is the only 'heartbeat' proc that runs itself every game heartbeat, but i know for sure it doesn't run in-combat....
 
from the guide you linked me (thx) am i correct in understanding it goes in command.h? Does it matter where in command.h?

you can put the macro in whatever header file (*.h file) you want as long as you include it in your script. However you can also put the macros in the script itself. Right after the #include section and before the variables definition section, usually.

No - i'm just using the basic watcom complier. Should i be using the sfall compiler?

If you are using sfall in your fallout then yes, highly advisable. Default fallout scripting can be quite messed up as it is sometimes (as you can see :)).


I've translated your code into an sfall global script (again?). Maybe that can help/inspire you somewhat.

Compiled with the last sfall version (2.8): GL_PA_test2.int
Source:
[spoiler:ba2096d0ba]
Code:
procedure start;

#include "..\HEADERS\ANIMCOMD.H"

#define FID_HAPOWR	(16777217) // Fixed 	Hero Androgenous Power Armor	
#define FID_NAPOWR	(16777246) // Fixed	NPC Androgenous Power Armor
#define PID_POWERED_ARMOR                   (3)
#define PID_HARDENED_POWER_ARMOR            (232)

#define item_type_weapon	(3)

#define anim_hammer	(3)
#define anim_rifle	(7)
#define anim_biggun	(8)
#define anim_minigun	(9)
#define anim_rl		(10)

#define inven_unwield(x)					metarule(43, x)
#define art_change_fid_num(WHO, NUM)	metarule3(107,WHO,NUM,0)

#define is_armed(x)			(((obj_item_subtype(critter_inven_obj(x,1))) == item_type_weapon) or \
                           ((obj_item_subtype(critter_inven_obj(x,2))) == item_type_weapon))
#define dude_current_wpn	((critter_inven_obj(dude_obj,1) + critter_inven_obj(dude_obj,2)) * is_armed(dude_obj))
#define pid_dude_weapon		obj_pid(dude_current_wpn)

#define wearing_PA			((obj_pid(critter_inven_obj(dude_obj, 0)) == PID_HARDENED_POWER_ARMOR)or \
                           (obj_pid(critter_inven_obj(dude_obj, 0)) == PID_POWERED_ARMOR))

#define ptr_weapon_anim(x)		get_proto_data(obj_pid(x),0x24)

variable spec_ani;
variable wpn;

procedure start begin
   if (game_loaded) then begin
      spec_ani := 0;
      set_global_script_repeat(1);
   end else begin
      if(combat_is_initialized)then begin
         if ((spec_ani != 1) and (wearing_PA)) then begin
            //Combat begin animation
            art_change_fid_num(dude_obj, FID_HAPOWR);
            spec_ani := 1;
            display_msg("combat start.");

            if(ptr_weapon_anim(dude_current_wpn) == anim_hammer)then begin
               anim(dude_obj, ANIM_magic_hands_middle, 0);
            end
            if(ptr_weapon_anim(dude_current_wpn) == anim_rifle)then begin
               anim(dude_obj, ANIM_magic_hands_middle, 0);
            end
            else if(ptr_weapon_anim(dude_current_wpn) == anim_biggun)then begin
               anim(dude_obj, ANIM_magic_hands_middle, 0);
            end
            else if(ptr_weapon_anim(dude_current_wpn) == anim_minigun)then begin
               anim(dude_obj, ANIM_magic_hands_middle, 0);
            end
            else if(ptr_weapon_anim(dude_current_wpn) == anim_rl)then begin
               anim(dude_obj, ANIM_magic_hands_middle, 0);
            end
            else begin
               anim(dude_obj, ANIM_magic_hands_middle, 0);
            end

         end
      end else if((spec_ani == 1) and (wearing_PA))then begin
         //Combat end animation
         if(dude_current_wpn != 0)then begin
            wpn := dude_current_wpn;
            rm_obj_from_inven(dude_obj, wpn);
            add_obj_to_inven(dude_obj, wpn);
         end
         art_change_fid_num(dude_obj, FID_NAPOWR);
         spec_ani := 0;
         display_msg("combat end.");

         if(ptr_weapon_anim(dude_current_wpn) == anim_hammer)then begin
            anim(dude_obj, ANIM_magic_hands_middle, 0);
         end
         if(ptr_weapon_anim(dude_current_wpn) == anim_rifle)then begin
            anim(dude_obj, ANIM_magic_hands_middle, 0);
         end
         else if(ptr_weapon_anim(dude_current_wpn) == anim_biggun)then begin
            anim(dude_obj, ANIM_magic_hands_middle, 0);
         end
         else if(ptr_weapon_anim(dude_current_wpn) == anim_minigun)then begin
            anim(dude_obj, ANIM_magic_hands_middle, 0);
         end
         else if(ptr_weapon_anim(dude_current_wpn) == anim_rl)then begin
            anim(dude_obj, ANIM_magic_hands_middle, 0);
         end
         else begin
            anim(dude_obj, ANIM_magic_hands_middle, 0);
         end
      end
      if ((spec_ani == 0) and (obj_art_fid(dude_obj) != FID_NAPOWR) and (wearing_PA)) then begin
         /*if(dude_current_wpn != 0)then begin
            wpn := dude_current_wpn;
            rm_obj_from_inven(dude_obj, wpn);
            add_obj_to_inven(dude_obj, wpn);
         end*/
         if(not(is_armed(dude_obj)))then begin
            art_change_fid_num(dude_obj, FID_NAPOWR);
         end
      end

   end
end
[/spoiler:ba2096d0ba]
 
Thankyou Pelicano. You're very helpful.

But what about my problem with the script not updating the ART_CHANGE_FID? Can you recommend a way i can solve this? As i posted
above i don't know of a 'heartbeat' proc that will work in-combat ....
 
Honestly, I don't know. That's why I converted the code to a sfall global script. To run it every frame even in combat.

As you've said, the combat proc it isn't run by heartbeats; it only runs when a combat event happen.
 
pelicano said:
Honestly, I don't know. That's why I converted the code to a sfall global script. To run it every frame even in combat.

As you've said, the combat proc it isn't run by heartbeats; it only runs when a combat event happen.

I see. So you're saying that sfall GL scripts are run every frame, even in combat? But the GL you compiled for me doesn't appear to solve the problem ... :scratch: The dude will still revert back to NAPOWR when i go into the inventory screen....

Is there no solution to this silly little problem? :(

EDIT: or am i being dumb and you're source above doesn't include a 'refresh critter art' check? Oh dear, now i'm getting confused .... :crazy:

EDIT2: I had an idea: the root of this problem with the art FID wanting to change back is essentially that it's getting conflicting commands, right? I mean - when you put on the armor it tells the game to change to x ART_FID but then the script (sfall GL or otherwise) is telling it to change to y ART_FID. So maybe the solution is to have the script tell the game to change the armor's assigned ART_FID? Is this possible?
 
what? doesn't work for you? hmmm.

It has the check and everything. Let's see:
Code:
   if (game_loaded) then begin
      spec_ani := 0;
      set_global_script_repeat(1);
   end else begin

The set_global_script_repeat(1); part makes this script to be run every 1 frame.


Code:
      if ((spec_ani == 0) and (obj_art_fid(dude_obj) != FID_NAPOWR) and (wearing_PA)) then begin
         /*if(dude_current_wpn != 0)then begin
            wpn := dude_current_wpn;
            rm_obj_from_inven(dude_obj, wpn);
            add_obj_to_inven(dude_obj, wpn);
         end*/
         if(not(is_armed(dude_obj)))then begin
            art_change_fid_num(dude_obj, FID_NAPOWR);
         end
      end

and this part (at the very bottom; ignore the commented out code) makes the check and should revert you to the desired fid when you come back from the inventory screen. Maybe I got wrong the fid?

Try to understand the code and if you don't understand something, ask away.

Edit:
Josan12 said:
So maybe the solution is to have the script tell the game to change the armor's assigned ART_FID? Is this possible?

Yes, it is. Using the sfall fuction set_proto_data to change the power armor proto on the fly from the script.
 
pelicano said:
Code:
      if ((spec_ani == 0) and (obj_art_fid(dude_obj) != FID_NAPOWR) and (wearing_PA)) then begin
         /*if(dude_current_wpn != 0)then begin
            wpn := dude_current_wpn;
            rm_obj_from_inven(dude_obj, wpn);
            add_obj_to_inven(dude_obj, wpn);
         end*/
         if(not(is_armed(dude_obj)))then begin
            art_change_fid_num(dude_obj, FID_NAPOWR);
         end
      end

I changed NAPOWR to HAPOWR and it did what expected - if dude is wearing PA, every frame it tries to change from NAPOWR to HAPOWR. BUT - only when the critter moves (! :shock:) Of course, this resulted in the head of the critter 'flickering'. Ok - as you say, thats what the script should do.
But in-combat it does nothing. Nada. Strange huh? Are you sure sfall runs in combat?


pelicano said:
Josan12 said:
So maybe the solution is to have the script tell the game to change the armor's assigned ART_FID? Is this possible?

Yes, it is. Using the sfall fuction set_proto_data to change the power armor proto on the fly from the script.

Ok, well then maybe this is the best solution. I looked the set_proto_data command up - here it is:

0x8205 - void set_proto_data(objptr, int offset, int value)

objptr = PID_POWERED_ARMOR
int offset = ??? do you know what the offset is, Pelicano? Is it 0x8205??
int value = Umm - i guess this is where we tell it to change the FID of the armor from HAPOWR to NAPOWR (or whatever)?

Is this correct? Or am i going for noob of the year again?!
 
Ugh, I'm confused now. Could you please explain to me again what we are supposed to accomplish? I mean what the dude_obj must look like when in combat, when out of combat, while holding a weapon, etc... I think I lost the train here.

Sfall script run just fine in combat so probably I misunderstood something.

Anyway, and just for the sake of replying something useful, the set_proto_data you need to use are these:

Code:
set_proto_data(obj_pid(critter_inven_obj(dude_obj,0)),0x64,FID_HAPOWR); 
set_proto_data(obj_pid(critter_inven_obj(dude_obj,0)),0x68,FID_HAPOWR); 
 
or 
 
set_proto_data(obj_pid(critter_inven_obj(dude_obj,0)),0x64,FID_NAPOWR); 
set_proto_data(obj_pid(critter_inven_obj(dude_obj,0)),0x68,FID_NAPOWR);

0x64 is the offset for the Male FiD. 0x68 for the Female. Be aware that now you'll run into the reversed problem. You won't see the changes in the proto edit until you enter and exit the inventory screen. Funny, uh? :D
 
pelicano said:
Ugh, I'm confused now.

Me too brother, me too :crazy:

pelicano said:
Could you please explain to me again what we are supposed to accomplish? I mean what the dude_obj must look like when in combat, when out of combat, while holding a weapon, etc... I think I lost the train here.

Ok, my goal is this:

1) To make the dude use one art FID in combat (helmeted PA - HAPOWR), and a different one out of combat. (unhelmeted PA - NAPOWR)
Easy, right?!? :crazy: :lol:
The only problem here, is that when we go into the inven screen it resets the art FID.

2) To play a transition animation between these changes:

Due to the limitations of the engine, i've had to create different animations for each weapon type (don't ask) This is why i've had to put in all those weapon checks (that you've kindly consolidated - with the help of sfall.

Am i going a bout this the right way?
 
Okey.

1) That much is done. Even the inventory reset thing. Really.

2) I don't know about those limitations (and I won't ask) but you got that covered already, right?

Below there's yet another version of the global script. This time compile it yourself and make sure it goes well smoothly. Then ingame equip a power armor, equip a weapon, start combat, etc etc...

This _should_ work. I tested it just fine in a fallout 2 installation with the unofficial patch and sfall v2.8. Move out of the script folder other global scripts that may interfere.

Source (Remeber to name the file GL<whatever>.ssl):
[spoiler:c9543162fe]
Code:
procedure start;

#include "..\HEADERS\ANIMCOMD.H"

#define FID_HAPOWR	(16777217) // Fixed 	Hero Androgenous Power Armor	
#define FID_NAPOWR	(16777246) // Fixed	NPC Androgenous Power Armor
#define PID_POWERED_ARMOR                   (3)
#define PID_HARDENED_POWER_ARMOR            (232)

#define item_type_weapon	(3)

#define anim_hammer	(3)
#define anim_rifle	(7)
#define anim_biggun	(8)
#define anim_minigun	(9)
#define anim_rl		(10)

#define inven_unwield(x)					metarule(43, x)
#define art_change_fid_num(WHO, NUM)	metarule3(107,WHO,NUM,0)

#define is_armed(x)			(((obj_item_subtype(critter_inven_obj(x,1))) == item_type_weapon) or \
                           ((obj_item_subtype(critter_inven_obj(x,2))) == item_type_weapon))
#define dude_current_wpn	((critter_inven_obj(dude_obj,1) + critter_inven_obj(dude_obj,2)) * is_armed(dude_obj))
#define pid_dude_weapon		obj_pid(dude_current_wpn)

#define wearing_PA			((obj_pid(critter_inven_obj(dude_obj, 0)) == PID_HARDENED_POWER_ARMOR)or \
                           (obj_pid(critter_inven_obj(dude_obj, 0)) == PID_POWERED_ARMOR))

#define ptr_weapon_anim(x)		get_proto_data(obj_pid(x),0x24)

procedure animate_dude;

variable spec_ani;
variable wpn;

procedure start begin
   if (game_loaded) then begin
      spec_ani := 0;
      set_global_script_repeat(1);
   end else begin
      if(combat_is_initialized)then begin
         if ((spec_ani != 1) and (wearing_PA)) then begin
            /***  Combat begin animation -- Put on Helmet (FID_HAPOWR)   ***/
            if(obj_art_fid(dude_obj) == FID_NAPOWR)then begin
               art_change_fid_num(dude_obj, FID_HAPOWR);
               call animate_dude;
            end
            spec_ani := 1;
            display_msg("combat start.");
         end
      end else if((spec_ani == 1) and (wearing_PA))then begin
         /***  Combat end animation -- Remove Helmet (FID_NAPOWR)  ***/
         //Holster current weapon, if any (runs holster animation)
         if(dude_current_wpn != 0)then begin
            wpn := dude_current_wpn;
            rm_obj_from_inven(dude_obj, wpn);
            add_obj_to_inven(dude_obj, wpn);
         end
         art_change_fid_num(dude_obj, FID_NAPOWR);
         call animate_dude;
         spec_ani := 0;
         display_msg("combat end.");
      end
      // ->Always running outside combat. Makes sure dude is not wearing the helmet (while in P.A. and no weapons held)
      if ((spec_ani == 0) and (obj_art_fid(dude_obj) != FID_NAPOWR) and (wearing_PA)) then begin
         if(not(is_armed(dude_obj)))then begin
            art_change_fid_num(dude_obj, FID_NAPOWR);
         end
      end
   end
end

procedure animate_dude begin
   if(ptr_weapon_anim(dude_current_wpn) == anim_hammer)then begin
      anim(dude_obj, ANIM_magic_hands_middle, 0);
   end
   if(ptr_weapon_anim(dude_current_wpn) == anim_rifle)then begin
      anim(dude_obj, ANIM_magic_hands_middle, 0);
   end
   else if(ptr_weapon_anim(dude_current_wpn) == anim_biggun)then begin
      anim(dude_obj, ANIM_magic_hands_middle, 0);
   end
   else if(ptr_weapon_anim(dude_current_wpn) == anim_minigun)then begin
      anim(dude_obj, ANIM_magic_hands_middle, 0);
   end
   else if(ptr_weapon_anim(dude_current_wpn) == anim_rl)then begin
      anim(dude_obj, ANIM_magic_hands_middle, 0);
   end
   else begin
      anim(dude_obj, ANIM_magic_hands_middle, 0);
   end
end
[/spoiler:c9543162fe]
 
Back
Top