what scripting function tells sfall when a party member leveled?
Timeslip said:Script it.Josan12 said:1) Did you see my previous post asking if you think it would be possible to use sfall to make human critters drop their weapons when killed or KO'd??
huh? Not sure what you're asking for. sfall doesn't call scripting functions...Nirran said:what scripting function tells sfall when a party member leveled?
The extra file system functions are for reading existing files, when used with fs_copy.>New script functions set_proto_data, set_self, register_hook
>Further file system script functions
>Hook script changes to aid in mod compatibility; multiple scripts can now attach to one hook point
I'd have thought you could just rig up a global script to do it, rather then having to edit the script of every critter. Using 1.47 functions, it's only a few lines.MIB88 said:Actually, he wants to know if you could devise a shortcut. I've already provided the scripting. Unfortunately, in order for it to work that way, it means redoing a lot of scripts individually.
#include "..\headers\sfall.h"
procedure start;
procedure start begin
variable critter;
variable weapon;
if (game_loaded) then begin
register_hook(HOOK_ONDEATH);
end else begin
critter:=get_sfall_arg;
weapon:=critter_inven_obj(critter, 1);
if(weapon) then begin
set_self(critter);
drop_obj(weapon);
end
weapon:=critter_inven_obj(critter, 2);
if(weapon) then begin
set_self(critter);
drop_obj(weapon);
end
end
end
Timeslip said:Code:#include "..\headers\sfall.h" procedure start; procedure start begin variable critter; variable weapon; if (game_loaded) then begin register_hook(HOOK_ONDEATH); end else begin critter:=get_sfall_arg; weapon:=critter_inven_obj(critter, 1); if(weapon) then begin set_self(critter); drop_obj(weapon); end weapon:=critter_inven_obj(critter, 2); if(weapon) then begin set_self(critter); drop_obj(weapon); end end end
Josan12 said:Timeslip said:Code:#include "..\headers\sfall.h" procedure start; procedure start begin variable critter; variable weapon; if (game_loaded) then begin register_hook(HOOK_ONDEATH); end else begin critter:=get_sfall_arg; weapon:=critter_inven_obj(critter, 1); if(weapon) then begin set_self(critter); drop_obj(weapon); end weapon:=critter_inven_obj(critter, 2); if(weapon) then begin set_self(critter); drop_obj(weapon); end end end
Thanks Timeslip. But where would i put this code?
Given that sfall is a fallout 2 mod, that would seem rather silly.Harahvaiti said:i have a question mate; could be the "push" npc function (like in fo2) introduced with sfall?
But only after you understand what that script is doing, my comment about pid's, and why it would be a very bad idea to use that script as it is.Nirran said:in a script labled GL_whateverJosan12 said:Thanks Timeslip. But where would i put this code?
What for? I can't think of anything that you might want to do with that that you wouldn't be better off doing some other way, so if you tell me what you want to do I might be able to suggest something.Nirran said:Timeslip : would it be possible to hook into critter_p_proc?
#include "C:\Game Files\Fallout 2\HEADERS\Perk_Inc.h"
procedure start;
procedure start begin
variable critter;
if(init_hook) then begin
end else begin
critter:=get_sfall_arg;
if((obj_pid(critter) != obj_pid(dude_obj)) and (obj_pid(critter) != 16777376) and (obj_pid(critter) != 16777377) and (obj_pid(critter) != 16777305)
and (obj_pid(critter) != 16777313) and (obj_pid(critter) != 16777323) and (obj_pid(critter) != 16777352) and (obj_pid(critter) != 16777217)
and (obj_pid(critter) != 16777368) and (obj_pid(critter) != 16777379) and (obj_pid(critter) != 16777380) and (obj_pid(critter) != 16777381)
and (obj_pid(critter) != 16777295) and (obj_pid(critter) != 16777278) and (obj_pid(critter) != 16777407) and (obj_pid(critter) != 16777411)
and (obj_pid(critter) != 16777412) and (obj_pid(critter) != 16777413) and (obj_pid(critter) != 16777481) and (obj_pid(critter) != 16777558)
and (obj_pid(critter) != 16777597) and (obj_pid(critter) != 16777596) and (obj_pid(critter) != 16777595) and (obj_pid(critter) != 16777600)
and (obj_pid(critter) != 16777687) and (obj_pid(critter) != 16777342) and (obj_pid(critter) != 16777348) and (obj_pid(critter) != 16777346)
and (obj_pid(critter) != 16777718) and (obj_pid(critter) != 16777720) and (obj_pid(critter) != 16777719) and (obj_pid(critter) != 16777717)
and (obj_pid(critter) != 16777785) and (obj_pid(critter) != 16777749) and (obj_pid(critter) != 16777748) and (obj_pid(critter) != 16777747)
and (obj_pid(critter) != 16777766) and (obj_pid(critter) != 16777762) and (obj_pid(critter) != 16777799)) then begin
if (has_trait(TRAIT_PERK, critter, PERK_animal_friend) == 0) then begin
critter_add_trait(critter, TRAIT_PERK, PERK_animal_friend, 1);
set_critter_extra_stat(critter, STAT_max_hit_points, get_critter_extra_stat(critter, STAT_max_hit_points) + (dude_level * get_sfall_global_int("health_1")));
critter_mod_skill(critter, SKILL_SMALL_GUNS, dude_level / get_sfall_global_int("skills_1") * get_sfall_global_int("skills_2"));
critter_mod_skill(critter, SKILL_BIG_GUNS, dude_level / get_sfall_global_int("skills_1") * get_sfall_global_int("skills_2"));
critter_mod_skill(critter, SKILL_ENERGY_WEAPONS, dude_level / get_sfall_global_int("skills_1") * get_sfall_global_int("skills_2"));
critter_mod_skill(critter, SKILL_UNARMED_COMBAT, dude_level / get_sfall_global_int("skills_1") * get_sfall_global_int("skills_2"));
critter_mod_skill(critter, SKILL_MELEE, dude_level / get_sfall_global_int("skills_1") * get_sfall_global_int("skills_2"));
critter_mod_skill(critter, SKILL_THROWING, dude_level / get_sfall_global_int("skills_1") * get_sfall_global_int("skills_2"));
set_critter_extra_stat(critter, STAT_max_move_points, get_critter_extra_stat(critter, STAT_max_move_points) + (dude_level / get_sfall_global_int("action_1") * get_sfall_global_int("action_2")));
set_critter_extra_stat(critter, STAT_dmg_resist, get_critter_extra_stat(critter, STAT_dmg_resist) + (dude_level / get_sfall_global_int("resist_1") * get_sfall_global_int("resist_2")));
set_critter_extra_stat(critter, STAT_dmg_resist_laser, get_critter_extra_stat(critter, STAT_dmg_resist_laser) + (dude_level / get_sfall_global_int("resist_1") * get_sfall_global_int("resist_2")));
set_critter_extra_stat(critter, STAT_dmg_resist_fire, get_critter_extra_stat(critter, STAT_dmg_resist_fire) + (dude_level / get_sfall_global_int("resist_1") * get_sfall_global_int("resist_2")));
set_critter_extra_stat(critter, STAT_dmg_resist_plasma, get_critter_extra_stat(critter, STAT_dmg_resist_plasma) + (dude_level / get_sfall_global_int("resist_1") * get_sfall_global_int("resist_2")));
set_critter_extra_stat(critter, STAT_dmg_resist_electrical, get_critter_extra_stat(critter, STAT_dmg_resist_electrical) + (dude_level / get_sfall_global_int("resist_1") * get_sfall_global_int("resist_2")));
set_critter_extra_stat(critter, STAT_dmg_resist_explosion, get_critter_extra_stat(critter, STAT_dmg_resist_explosion) + (dude_level / get_sfall_global_int("resist_1") * get_sfall_global_int("resist_2")));
set_critter_extra_stat(critter, STAT_dmg_thresh, get_critter_extra_stat(critter, STAT_dmg_thresh) + (dude_level / get_sfall_global_int("thresh_1") * get_sfall_global_int("thresh_2")));
set_critter_extra_stat(critter, STAT_dmg_thresh_laser, get_critter_extra_stat(critter, STAT_dmg_thresh_laser) + (dude_level / get_sfall_global_int("thresh_1") * get_sfall_global_int("thresh_2")));
set_critter_extra_stat(critter, STAT_dmg_thresh_fire, get_critter_extra_stat(critter, STAT_dmg_thresh_fire) + (dude_level / get_sfall_global_int("thresh_1") * get_sfall_global_int("thresh_2")));
set_critter_extra_stat(critter, STAT_dmg_thresh_plasma, get_critter_extra_stat(critter, STAT_dmg_thresh_plasma) + (dude_level / get_sfall_global_int("thresh_1") * get_sfall_global_int("thresh_2")));
set_critter_extra_stat(critter, STAT_dmg_thresh_electrical, get_critter_extra_stat(critter, STAT_dmg_thresh_electrical) + (dude_level / get_sfall_global_int("thresh_1") * get_sfall_global_int("thresh_2")));
set_critter_extra_stat(critter, STAT_dmg_thresh_explosion, get_critter_extra_stat(critter, STAT_dmg_thresh_explosion) + (dude_level / get_sfall_global_int("thresh_1") * get_sfall_global_int("thresh_2")));
set_critter_extra_stat(critter, STAT_ac, get_critter_extra_stat(critter, STAT_ac) + (dude_level / get_sfall_global_int("armor_01") * get_sfall_global_int("armor_02")));
critter_heal(critter, 999);
while(has_trait(TRAIT_PERK, critter, PERK_bonus_ranged_damage) < (dude_level / get_sfall_global_int("ranged_1") * get_sfall_global_int("ranged_2"))) do begin
critter_add_trait(critter, TRAIT_PERK, PERK_bonus_ranged_damage, 1);
end
end
end
end
end
Timeslip said:Given that sfall is a fallout 2 mod, that would seem rather silly.
I'm not sure if the get ap cost hook is a good place to run it, when it gets fired would be a bit unpredictable outside of combat.Nirran said:i may be able to do the mod i want with hs_calcapcost.int,with this code,it is altering the max hit points(as far as i know the other alteration are happening,i havent checked) ,however only the first critter is being healed
Code:<snip>
Yeah, they're 32 bit. The original compiler was 16 bit, so wouldn't run in a 64 bit OS.Nirran said:i gotta say thats fucking awesome,the compiler and decompiler from your site both run in vista 64,been using a virtual of win xp for those now i can do them in my reg enviornment,koodo's
Not really. The fallout 1 version is built from exactly the same code as that fallout 2 version, except with everything that depends on a specific version of the fallout exe stripped out, which leaves very little besides the graphics options and the mouse wheel/middle mouse button. It works equally well for fallout 1, 2 or probably any other game that uses the same directx version and creates the interface in the same way.Harahvaiti said:there is a fallout 1 version too, as far as i know...
Timeslip said:I was thinking about adding first_critter and next_critter functions
#include "..\..\HEADERS\sfall.h"
#include "..\..\HEADERS\Perk_Inc.h"
#include "..\..\HEADERS\Scale_Diff.h"
procedure start;
procedure start begin
variable cycle_tile := 1;
variable critter_to_modify;
set_global_script_repeat(1);
if (game_loaded) then begin
set_perk_name(4, "Bonus Ranged Damage");
set_perk_desc(4, "Your training in firearms and other ranged weapons has made you more deadly in ranged combat. For each level of this Perk, you do +2 points of damage with ranged weapons.");
set_perk_ranks(4, 100);
set_perk_level(4, 100);
end else begin
if(cur_map_index != get_sfall_global_int("map_indx")) then begin
set_sfall_global("map_indx", cur_map_index);
while(cycle_tile < 40000) do begin
if(tile_contains_obj_pid(cycle_tile, 0, 16777598)) then begin
critter_to_modify := tile_contains_pid_obj(cycle_tile, 0, 16777598);
modify_critter(critter_to_modify);;
end
if(tile_contains_obj_pid(cycle_tile, 1, 16777598)) then begin
critter_to_modify := tile_contains_pid_obj(cycle_tile, 1, 16777598);
modify_critter(critter_to_modify);;
end
if(tile_contains_obj_pid(cycle_tile, 2, 16777598)) then begin
critter_to_modify := tile_contains_pid_obj(cycle_tile, 2, 16777598);
modify_critter(critter_to_modify);;
end
cycle_tile := cycle_tile + 1;
end
end else begin
cycle_tile := 1;
end
end
end
Yeah, that was what I meant about the existing functions needing you to know the pid beforehand. You can use the new list functions instead though, and they'll be a heck of a lot faster.Nirran said:edit : works fine but if i add checks for all critter pid's it hangs for about a min on map loads,i could check map index and only put pid of the critters on it,was hoping for a universal script that would work for any mod
procedure start;
variable down;
#include "..\headers\sfall.h"
procedure start begin
variable list;
variable critter;
if (game_loaded) then begin
set_global_script_repeat(1);
set_global_script_type(1);
down:=0.0;
end
if(key_pressed(29)) then begin
if(not down) then begin
down:=1;
list:=list_begin(LIST_CRITTERS);
while(list != 0) do begin
critter:=list_next(list);
if (critter) then begin
if(critter!=dude_obj) then begin
critter_damage(critter, 999);
end
end else begin
list_end(list);
list:=0;
end
end
end
end else begin
down:=0;
end
end