Tragic global script question

Zaius238

Art by Phoenix-Private
I've been doing some small changes to the game, like adding new items, making Power Armor require training so the player can't 'power game' and ruin the fun, instantly becoming a demigod, etc.
One of the things I want is a kind of survival mode, so I used the Tragic script as example and modified so that it reduces the dude strength and endurance after ~2 weeks (I 'hunted' for scripts where a timer was added, and the one in tragic script is the nearer thing to what I had in mind. Good job, whoever created it). The characer is getting hungry so his strength and endurance is reduced.
The problem is that I can't make the script run multiple times. I want the script to stop when the player eats, and reset.
For an addiction is great (the gltragic script), it makes the dude stop in his travels and describes his urge to 'get moar!', and it ends, but for this mod it's not so great.
I tried removing do_once from the script, but when I do that the script stops working, unfortunately.
Something that would be awesome is if I could use a command like while (), but I doubt the Fallout language allows that. I know this place is frequented by some epic modders, so I thought about asking the vets for some advice.
 
Something that would be awesome is if I could use a command like while (), but I doubt the Fallout language allows that. I know this place is frequented by some epic modders, so I thought about asking the vets for some advice.
Fallout's SSL already supports the while loop, if that's what you want to use.
 
Do you really need a global script for that stuff? Sounds to me like it could work perfectly fine in obj_dude.ssl with variables and a simple timer.
 
In case someone is interested in using my mods, I'll be posting them here.
The first one is a small mod, that was created after I finished my playthrough of Fallout 1.5, aka Fallout Ressurection.
I liked the fact that the world was dark in the mod, so much that children getting killed wasn't something that made complete strangers hunt your head like it was their only reason to live, or someone pay mountains of coins just to get you assassinated.
What this mod does - as you have probably guessed already:
- NPCs (even Sulik and your other friends) don't give a damn if you killed a kid. Traders will no longer refuse to buy/sell things with you, just because you killed a little thief or reacted aggressively after one of them threw a frag granade at you.
- No more out of place random encounters with knights of holy justice that magicaly get more advanced equipment with time, no one will waste their misarable lifes trying to capture a tribal.
- Changes child killer image (Don't worry, you can keep original file. It's explained in the text file).

Version a:
Compatible with Restoration Project, nothing else
http://www.filedropper.com/justrp233

Version b:
Compatible with Restoration Project + the excellent EcCo mod
http://www.filedropper.com/compatiblewithphobos

Fallout's SSL already supports the while loop, if that's what you want to use.
Do you mind posting the exact command, to me?
I ask that, because in my tests, the game always frooze after I tried using while, here.
Not sure it makes any difference, but I'm using Timeslip ScriptEditor to create/edit .ssl and .int files.
 
Do you mind posting the exact command, to me?
I ask that, because in my tests, the game always frooze after I tried using while, here.
Not sure it makes any difference, but I'm using Timeslip ScriptEditor to create/edit .ssl and .int files.
Example from CAVE01.ssl:
Code:
while (count > 0) do begin
    call Choose_Pid;
    call placeCritter(choose_enc_pid, choose_enc_sid, AREA_1);
    count -= 1;
end
 
Example from CAVE01.ssl:
Code:
while (count > 0) do begin
    call Choose_Pid;
    call placeCritter(choose_enc_pid, choose_enc_sid, AREA_1);
    count -= 1;
end
Strange, it still doesn't works. =(

Here is my super mega simple global script, to test:

procedure start;
procedure ttest;

variable carrying;

procedure start begin
display_msg("Start");
while (obj_is_carrying_obj_pid(dude_obj, 19)) do begin
call ttest;
end
end

procedure ttest begin
set_global_var(25,1);
display_msg("Radaway addiction");
end

When I load a save where the dude is holding a rock, the game freezes, with the above.
But when I change the script, like this:

procedure start;
procedure ttest;

variable carrying;

procedure start begin
display_msg("Start");
if (obj_is_carrying_obj_pid(dude_obj, 19)) then begin
call ttest;
end
end

procedure ttest begin
set_global_var(25,1);
display_msg("Radaway addiction");
end

And load the same save file, it works perfectly. Both messages appear, and the dude becomes addicted to Radaway.
 
I am not an expert scripter, but aren't global scripts running in a loop by default? Also if you don't limit their "refresh rate", the game keeps throwing them, which probably explains why the freeze happens.
Also, based on my experience, there really is no reason to put a while there at all. It's wrong and the game stops till it's done (which probably really explains why your game freezes). As global scripts run constantly anyway, a simple if-block should totally do the trick.

Other than that, my global script that runs constantly every x ticks looks like this...
Code:
procedure start;
procedure start begin
   if (game_loaded) then begin
      set_global_script_repeat(5);
      set_global_script_type(1);
   end
 
   // stuff happens
end
... with "set_global_script_repeat(x)" defining how long till it is getting called again.
 
Last edited:
I am not an expert scripter around, but aren't global scripts running in a loop by default?
The global script above runs when I load the save file, the messages appear once in the screen.
If I reload the same save, it repeats again but I need to reload.

Also if you don't limit their "refresh rate", the game keeps throwing them, which probably explains why the freeze happens.
I wanted to do the simplest script possible.
Seems strange to only happen if I use while, if the only issue is in refresh rate.
I'll try adding the game_loaded command, it can't hurt right?

My global script that runs constantly looks like this...
Code:
procedure start;
procedure start begin
   if (game_loaded) then begin
      set_global_script_repeat(5);
      set_global_script_type(1);
   end
 
   // stuff happens
... with "set_global_script_repeat(x)" defining how long till it is getting called again.
Thanks for the example.

EDIT: Okay, it works now.

procedure start;
procedure ttest;

variable carrying;

procedure start begin
if (game_loaded) then begin
set_global_script_repeat(50000); //5 or 50000, it doesn't seem to change anything
set_global_script_type(1);

display_msg("Start");
while ((obj_is_carrying_obj_pid(dude_obj, 19))and(carrying != 20)) do begin
call ttest;
end
end
end

procedure ttest begin
carrying++;
set_global_var(25,1);
display_msg("Radaway addiction");
end
I was crazy for making it repeat infinitely Fallout 2 doesn't have the 'endurance' to keep working LOL.
Well thanks for the help.
It seems my idea is not possible, maybe I could create a fake addiction with the symthoms of hungriness, but script that always decreases stats and kills in a specific time is something much more complex than I thought.
 
Last edited:
In case someone is interested in using my mods, I'll be posting them here.
The first one is a small mod, that was created after I finished my playthrough of Fallout 1.5, aka Fallout Ressurection.
I liked the fact that the world was dark in the mod, so much that children getting killed wasn't something that made complete strangers hunt your head like it was their only reason to live, or someone pay mountains of coins just to get you assassinated.
What this mod does - as you have probably guessed already:
- NPCs (even Sulik and your other friends) don't give a damn if you killed a kid. Traders will no longer refuse to buy/sell things with you, just because you killed a little thief or reacted aggressively after one of them threw a frag granade at you.
- No more out of place random encounters with knights of holy justice that magicaly get more advanced equipment with time, no one will waste their misarable lifes trying to capture a tribal.
- Changes child killer image (Don't worry, you can keep original file. It's explained in the text file).

Version a:
Compatible with Restoration Project, nothing else
http://www.filedropper.com/justrp233

Version b:
Compatible with Restoration Project + the excellent EcCo mod
http://www.filedropper.com/compatiblewithphobos
I liket it, being a criminal in a world in ruins shouldn't be that difficult.
We are talking about Fallout, not Driver or GTA, where there is always someone to pursue you, at every street.
 
Back
Top