script prob

fuzzi

It Wandered In From the Wastes
I need kill some critter in an hour when hero visit this map first. If i set in pipboy 1 hour at map where is critter placed it is OK, BUT if i go to another map and set in pipboy 1 hour and return at map where is my critter placed - he isnt killed. WHY ?

Code:
procedure map_enter_p_proc begin
    set_local_var(LVAR_Test11 ,game_time + ONE_GAME_HOUR);
     
     reg_anim_clear( self_obj );
     reg_anim_begin();
     reg_anim_animate(self_obj,ANIM_fall_back_sf,-1);
     reg_anim_end();
    
end
---------------------------------------------------------------------------------
Code:
procedure map_update_p_proc begin
  if (local_var(LVAR_Test11) < game_time)  then begin
      kill_critter(self_obj,ANIM_fall_back_sf);
  end
end
 
What about trying this code?

In the critter script:

map_enter_p_proc;
begin
add_timer_event(self_obj,ONE_GAME_HOUR ,1);
end

procedure timed_event_p_proc begin
if (fixed_param==1) then begin
kill_critter(self_obj,ANIM_fall_back_sf);
end
end

I haven't tested this, but i can't see why it wouldn't work.
 
Gvars didnt work too.(

Code:
procedure map_enter_p_proc begin
     set_global_var(GVAR_TEST,game_time + ONE_GAME_HOUR);
end

Code:
procedure map_update_p_proc begin  
  if (global_var(GVAR_TEST) < game_time)  then begin
      kill_critter(self_obj,ANIM_fall_back_sf);
  end
end
 
A) Try this piece of code instead, it's from wcdobbs (Private Dobbs in Sierra Base). It's tested and should work.
critter_dmg(self_obj,1000,DMG_plasma);
B)Trying to perform a given animation with a critter which hasn't it should crash the game. Still, make sure the critter you're using has fall_back. Not all critters have it, and must be set on its own when making a new critter proto.
Wait.. Idon't know if it's me... In you last piece of code you say to kill the critter if game time is shorter than an hour... Or am I saying crap?
Please let us know.
See you
 
a) It isnt problem kill him. But If i set in PB one hour at another map, critter didnt killed.
b)The last piece of code say : kill the critter one hour after hero visit map where is critter placed.(but hero can go to another map etc.)

Here is testing script:
Code:
#include "..\headers\define.h"

#define NAME                    SCRIPT_TEST0

#include "..\headers\command.h"

procedure start;
procedure look_at_p_proc;
procedure description_p_proc;
procedure map_enter_p_proc;
procedure map_update_p_proc;

#define LVAR_Herebefore                 (0)
//#define LVAR_Test11                     (1)

procedure start begin
end

procedure look_at_p_proc begin
   script_overrides;
   if (local_var(LVAR_Herebefore) == 0) then
      display_msg(mstr(100));
   else
      display_msg(mstr(101));
end

procedure description_p_proc begin
   script_overrides;
   display_msg(mstr(102));
end

procedure map_enter_p_proc begin
     set_global_var(GVAR_BACKWOODS_SMRT_ALBERTA,game_time + ONE_GAME_HOUR);
     // not necessary
     reg_anim_clear( self_obj );
     reg_anim_begin();
     reg_anim_animate(self_obj,ANIM_fall_back_sf,-1);
     reg_anim_end();
    
end

procedure map_update_p_proc begin  
  if (global_var(GVAR_BACKWOODS_SMRT_ALBERTA) < game_time)  then begin
      kill_critter(self_obj,ANIM_fall_back_sf);
  end
end
 
I am not totally familiar with FalloutScript, but could it be the map_enter_p_proc is executed every time you enter the map?

If so, check whether the variable is already set before setting up the preparations.

Otherwise, the timer would be reset every time you enter the map, thus causing the event only to occur if you stay on the map for an hour.
 
Ashmo said:
I am not totally familiar with FalloutScript, but could it be the map_enter_p_proc is executed every time you enter the map?

Otherwise, the timer would be reset every time you enter the map, thus causing the event only to occur if you stay on the map for an hour.

1. map_enter_p_proc = Whenever the map is first entered, this procedure will be called.

2. Yes I know. Timers is useless.
 
Ashmo said:
I am not totally familiar with FalloutScript, but could it be the map_enter_p_proc is executed every time you enter the map?

If so, check whether the variable is already set before setting up the preparations.

Otherwise, the timer would be reset every time you enter the map, thus causing the event only to occur if you stay on the map for an hour.
Yes, that oughta be the problem. Try this:

Code:
map_enter_p_proc begin
   if(local_var(LVAR_Herebefore) == 0) then begin
      set_local_var(LVAR_Test11,game_time);
   end else if(local_var(LVAR_Test11) <= game_time+ONE_GAME_HOUR) then begin
      kill_critter(self_obj,ANIM_fall_back_sf);
   end
end

procedure map_update_p_proc begin  
  if (local_var(LVAR_Test11) <= game_time+ONE_GAME_HOUR) then begin 
      kill_critter(self_obj,ANIM_fall_back_sf); 
  end 
end

procedure map_exit_p_proc begin
   set_local_var(LVAR_Herebefore,1);
end

fuzzi said:
1. map_enter_p_proc = Whenever the map is first entered, this procedure will be called.
I don't think that's true. That's "Start". map_enter_p_proc is (supposed to) run each time you enter the map, not just the first time.
 
fuzzi said:
I need kill critter one hour then hero visit map first. If I USE your code, critter is already dead....
That can't be, because LVAR_Herebefore is 0 as default. The first time the script runs, ie when you first enter the map with that critter on it, the LVAR_Test11 will store the current time. When you exit the map, the value of LVAR_Herebefore is changed, and so the next time you enter the map with the critter on it, LVAR_Test11 will not change (as your previous code did). Instead, it will check if more time than 1 hour has passed, and if so, the critter will be killed.
 
sorry man but I used your code: .......

Code:
#include "..\headers\define.h"

#define NAME                    SCRIPT_TEST0

#include "..\headers\command.h"

procedure start;
procedure look_at_p_proc;
procedure description_p_proc;
procedure map_enter_p_proc;
procedure map_update_p_proc;
procedure map_exit_p_proc;

#define LVAR_Herebefore              (0)
#define LVAR_Test11                     (1)

procedure start begin
end

procedure look_at_p_proc begin
   script_overrides;
   if (local_var(LVAR_Herebefore) == 0) then
      display_msg(mstr(100));
   else
      display_msg(mstr(101));
end


procedure description_p_proc begin
   script_overrides;
   display_msg(mstr(102));
end

procedure map_enter_p_proc begin
   if(local_var(LVAR_Herebefore) == 0) then begin
      set_local_var(LVAR_Test11,game_time);
   end else if(local_var(LVAR_Test11) <= game_time+ONE_GAME_HOUR) then begin
      kill_critter(self_obj,ANIM_fall_back_sf);
   end
end 

procedure map_update_p_proc begin 
  if (local_var(LVAR_Test11) <= game_time+ONE_GAME_HOUR) then begin
      kill_critter(self_obj,ANIM_fall_back_sf);
  end
end 

procedure map_exit_p_proc begin
   set_local_var(LVAR_Herebefore,1);
end

......... and if I visit map with critter first, he was already dead. Check this scripts and u will see....
 
Hrm.. Oh, I see it. I screwed up the inequality there. LVAR_Test11 <= game_time + ONE_GAME_HOUR is always true... Aheh.

Try this instead:

Code:
map_enter_p_proc begin 
   if(local_var(LVAR_Herebefore) == 0) then begin 
      set_local_var(LVAR_Test11,game_time); 
   end else if(local_var(LVAR_Test11)+ONE_GAME_HOUR <= game_time) then begin 
      kill_critter(self_obj,ANIM_fall_back_sf); 
   end 
end 

procedure map_update_p_proc begin  
  if (local_var(LVAR_Test11)+ONE_GAME_HOUR <= game_time) then begin 
      kill_critter(self_obj,ANIM_fall_back_sf); 
  end 
end 

procedure map_exit_p_proc begin 
   set_local_var(LVAR_Herebefore,1); 
end

That should work. Right?
 
Same problem as start this theard. If i go to another map and set 1 hour in pipboy and return to map where critter is, critter still alive.
 
I get it. I test your last version in mapper only. But in normally game your script works perfectly. thx for help man.
 
How can I set visibility my town at world map ?

I set """"start_state=Off"""" in city.txt and put this slice of code
Code:
procedure map_exit_p_proc begin
        if (town_known(50) == MARK_STATE_UNKNOWN) then begin
           //debug_msg("  mark_on_map("+50+")");
           mark_area_known(MARK_TYPE_TOWN,        
          MARK_STATE_KNOWN);         
        end
end

to some map but It doesn't work. Why ?

EDIT: It needs edit some headers ?
 
Assuming that you added your city to city.txt file at number 50 then i see only one error(wrong using mark_area_known).
The code should be:
Code:
procedure map_exit_p_proc begin 
        if (town_known(50) == MARK_STATE_UNKNOWN) then begin 
           //debug_msg("  mark_on_map("+50+")"); mark_area_known(MARK_TYPE_TOWN,50,MARK_STATE_KNOWN);         
        end 
end
 
Back
Top