GORIS SCRIPT fit the Non Helmet PA. Second Round!

Helios said:
I found a very simple solution :wink:

Code:
variable spec_ani;

procedure combat_p_proc begin
   if (spec_ani != 1) then begin
      //Combat begin animation
      anim(dude_obj, ANIM_magic_hands_middle, 0);
      spec_ani := 1;
      display_msg("combat start");
   end
end

procedure critter_p_proc begin
   if (not(combat_is_initialized)) and (spec_ani == 1) then begin
      //Combat end animation
      anim(dude_obj, ANIM_magic_hands_middle, 0);
      spec_ani := 0;
      display_msg("combat end");
   end
end

I looked a bit in the engine and this is the result, you can use "anim". It work in and after a combat.

I don't know how you do it, Helios! :clap:

How do you learn this stuff??!

I salute you!! :salute:

Your script works great. There are a few kinks i am working out but it all seems to work fine. Well done ;) :D
 
Mr.Wolna said:
thatÄs a good news, cause now YOU can make the helmless animation and me the siiting elder. FINALLY!!!

Absoluteley! I'm just putting together some SFX for the helmet removal sequence. The art is already done.
 
Ok, i'm reviving this thread to make a last ditch attempt at finishing this mod to a reasonable standard, so i need to ask for the help of the communities expert scripters:

Here's my script in Obj_dude:

Code:
procedure combat_p_proc begin

 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
 //Combat begin animation
 //play_sfx("bigwin1");
 inven_unwield(self_obj, 0)
 art_change_fid_num (self_obj, FID_HAPOWR);
 anim(self_obj, ANIM_up_stairs_right, 0);
 spec_ani := 1;
 display_msg("combat start");

 
 end

My problem is that the "inven_unwield" function doesn't work, and honestly, i don't really know why. As it is, the player critter will change art FID, and run the transition animation, but never holster his weapon. If i comment out the "anim" command, he'll holster his weapon and do nothing else, not even change art FID.

I've been forced to put this command in because the offsets can't be reconciled between the various weapon idle animations due to the crappy past-gen engine. So i have to have the player critter return to the unarmed sprite whenever he starts combat. Pretty bad i know but its that or bad offsets.

Anyway. Can anyone see why the inven_unwield function isn't working? And if so, write a solution into my code?

Thanks :help:
 
Well, I don't know if it will make any diffrence, but inven_unwield command is used like this:

inven_unwield(self_obj);

not

inven_unwield(self_obj, 0)
.

I honestly can't tell if it is any diffrentm but this is the way it is used in the original scripts.
 
Also, does inven_unwield actually work while in combat mode? It might not. That function does work elsewhere though. Have you tried it in other functions to make sure you are using it correctly?
 
Ravager69 said:
Well, I don't know if it will make any diffrence, but inven_unwield command is used like this:

inven_unwield(self_obj);

not

inven_unwield(self_obj, 0)
.

I honestly can't tell if it is any diffrentm but this is the way it is used in the original scripts.

Good point but didn't make any difference unfortunately. I think the compiler overlooks little errors like that. Of course i did end the line with ";" (the compiler certainly WON'T overlook errors like that!)

killap said:
Also, does inven_unwield actually work while in combat mode? It might not. That function does work elsewhere though. Have you tried it in other functions to make sure you are using it correctly?

I'm pretty sure it does as if i have the inven_unwield command in there on its own and comment out the anim command and art_change command he will unwield his weapon when combat mode is initiated.
On the other hand, if i comment out the unwield command he will correctly run the transition animation and change art FID on combat initiation.

One important thing im not sure of: Does it matter what order i list the commands in? Am i correct in thinking the script will try to execute them all simultaneously? Could this be the problem?

The order i WANT is:

a) unwield weapon
b) run animation
c) change art FID
 
Josan12 said:
IOne important thing im not sure of: Does it matter what order i list the commands in? Am i correct in thinking the script will try to execute them all simultaneously? Could this be the problem?

The order i WANT is:

a) unwield weapon
b) run animation
c) change art FID
Matter does order. Each line is executed in the order written. The problem might be that the art_change_fid animation call is interfering with the inven_unwield animation. Perhaps adding in a timer that waits a second will solve this problem of yours.
 
killap said:
Matter does order. Each line is executed in the order written. The problem might be that the art_change_fid animation call is interfering with the inven_unwield animation. Perhaps adding in a timer that waits a second will solve this problem of yours.

Ok, thanks Killap. Could you (or someone) please quickly post a modified version of my script with that timer? I have great difficulty with timers due to my very limited scripting skills and it'd probably take me a week (or never) to figure it out. I'm a but dyslexic with these things :oops:
 
Code:
procedure timed_event_p_proc begin
  if (fixed_param == 1) then begin
     art_change_fid_num (self_obj, FID_HAPOWR);
     anim(self_obj, ANIM_up_stairs_right, 0);
     spec_ani := 1;
     display_msg("combat start");
  end
end

procedure combat_p_proc begin

 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
   //Combat begin animation
   //play_sfx("bigwin1");
   inven_unwield(self_obj);
   add_timer_event(self_obj,game_ticks(1),1);
end

Alright, here. I'm assuming "spec_ani" is defined at the start of the script? I give no guarantees that this will solve your problem. However, animations interfering might be the problem, so some combination of this might work. Play around with what the timer does. You might actually want to call the timer right after art_change_fid rather than inven_unwield.

EDIT: I also noticed my unintentional, but quite ironic wording error in my previous post. :D
 
Thanks Killap. I just did an initial test, and it appears timed events may not work in-combat - is this true?

Initial tests seem to indicate the timed event won't play during combat, but will wait until combat is over, and then play!! :crazy:

But i liked your highly philosophical statement!! It made me to pause for a minute, question my place in the cosmos, and ponder the nature of order and disorder, entropy and whether we're created beings or just a random event .... i presume that was your intent?? ;)

It is now my sig :clap:
 
Josan12 said:
I just did an initial test, and it appears timed events may not work in-combat - is this true?

Initial tests seem to indicate the timed event won't play during combat, but will wait until combat is over, and then play!! :crazy

I don't know if it works or not but time while in combat mode is not continuous. It seems every time you start a new turn (or when you end your current one, not sure), time advances 5 seconds.

edit: BTW, why do you want to unwield your weapon when the combat _starts_?
 
Josan12 said:
I just did an initial test, and it appears timed events may not work in-combat - is this true?

Initial tests seem to indicate the timed event won't play during combat, but will wait until combat is over, and then play!! :crazy

pelicano said:
I don't know if it works or not but time while in combat mode is not continuous. It seems every time you start a new turn (or when you end your current one, not sure), time advances 5 seconds.

Right. That would explain it. In fact i knew that from one of my other mods. Well, it effectively means timed events are no use to me then, as i need my little sequence to happen before/as combat begins.

pelicano said:
edit: BTW, why do you want to unwield your weapon when the combat _starts_?

Becuase if i don't, the various 'idle' animations the player has for different weapons, cause the player critter to 'jump' around when he 'transitions' from helmeted to unhelmeted. This is because the different idles are all different sizes and the past-gen engine doesn't center them. You'll notice that in-game, you'll never see the hero sprite go directly from one weapon to another - he'll either holster to unarmed, and draw another weapon, or the inventory screen will be up and you can't see him. If you could, you'd see the player critter 'jump' in this way. The offsets could resolve this, but from my experience it is an unreconcileable problem due to the engine. So my solution was to have the player always return to one 'idle' - unarmed. It would work if i could make the script work.... :(
 
Just a thought; though I must admit I know nothing about scripting, might this problem be related to this solution:
Darek said:
killap said:
@Darek
So, basically you are calling a animation clear on the door. I really never would have thought of this for non critter type objects. I suppose this teaches us to always call a clear before doing any animation changes.
Yeah, but you can call an animation clear on dude object as well, that works too.
I think the engine just needs a little break from handling too many things at once, so to speak.
I mean it works fine without it as long as the whole "use interface" doesn't come up, but with it it gets overloaded or something.
 
Have you tried the code with sfall? I mean in a global script. I've had positive results there but I don't know if they are exactly what you look for.

As combat starts, dude_obj unwields the weapon all right, change the FID and play an animation (with the new FID). What I don't get to work is playing an animation with the old FID and changing it afterwards.
 
Glovz said:
Just a thought; though I must admit I know nothing about scripting, might this problem be related to this solution:
Darek said:
killap said:
@Darek
So, basically you are calling a animation clear on the door. I really never would have thought of this for non critter type objects. I suppose this teaches us to always call a clear before doing any animation changes.
Yeah, but you can call an animation clear on dude object as well, that works too.
I think the engine just needs a little break from handling too many things at once, so to speak.
I mean it works fine without it as long as the whole "use interface" doesn't come up, but with it it gets overloaded or something.

Yes, i noticed this too. But unfortunately, like you Glovz, i'm a noob scripter so i don't really know what 'call a clear' means. Can anyone shed light on what this means?

pelicano said:
Have you tried the code with sfall? I mean in a global script. I've had positive results there but I don't know if they are exactly what you look for.

As combat starts, dude_obj unwields the weapon all right, change the FID and play an animation (with the new FID). What I don't get to work is playing an animation with the old FID and changing it afterwards.

Again, as i'm a noob scripter i have no idea how to use global scripts (you mean the 'hook scripts' that have been mentioned?)

But it sounds like you've had some sucess. What i want is this:

When the dude is wearing power armor:

- out of combat mode, player uses NAPOWR critter (unhelmeted PA)
- in combat mode, player uses HAPOWR critter (defualt helmeted PA)
- when switching into combat, player automatically holsters weapon, plays transition animation (i.e. puts helmet on animation) and changes art FID.
- when combat ends, player holsters weapon, puts helmet back on, and changes FID.

can you explain how you used a global script to achieve this?
 
Not hook scripts, just a regular sfall global script. These scripts are named always starting with the prefix "GL" (glexample.int, for example) and follow a fairly simple structure.

Anyway, this is the script I've made (triggers when the combat starts/ends):

Code:
procedure start;

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

#define FID_HAPOWR   (16777217)
#define FID_NAPOWR   (16777246)
#define inven_unwield(x)   metarule(43, x)

variable spec_ani;

procedure start begin
   if (game_loaded) then begin
      set_global_script_repeat(1);
   end else begin

      if(combat_is_initialized)then begin
         if (spec_ani != 1) then begin
            //Combat begin animation
            inven_unwield(dude_obj);   // unwields without animation
            metarule3(107,dude_obj,FID_HAPOWR,0);
            anim(dude_obj, ANIM_magic_hands_middle, 0);
            spec_ani := 1;
            display_msg("combat start");
         end
      end else if(spec_ani == 1)then begin
         //Combat end animation
         inven_unwield(dude_obj);   // unwields without animation
         metarule3(107,dude_obj,FID_NAPOWR,0);
         anim(dude_obj, ANIM_magic_hands_middle, 0);
         spec_ani := 0;
         display_msg("combat end");
      end

   end
end

Already compiled here: GL_PA_test.int
Place it into DATA\scripts folder. Sfall required, obviously.

No problem so far while metarule3 comes before anim. Otherwise, the FID change gets "overriden" by the animation and the old FID remains.
 
Thanks Pelicano. Much appreciated. But i can't seem to make it work. Don't i need to somehow tell sfall to look for GL_PA_test?? I put the .int into data\scripts but nothing happens when i initiate combat... ?

What am i missing?
 
Josan12 said:
Thanks Pelicano. Much appreciated. But i can't seem to make it work. Don't i need to somehow tell sfall to look for GL_PA_test?? I put the .int into data\scripts but nothing happens when i initiate combat... ?

What am i missing?

Assuming you have installed sfall, check if you have Extended Scripting Function and Input enabled in ddraw.ini, just in case. You have any mod that could conflict with it? a modified fallout2.exe? I know it works on my end.

There are no additional rules for global scripts. They are just like any other fallout script, except they are called by sfall.
 
Hey Pelicano - are you still here? I've just tested your script and it makes good progress. However, in my game it doesn't actually run the holster animation, although it does instantly remove the drawn weapon to inventory. I notice in your code you've indicated it 'holsters without animation', commented out.

Can this be corrected to display the holster animation?
 
Back
Top