Radiation!

Check out the script from some of the randomly walking around critters. You can make critters walk into some random direction for x tiles. As example:

Code:
animate_run_to_tile(tile_num_in_direction(self_tile, random(0, 5), random(5, 15));

This should make the critter run into a random direction (0,5) for 5 to 15 tiles distance. But I don't know if you can simply add 100 or what tiles and not make it break the game. I mean, the slave could be on whatever position on the map and there might be problems then.
 
Lexx said:
Check out the script from some of the randomly walking around critters. You can make critters walk into some random direction for x tiles. As example:

Code:
animate_run_to_tile(tile_num_in_direction(self_tile, random(0, 5), random(5, 15));

This should make the critter run into a random direction (0,5) for 5 to 15 tiles distance. But I don't know if you can simply add 100 or what tiles and not make it break the game. I mean, the slave could be on whatever position on the map and there might be problems then.

I don't think this is a good idea. The slave is supposed to run from the player, so the direction should be opposite to Dude's.

You can make a greater distance, like maybe 100 hexes, not sure if this wouldn't break the game either, but you can always try. And if you want the critter to disappear when he's no longer visible, I'd suggest something like this:

Code:
procedure critter_p_proc begin
   if (not(obj_on_screen(self_obj))) then begin
      destroy_object(self_obj);
   end
end

This will make the critter disappear once it gets out of Dude's sight range (out of the screen to be more precise). Don't know if this is what you wanted exactly?
 
I don't think this is a good idea. The slave is supposed to run from the player, so the direction should be opposite to Dude's.

The direction can be replaced with "run away from dude" direction. I don't know the exact command right now, but I think this is possible (should work like the flee_from_dude command).
 
Thanks guys. I will post my progress and no doubt have more questions on it.

While we're on the flee_from_dude command, i want to ask:

a) is this a macro? (i found it in the command.h file so am i right in thinking it's a macro?)

b) i can't make most macro's work and i don't know why! I include them at the top of the script thus:

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

But if my script is:

Code:
procedure map_update_p_proc begin

if (Current_Distance_From_Dude < 8) then begin
display_msg("run!");
//animate_run_to_tile_force(Run_Away_From_Dude_Tile);
Run_Away_From_Dude_Tile;
end
end

it won't compile. Timeslips script editor tells me the error is 'expecting ';'.

It compiles fine without these bloody macros so i know thats the problem

:help:
 
"Run_Away_From_Dude_Tile" can't be used like that. It works only in combination with animate_run_ etc. In your outcommented line above, it can't work as well, because you didn't filled out all needed arguments for animate_run_to_tile.

"Flee_From_Dude" is a macro, that you can simply add somewhere in your code and it will work (like, if self_obj sees dude_obj, then Flee_From_Dude", etc.

What I do, when I try to figure out something: Search all script files for the code part and check how it was done there. In most cases, you will then get more details about this. I wrote various own macros for my mod as well, because it makes things more simple here and there.
 
OK, new question please you helpful people:

Should
Code:
party_add(self_obj);
make a critter follow the dude?
 
Yes, but not this alone, afaik. There is a shitload of additional stuff in the party.h file.
 
Josan12 said:
OK, new question please you helpful people:

Should
Code:
party_add(self_obj);
make a critter follow the dude?

I've always wondered about that command myself. It was used and abused in my party addon but never tried anything complex with it.

I wonder if a whole dynamic party system can be created with sfall abusing that function.
 
Lexx said:
I don't think this is a good idea. The slave is supposed to run from the player, so the direction should be opposite to Dude's.

The direction can be replaced with "run away from dude" direction. I don't know the exact command right now, but I think this is possible (should work like the flee_from_dude command).

Ok, i'm still working on this part and it's getting complicated.

Flee_From_Dude works fine and does exactly what i want (i.e makes critter flee from the dude's tile)
THe problem is it doesn't make the critter flee far enough.

Here's the macro in command.h:

Code:
#define Flee_From_Dude                      if ((Current_Distance_From_Dude < 8) or (self_can_see_dude)) then begin  \
                                               flee_from_tile(dude_tile)                                             \
                                            end

So here's flee_from_tile:

Code:
#define flee_from_tile(x)                   away_from_tile_type(x, run, run_away_from_dist)

and therefore here's run_away_from_dist:

Code:
#define run_away_from_dist                  random(3, 10)

From playing with it i can see the critter will run from 3-10 hex's so
run_away_from_dist is what i want to change. But as i'm deep into a macro's sub-definitions i don't know what to do!

I tried:

Code:
 //#define run_away_from_dist                  random(300, 1000)

at the top of my script but it didn't seem to do anything.
Can anyone help?
 
300, 1000 is too much. Critters just move like max. 100 hex. I didn't checked this in detail (counting maximum possible hex distance), but what I know is, that critters don't move to a position, if it's too "far" away.

I'll guess one would have to adjust the macro and change it in a way that if the critter hit's the target hex, he is running away again for x tiles, etc. But still, this is very complicated and could cause problems, because not every map has the same size, is at the same position, etc. etc.
 
Can anyone (lets face it - probably Lexx) tell me why a script that works perfectly in the mapper won't run at all in-game?

I've attached a simple script to useable beds. Works great in the mapper, but in-game won't budge. Any ideas?
 
Josan12 said:
Can anyone (lets face it - probably Lexx) tell me why a script that works perfectly in the mapper won't run at all in-game?

I've attached a simple script to useable beds. Works great in the mapper, but in-game won't budge. Any ideas?

Just out of curiosity, are there any texts associated with the script?

Try moving the script to another location. You know there are some "bad" script locations. Usually in those locations I get the scripts to work in the mapper, but they crash the game, especially when dialog is involved. Try another location, temporarily, one that you know will work (i.e. one of the first 1303).

Also, whatever came of the issue with the critters fleeing? I don't know how I missed those posts, or else I would have added my two cents about that back then. I was having the same problem with my slave scripts. I wanted them to flee if the character just rescued them from their evil slaver/caravan masters. I kept having problems, though. I wanted them to flee far away, running in some random direction. Problem was, I think, if the random direction was blocked 25 hexes out, and it was set to run 40 hexes, then the critter didn't move. (By the way, if you want my early scripts for this, let me know.)
Of course, I didn't need them to run too far away, anyway. As long as they left the screen, then I set the critter to invisible/be destroyed. So, it appeared as though they left the area if the player decided to search for them on the current map. But, I still had the problem mentioned above. In the end, I just settled for a quick fade out and destroyed the slave, to simulate that he/she ran away.
 
Ok, It would seem the probably was tied up with the savegame i was loading from. When i start a fresh game the script seems to work in game and mapper.... so far, anyway.

MIB88 said:
Also, whatever came of the issue with the critters fleeing? I don't know how I missed those posts, or else I would have added my two cents about that back then. I was having the same problem with my slave scripts. I wanted them to flee if the character just rescued them from their evil slaver/caravan masters. I kept having problems, though. I wanted them to flee far away, running in some random direction. Problem was, I think, if the random direction was blocked 25 hexes out, and it was set to run 40 hexes, then the critter didn't move. (By the way, if you want my early scripts for this, let me know.)
Of course, I didn't need them to run too far away, anyway. As long as they left the screen, then I set the critter to invisible/be destroyed. So, it appeared as though they left the area if the player decided to search for them on the current map. But, I still had the problem mentioned above. In the end, I just settled for a quick fade out and destroyed the slave, to simulate that he/she ran away.

I haven't really worked on the slave mod recently. I got the slaves running away nicely (i'll look up the exact code if you want) and figured out all of that. I stopped when it came to selling the slaves and the problem of recruting over the party limit. I can see there are clumsy ways to get around these limitations, but they're awfully messy. I may take one last try at that challenge.

A further question: how would you set a temporary stat change for the dude?

Code:
set_critter_stat(self_obj,STAT_en,-2);
         set_critter_stat(self_obj,STAT_st,-3);
         set_critter_stat(self_obj,STAT_pe,-2);
         set_critter_stat(self_obj,STAT_ch,-2);

Like this? But how then to return the stat to normal later in the script? (or another script)
 
Does no-one know how to script a change in the dude's stats then script them to change back to normal?? :(

I trawled through all the scripts searching the set_critter_stat command but couldn't find what i needed. IIRC, timeslip had trouble with this with his/her weather mod where storms would decrease PE, and then s/he forgot to restore the players PE.....
 
Josan12 said:
Does no-one know how to script a change in the dude's stats then script them to change back to normal?? :(

I trawled through all the scripts searching the set_critter_stat command but couldn't find what i needed. IIRC, timeslip had trouble with this with his/her weather mod where storms would decrease PE, and then s/he forgot to restore the players PE.....
Hmmm... drugs do this, might want to investigate how they are handled. If they are handled solely by the engine then possibly Timeslip or Haenlomal might be able to help.

Also, depending on what it is you are trying to achieve, maybe you can script adding a temp drug to the player's inventory, force use through script, and let the engine do it's thing. This would need a unique drug proto file to be created and added into the game that is not used otherwise (such as those 'do not use' protos that exist already).

Just a thought.
 
/Edit: Like written by Glovz, of course, if you can do your effect via a drug, it's the best way to go.

A further question: how would you set a temporary stat change for the dude?

First you have to add a timer with a global var to save the date when the temporary effect starts. In this moment you also set your wanted effect. Then you have to check the date all the time in obj_dude script (it's the best place imo) and if the actual time is < your defined time span, the effect gets reverted.

Code:
set_critter_stat(dude_obj, STAT_st, 1);

This should higher the ST stat and -1 would lower it again. As far as I can see, your main problem is how to set the timer, so I try to explain it now.

First you add a global var "GVAR_MY_FANCY_TIMER" name it how you want to.

Now if you want to save the date for the timer...

Code:
set_global_var(GVAR_MY_FANCY_TIMER, GAME_TIME_IN_DAYS + 3); // From now on, 3 days.

Now we have saved *now* + 3 days. We check if it works:

Code:
variable Check_Timer;

      Check_Timer:=(global_var(GVAR_MY_FANCY_TIMER) - GAME_TIME_IN_DAYS);
      display_msg("Days until fail: "+(Check_Timer));

Place this where ever you want to. Either in map script, so it's shown when you enter some location or you place it in the obj_dude script somwehre (critter_p_proc, it spams yer log then), etc.

Now let's use it somewhere (like before, critter_p_proc of obj_dude or in some map script or dialog, etc).

Code:
Check_Timer:=(global_var(GVAR_MY_FANCY_TIMER) - GAME_TIME_IN_DAYS);

If (Check_Timer <= 0) then begin
   // Do stuff
end

As soon as our Check_Timer variable is <= 0, we know the time is over and in this moment you could revert the stat change. To be sure that you revert it back to the correct stat value, you could have saved it in the beginning too. I don't know how exactly it worked right now, but must be something like get_critter_stat(blabla) and put it into a global var, there it's save.


I can't say if this is the best way to do this stuff and I don't know if it's 100% shit-proof. In my Fallout 2 mod, I am using a similar mechanic for a perk in combination with Sfall and it doesn't always work. I am not yet sure why is that the case, but in every other script it worked for me (as quest timer).
 
Ok, thanks for the advice, Lexx and Glovz.
I'm suprised there isn't a simple way to script stat changes. But once i'd trawled through the game scripts searching I realised there isn't. :(

I'll play around with the drug strategy, and post my results...
 
Ok, I've actually managed to make set_critter_stat work as i want to. So no need for the drug approach.

Now there's one final problem in my script before it's 100%, and i need some help identifying it:

Code:
/*
   SFALL GLOBAL SCRIPT: gl_rest_test0.ssl
   Desc: Script that calculates PC's rested/tired state whenever a certain ammount of time has passed.

   1) sfall Globals used ("re......"):
      "reDuRest"      last time PC was tired
      "reDuStat"      PC state: rested, tired, exhausted, ...
*/


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

/* Time Information  (in Ticks) */
#define ONE_GAME_SECOND             (10)
#define ONE_GAME_MINUTE             (60*ONE_GAME_SECOND)
#define ONE_GAME_HOUR               (60*ONE_GAME_MINUTE)
#define ONE_GAME_DAY                (24*ONE_GAME_HOUR)
#define ONE_GAME_WEEK               (7*ONE_GAME_DAY)
#define ONE_GAME_MONTH              (30*ONE_GAME_DAY)

// PC state constants. Zero being the optimal state.
#define state_RESTED         0
#define state_TIRED         1
#define state_EXHAUSTED      2

#define STAT_st              (0)
#define STAT_pe              (1)
#define STAT_en              (2)
#define STAT_ch              (3)
#define STAT_iq              (4)
#define STAT_ag              (5)
#define STAT_lu              (6)

// Ammount of time(in ticks) for the next tired state. Could be any ammount. In this case five seconds.
#define TIRED_TIME      ONE_GAME_DAY
#define EXHAUSTED_TIME   2*ONE_GAME_DAY

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

      // first time running the mod.
      if not get_sfall_global_int("reDuRest") then set_sfall_global("reDuRest",game_time);
   end else begin
      // if the time has passed for the next tired state
      if (game_time>=get_sfall_global_int("reDuRest")+TIRED_TIME)and(get_sfall_global_int("reDuStat")==state_RESTED)then begin
      show_iface_tag(5); 
      set_critter_stat(dude_obj, STAT_st, - 1); 
      //set_critter_stat(dude_obj, STAT_pe, - 1);
      //set_critter_stat(dude_obj, STAT_pe, - 1);
         // update the current time
         set_sfall_global("reDuRest",game_time);

         // update the state of the dude.
         set_sfall_global("reDuStat",get_sfall_global_int("reDuStat") +1);

         // prevent the state constant to run out of bounds
         if get_sfall_global_int("reDuStat") > state_EXHAUSTED then
            set_sfall_global("reDuStat",state_EXHAUSTED);

         // debug message
         //display_msg("+get_sfall_global_int("reDuStat"));
         
         end else
      // if the time has passed for the exhausted state AND the dude is tired
      if (game_time>=get_sfall_global_int("reDuRest")+EXHAUSTED_TIME)and(get_sfall_global_int("reDuStat")==state_TIRED)then begin
         hide_iface_tag(5);
         show_iface_tag(6);
         set_critter_stat(dude_obj, STAT_st, - 1);
          //update the current time
         set_sfall_global("reDuRest",game_time);

         // update the state of the dude.
         set_sfall_global("reDuStat",state_EXHAUSTED);
         
                  if get_sfall_global_int("reDuStat") > state_EXHAUSTED then
            set_sfall_global("reDuStat",state_EXHAUSTED);

         // debug message
         display_msg((EXHAUSTED_TIME/ONE_GAME_SECOND)+" sec passed... Dude state: "+get_sfall_global_int("reDuStat"));
         end
   end
end

So you can see the dude goes through various states that are time dependant.
My problem is this: the sfall script keeps running the state regardless of whether i save the game or not. If the dude is 'tired', then he'll keep that state even if i load a different save.
Now, i know there's some simple code that tells the game how to handle this, but i don't know this savegame stuff.
I'm pretty sure it's to do with this line:

Code:
   if game_loaded then begin

but i'm not sure. Can anyone spot my problem?
 
I have some professional background radiation and am willing to consult with one of the developers for free.

This to clarify how radiation would and how it would not, irradiate anyone.
how it could be ingested.

Exposure rates ,dose rates, nature of fallout etc.

Any fan fic fallout writer from here can PM me for my cell .

This is as a little thank you for all the help I have gotten here and all the hard work done by Nirran, Killap and all those other great guys here.
 
Uh, thanks Palmerwind.

So, can anyone help with my problem?

I probably didn't make my question clear - so here it is again.
Essentially, i think it boils down to my sfall global variables not being saved in the savegame data. If i quit my current game, and load a differernt one (or start a new one) the sfall globals seem to keep rolling as they are. If i quit the whole game to desktop, the sfall variables seem to start from scratch, which seems to mess things up.
Is there something simple i'm doing wrong?
 
Back
Top