Can i get some help with this script?

Josan12 said:
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?

There is a flag in the critter proto for this, however changing it on the fly isn't possible (?) or not worth it. The easiest thing you can do is this:

At the start of the talk_p_proc procedure for the critter add something like this:

Code:
if (asleep_var) then begin
  //go away, I'm sleepin'
end begin
  //all the other code in the talk procedure
end

What npcs are you going to have sleep in the game? I fear many of scripts will have to be modified in the end, depending on what you want to do...
 
Once again, I will take this thread as hostage. :>


Anyone knows if it's possible to send the player to a different map, if he leaves a location to the worldmap?

For now, I simply tried to send the player to a different map, on map exit:
Code:
procedure map_exit_p_proc begin
   if ((cur_map_index == MAP_LAZYTOWN) and (global_var(GVAR_MAP1_STUFF) != 0)) then begin
      load_map(MAP_WHATEVER, 0);
   end
end

This works, if the player is moving from map 1 to 2, but not if the player moves from map 1 to worldmap.

Someone got an idea?
 
I know, getting an answer here has a not very high chance :> but I am trying it again anyway:


Does someone know how I can remove an item from players inventory, if dude_obj is using it in his inventory? I tried it the normal "junk item" way with temp variable and rm_mult_objs_from_inven, but this didn't worked. Then I just tried with destroy_object, which made the game crash. Heh.

Now I am setting a global var on object use and in obj_dude script critter_p_proc, I delete the object if the variable is set to 1. But this is a very bad way, especially because it only works, if player closes inventory first.

First I wanted to do this all in dude_obj script anyway... like, if dude_obj is using item x, do action A and remove item. But I had no clue how and if this would work as well... So I moved to script attached to item and the "use_p_proc" procedure...

Is there any other way in deleting an item on use?
 
i tried that Lex,it always either freezes the game or crashes fo2,maybe with the sfall hook script,i dabbled with that for a while,but didnt get any decent results

Nirran
 
Damn, that shatters my ideas, which is bad.

What about dropping items? Any chance to check if player dropped item x? Or better, if player *wants* to drop item x. Then I could delete the item in this moment and spawn something else instead.
 
maybe,haven't tried,i worked that idea for a month maybe,trying to make my books in the book mod misc items,closest it will be is what Timslip did in her booze mod.and that mod relies on the deleting the engine does,maybe Timeslip will hook the engine code that deletes the items

edit : can do what i did,make the item a drug and no stat bonus or penalties

Nirran
 
Heh, making it a drug is a good idea. But now my script doesn't work anymore how I wanted it.

Code:
procedure use_p_proc begin
variable Item;
   // Create item
   Item:=create_object(PID_BOOZE,0,0);
   add_mult_objs_to_inven(dude_obj,Item,1);  
end

This is, what I want to do: Use the item and another item is spawned. In this case, PID_BOOZE is just an example. If I made my item a drug and use it, no new item is spawned. :/

/Edit: Nothing what I try works with use_p_proc. Not even showing a text line in the log window.
 
add create item on use in hs_useobjon hook script,may or may not work until inven closes tho,havent tried

or global script with script type mode 1,other then that,donno

Nirran
 
similar to this in hook script

Code:
procedure start begin
   variable LVar0;
   variable LVar1;
   variable target;
   variable user;
   variable item;
   variable delete_item;
   variable number_items_remove;
   if /*(game_loaded) or */(init_hook) then
      begin
         //register_hook(HOOK_USEOBJON);
      end 
   else 
      begin
         target := get_sfall_arg;
         user := get_sfall_arg;
         item := get_sfall_arg;      
         if (user == dude_obj)  and (target == dude_obj) then 
            begin
               if (obj_pid(item) == PID_JD_SMALL_GUNS) then 
                  begin
                     if(has_skill(dude_obj, 0) < 300) then 
                        begin
                           LVar0 := random(3, 6);
                           LVar1 := random(2, 4);
                           gfade_out(10);
                           if (has_trait(0, dude_obj, 81)) then 
                              begin
                                 critter_mod_skill(dude_obj, 0, LVar0);
                                 display_msg(message_str(1, 160) + LVar0 + message_str(1, 178));
                              end
                           else 
                              begin
                                 critter_mod_skill(dude_obj, 0, LVar1);
                                 display_msg(message_str(1, 160) + LVar1 + message_str(1, 178));
                              end
                           game_time_advance(60 * (60 * 10));
                           gfade_in(10);
                        end 
                     else 
                        begin
                           display_msg(message_str(1, 203) + message_str(1, 205) + message_str(1, 204));
                           gfade_out(10);
                           game_time_advance(60 * (60 * 10));
                           gfade_in(10);
                        end                      		
                  end

that wont compile,but a general idea

Nirran
 
Lexx, no need to change the items to drugs. Try this...

Code:
Obj_dude.ssl

procedure use_obj_on_p_proc
begin
			if (obj_pid(obj_being_used_with) == 412) then begin
				script_overrides;
//			 whatever action you want
				display_msg( "After you have applied the lube your eyes glance over the label of the can. 'ANAL LUBE' (Bacon Scented). It reminds you of your run-in with Francis. " );
				scr_return(1);
			end
end
Object 412 is the oil can of course. :)
 
Aw, thanks. As it's very close to what I've tried first, I thought it will not work. But I checked it out anyway and then I found the problems. It's something very unusual:

My item got the proto flags "usable", "usable on something", "can be looked at" and "can be picked up" etc.

One of these flags caused my problem... :> ...and it was "usable". If the item has activated "usable" flag, it was NOT possible to influence it with your script (and my very first script version). As soon as I've deactivated the "usable" flag (but only this, none else), it started to work. Now the item disappears on use and script is called correct, etc... everything works.

I found this out, because I wondered what the difference between the oil can and my new item was... the "usable" flag was the only difference.
 
Lexx said:
If the item has activated "usable" flag, it was NOT possible to influence it with your script (and my very first script version). As soon as I've deactivated the "usable" flag (but only this, none else), it started to work. Now the item disappears on use and script is called correct, etc... everything works.
Yeah I know of this one. I found it out for killap earlier.
If I remember it correctly a "usable" item would only work properly when used from the active item slot but not from the back pack.
I think turning an item into a drug will have a similar effect but I'm not sure I remember that correctly. :shrug:
 
A new question. :P

Does someone know, if it's possible to close doors without them making any sound? Like, don't close doors with animation, but let them switch into closed mode, when script runs.

It looks better, if doors close by itself every now and then. So I wrote a simple script and attached it to various doors:

Code:
procedure map_enter_p_proc begin
   if (is_loading_game == false) then begin
      if (obj_is_open(self_obj)) then
         obj_close(self_obj);
   end
end

It's very simple and works, but if you now enter the map, all open doors are playing their generic close sound when closing, which is somewhat annoying.
 
I'm just hijacking this thread to ask something which bugs me for a while. I'm planing to create some script just for learning purposes after all I've never done a single script for fallout. So to be bold I'm just started reading up about scripting so far I understand some base stuff
like: display_msg(mstr(100)); will show the {100} text in the msg file.
And I would like to ask if I'm correct about the following things
Code:
procedure Node001 begin
   Reply(mstr(103)+obj_name(dude_obj)+mstr(104));
   NLowOption(105,Node002);
   NOption(106,Node003,004);
   NOption(107,Node004,004);
   NOption(108,Node999,004);
end
This above one dialog would show msg text {103)+player name+{104} then we would get a low inteligent sentece {105} which would lead to a new dialog node002, and we a normal sentence to continue the dialog {106}/{107} which go to 003/004 and we have a last one {108} which ends the whole thing. So this thing is clear totally, just like that msg and the ssl should have the same name, but my question is are there an automatic action to build these Nodes in FSE or it is better in FMF dialog tool. Also I read Lexx post about map travel
Code:
procedure map_exit_p_proc begin 
   if ((cur_map_index == MAP_LAZYTOWN) and (global_var(GVAR_MAP1_STUFF) != 0)) then begin 
      load_map(MAP_WHATEVER, 0); 
   end 
end
And I was thinking something similar so I would like to ask that the goto_xy where have been used (or if someone knows how it works I would be glad to know)
 
are there an automatic action to build these Nodes in FSE or it is better in FMF dialog tool.

FSE has a build-in dialog editor. Check the tools or so section, I don't know exactly right now. But I personally never used this. It was always faster for me to write this by hand.

For "obj_name(dude_obj)" you could as well just write "dude_name", because there is a macro for it, just like "dude_is_male" or "dude_is_female" to replace the "if dude_obj sex == ..." etc. stuff. Check the defines.ssl and commands.ssl to get more overview about possible script functions.

I don't really understand your second question.
 
Thanks
About the last one (goto_xy) I saw it in the official mapper documentation (pdf) at page 15 but it has no description unlike the others for example at 'critter_heal' they've written that 'Heals critter for a given amount of hitpoints'
Well basically I'm looking for a script that can be used to move the player between maps in a dialog.
 
Check out original Fallout 2 scripts to see, how things works there. I've learned everything regarding I know about the writing of Fallout 2 scripts from this...
 
Back
Top