Can i get some help with this script?

Indeed. :> It's because I need one by myself and I can either try to create it by myself or I hope that stuff like this shows up by itself. :D

But to go back to the idea. I think it could work like that:

We have the bed scenery. Now we could define a hex under it, like the red point on that image:

Bild2.png


The critter is moving to this hex and if he is on it, the graphic changes. If my guess is correct now, the new "bed critter" would be displayed over the regular scenery bed and it looks like the gritter is sleeping. If the sleeping-phase is done, he transforms back to his original look and is moving away again.

I just have no clue, if it's possible to change the NPCs look via script. I have never done this and I don't know of any examples in the original scripts. (If it's possible, I would like to know how, as it would be very useful for me. :>)

Anyway... the bed critter just needs one animation... bed with sleeping people inside. So it will not be able to move anyway, as it has no moving animation. The only problem might be "pushing away" due to some weapons like the rocket launcher.
 
I think we might as well toss out all our ideas and see what’s possible…

How about the PC walks up to the bed and a spatial script. At that point the dialogue screen asks the player if they wish to sleep - now of course this will depend on whether the PC has permission to actually sleep there in the first place. If the PC says yes then the dialogue screen disappears and the dude is in the bed. When the PC wishes to wake up they click off the bed and the dialogue screen asks if the PC wishes to leave, if yes then the screen disappears and the character is standing on a hex near the bed. For the floor beds (sleeping bags – mattresses) they can just lay down on top of it (with the knocked out flag – that way they won’t fall behind the scenery). You super scriptors out there – is this achievable…

Lexx this is the type of sleeping bed artwork that will need to be copied..

017bed2q.gif
 
Yes, I know how it looked in Arcanum. :P

But sadly, the mechanic about how to do it is a bit more complex in Fallout 2. Or... I would call it more an ugly workaround to gain some visual change. Because unlike in Arcanum, beds in Fallout are simple normal scenery objects and the game doesn't know if its a chair, a tree or a bed.
 
Can’t it be a simple art replacement script…bed A1 is replaced by bed A2, as long as the dimensions and frame offset are exactly the same it shouldn’t be a problem?
 
But you have to do something with the NPC. He has to walk up to the bed, then the bed can change. Maybe the NPCs could be set to invisible in this case. But keep in mind, the bed is a scenery object then and the player can't interact in any kind of way with the original NPC. This could lead to various exploits, such as.. wait for NPCs to get to bed, then kill xy and the 'sleeping' NPCs will not notice, etc.


I think, my "critter bed" idea would be better. Script could be like this:

Code:
if not combat and NPC on bed_tile and sleep_time and critter == critter_normal then begin
   change critter to bed_critter
end
else if critter == bed_critter then begin
   change critter to normal_critter
end

What should happen: As soon as various conditions are true and the NPC is on a specific bed_hex, he transforms into "bed_critter". If the conditions are not true anymore, he transforms back to his normal optic, "normal_critter". While this, the player can still interact with the NPC and if - as example - combat hits in, you could ninja-transform the bed_critter back to normal_critter.

If this procedure would run in critter_p_proc, it could also look pretty smooth ingame.
 
Pelicano has been helping me with a cool global script. But its a simple question so i thought i'd throw it out on the forum.

Here's my script - it's a regular script attached to a useable bed:

Code:
            gfade_out(1200);
              get_sfall_global_int("reDuStat");
              set_sfall_global("reDuStat",-1);
              critter_heal(dude_obj,(get_critter_stat(dude_obj,STAT_heal_rate)*2));
              game_time_advance((8)* ONE_GAME_HOUR);
              gfade_in(1200);

I simply want the sfall global "reDuStat" to decrease by 1 when the bed is used. But as you can see - i've got it wrong. Can someone correct me?
 
Josan12 said:
Pelicano has been helping me with a cool global script. But its a simple question so i thought i'd throw it out on the forum.

Here's my script - it's a regular script attached to a useable bed:

Code:
            gfade_out(1200);
              get_sfall_global_int("reDuStat");
              set_sfall_global("reDuStat",-1);
              critter_heal(dude_obj,(get_critter_stat(dude_obj,STAT_heal_rate)*2));
              game_time_advance((8)* ONE_GAME_HOUR);
              gfade_in(1200);

I simply want the sfall global "reDuStat" to decrease by 1 when the bed is used. But as you can see - i've got it wrong. Can someone correct me?

set_sfall_global("reDuStat",get_sfall_global_int("reDuStat") -1 );
 
As you guys are doing so well let's play help the noob spot his scripting mistake game again!

Code:
procedure use_p_proc begin
variable rand;
rand := random(0, 1); 
   script_overrides;
   if not (game_ui_is_disabled) or (combat_is_initialized) and (rand == 0) 
   then 
   game_ui_disable;
   reg_anim_clear(dude_obj);
   reg_anim_begin();
   reg_anim_animate_reverse(dude_obj, 37, -1);
   reg_anim_animate(dude_obj, ANIM_fall_back_sf, -1);
   reg_anim_end();
   display_msg("You lie down to sleep");
   call sequence;
   
else if (game_ui_is_disabled) or (combat_is_initialized) and (rand == 1)
 then 
      game_ui_disable;
  reg_anim_clear(dude_obj);
   reg_anim_begin();
   reg_anim_animate_reverse(dude_obj, 38, -1);
   reg_anim_animate(dude_obj, ANIM_fall_back_sf, -1);
   reg_anim_end();
   display_msg("You lie down to sleep");
   call sequence;
   
end

(it won't compile due to some simple mistake - anyone think i need scripting 101?)

:mrgreen:
 
Josan12 said:
(it won't compile due to some simple mistake - anyone think i need scripting 101?)
It would really help if you looked at the actual error messages. If you're using FSE, stop for at least long enough to look at the command window output.

In any case, I see operator precedence issues in your if expressions, and lots of missing begin/end's.
 
Timeslip said:
Josan12 said:
(it won't compile due to some simple mistake - anyone think i need scripting 101?)
It would really help if you looked at the actual error messages. If you're using FSE, stop for at least long enough to look at the command window output.

Well, i'm using the sfall compiler so never get an explanation. But honestly, even when i was using the watcom compiler it gave mostly useless error messages and could rarely highlight the line of error. Can anyone recommend using another, better compiler? And how do people switch between the sfall compiler and another?

Timeslip said:
In any case, I see operator precedence issues in your if expressions, and lots of missing begin/end's.

:puppy-dog:
 
Code:
procedure use_p_proc begin
   variable rand; 
   rand := random(0, 1);
   script_overrides;
   if (not(combat_is_initialized)) then begin
   	game_ui_disable;
   	reg_anim_clear(dude_obj);
   	reg_anim_begin();
		if (rand == 0) then
			reg_anim_animate_reverse(dude_obj, 37, -1);
		else
			reg_anim_animate_reverse(dude_obj, 38, -1);
		reg_anim_animate(dude_obj, ANIM_fall_back_sf, -1);
   	reg_anim_end();
   	display_msg("You lie down to sleep");
   	call sequence; 
    end
end

I assume this is what you were going for. I removed redundancy and fixed begin/end issues. I assume you do a ui_enable at some point? Didn't test it, still might not compile, but I think all is well unless you had some function typos that I'm missing.
 
Josan12 said:
Well, i'm using the sfall compiler so never get an explanation.
That's what I meant. The sfall compiler gives pretty good errors. (Well, ok, they aren't that good, but it at least usually gets the line right.) In your case you'd have got "expecting ';'." on the else line, since the compiler couldn't have matched it to the if because of the missing begin/end.

The problem isn't the compiler, but that FSE can't parse the messages it gives out. Doing the coding in FSE and then dropping back to a command prompt to run the compiler lets you see the errors.
 
Maybe we should try to contact the creator and ask for the FSE source. IMO, the tool could need some more love and a few additional functions anyway. :>
 
Thanks Killap - it compiles now, but i had to make a change to your suggestion as it seems reg_anim doesn't like being interrupted like this with the variable check.

Now i have a new question. Here's my whole code including that bit:

Code:
procedure use_p_proc begin
   variable rand;
   rand := random(0, 1);
   script_overrides;
   if (not(combat_is_initialized)) and (rand == 0) then begin
      game_ui_disable;
      reg_anim_clear(dude_obj);
      reg_anim_begin();
      reg_anim_animate_reverse(dude_obj, 37, -1);
      reg_anim_animate(dude_obj, ANIM_fall_back_sf, -1);
      reg_anim_end();
      display_msg("You lie down to sleep");
      call sequence;
   end    
      else begin
      game_ui_disable;
      reg_anim_clear(dude_obj);
      reg_anim_begin();
      reg_anim_animate_reverse(dude_obj, 36, -1);
      reg_anim_animate(dude_obj, ANIM_fall_front_sf, -1);
      reg_anim_end();
      display_msg("You lie down to sleep");
      call sequence;
    end
end

procedure sequence
begin
   if (count == 0) then
   begin
   end
   else
   begin
      if (count == 1) then
      begin
         float_msg(dude_obj, "Zzzzzzzz", 3);
      end
      else
      begin
         if (count == 2) then
         begin
            gfade_out(1200);
              //set_sfall_global("reDuStat",get_sfall_global_int("reDuStat") -2 );
              //hide_iface_tag(5);
              //hide_iface_tag(6);
              critter_heal(dude_obj,(get_critter_stat(dude_obj,STAT_heal_rate)*2));
              game_time_advance((8)* ONE_GAME_HOUR);
              gfade_in(1200);
         end
               else
               begin
                  if (count == 3) and (rand == 0) then
                  begin
                     display_msg("You wake feeling rested");
                     reg_anim_clear(dude_obj);
                     reg_anim_begin();
                     reg_anim_animate(dude_obj, 37, -1);
                     reg_anim_end();
                     if (game_ui_is_disabled) then
                        game_ui_enable;
                  end
                  else begin
                     display_msg("You wake feeling rested");
                     reg_anim_clear(dude_obj);
                     reg_anim_begin();
                     reg_anim_animate(dude_obj, 36, -1);
                     reg_anim_end();
                     if (game_ui_is_disabled) then
                        game_ui_enable;
                        end
               end
            end
         end

   count := count + 1;
   if (count > 3) then begin
      count := 0;
   end
   else
   begin
      add_timer_event(self_obj, game_ticks(3), 1);
   end
end

procedure timed_event_p_proc
begin
   if (fixed_param == 1) then
   begin
      call sequence;
   end
end

My problem is that i need the sequence procedure to use the "rand" variable so it can play the correct 'get up' animation. My suspicion is that it's not picking up the "rand" variable from the 'use proc' as it always seems to return true for the get up animation in the sequence. Do i need to use an LVAR or something? Or am i missing something else?

Timeslip said:
The problem isn't the compiler, but that FSE can't parse the messages it gives out. Doing the coding in FSE and then dropping back to a command prompt to run the compiler lets you see the errors.

Ah. I see. I'll try this.

Lexx said:
Maybe we should try to contact the creator and ask for the FSE source. IMO, the tool could need some more love and a few additional functions anyway. :>

Jargo made FSE. Is he ever on NMA?
 
Josan12 said:
My problem is that i need the sequence procedure to use the "rand" variable so it can play the correct 'get up' animation. My suspicion is that it's not picking up the "rand" variable from the 'use proc' as it always seems to return true for the get up animation in the sequence. Do i need to use an LVAR or something? Or am i missing something else?
rand is a local variable in use_p_proc. It wont work outside of that function. Make it a file scope variable by moving it outside of the procedure.

That wont even compile as is. (You'd have gotten an "undefined symbol 'rand'" error, had you been looking at the errors.)
 
Timeslip said:
rand is a local variable in use_p_proc. It wont work outside of that function. Make it a file scope variable by moving it outside of the procedure.

Thanks Timeslip! :D
 
Hmm I have some new question as well.

Can someone tell me, how the arroyo map change has been done? I mean from arroyo normal to arroyo destroyed.

I know that both are two locations, but I just can't find out, how the normal version is deactivated on the worldmap. I know about mark on map and unmark on map commands, but while the first can make locations visible, the second can only mark locations as unkown, so the green circle still stays on the worldmap.

/Edit: Fine, like always. Just when I post some bigger text, the solution shows up:

mark_area_known(MARK_TYPE_TOWN, x, MARK_STATE_INVISIBLE);

MARK_STATE_INVISIBLE is the point. It's not used in the Fallout 2 scripts, but exists.
 
Hey! My thread! ;)

Does anyone know a command that will set a critter to 'untalkable'?
To be precise - when i send critters to bed i don't want the player to be able to talk to them.

Maybe change_critter_flag or something?
 
Back
Top