Designating a specific object while modding Fallout 2 is quite annoying (imagine how nice it would be to be able to do so in the mapper). I already pointed out the basics for doing so in my tutorial for making a battle script, but that assumed you didn't care *which* of a number of critters carrying the same script became a certain object. That is to say, we had 4 bouncers in that example, and we simply wanted to number them bouncer1, bouncer2, etc. without caring which of them became which. But what if you *do* want to specify that?
For instance, suppose you have Jordan in Arroyo (the one always twirling his spear), and you want to "power him up" at one point in the game for some reason, e.g. by making him into a leather armored proto. In this case, you want to put the new proto next to him on the map, and then make the one go invisible as the other becomes visible, right? But if you only have one script for the both of them (i.e. acjordan.ssl), then how do you do this (making a new script is a very sloppy workaround, because all the changes in local variables get lost)?
The method I found most feasible (though others might of course have better ones), is to check for equiped weapons. So the Jordan with the spear becomes "jordan1" and the Jordan with a powered up weapon (e.g. a sharpened spear) becomes "jordan2".
This way you can script it as follows (as you'll see, the only other thing you need is some global variable to trigger the "powering up"). Under map_enter_p_proc add something along the lines of:
The map_first_run thing is necessary to avoid a scenario where Jordan throws his spear, doesn't pick it up, and turns invisible when you come back to the map (not terribly likely, I know, but might as well rule it out). When you want to use the same trick only with multiple carriers of the same script, for instance to beef up all the Arroyo warriors, then all you need is a combination of the method used for the bouncers in New Reno and the method outlined above. After all, for all the warriors within their respective groups (i.e. the "beefed up group" and the "un-beefed up group) we don't have to be specific (they are all either invisible or visible); we only need to differentiate between the two groups. So what you get is (again under map_enter_p_proc):
And there you have it.
For instance, suppose you have Jordan in Arroyo (the one always twirling his spear), and you want to "power him up" at one point in the game for some reason, e.g. by making him into a leather armored proto. In this case, you want to put the new proto next to him on the map, and then make the one go invisible as the other becomes visible, right? But if you only have one script for the both of them (i.e. acjordan.ssl), then how do you do this (making a new script is a very sloppy workaround, because all the changes in local variables get lost)?
The method I found most feasible (though others might of course have better ones), is to check for equiped weapons. So the Jordan with the spear becomes "jordan1" and the Jordan with a powered up weapon (e.g. a sharpened spear) becomes "jordan2".
This way you can script it as follows (as you'll see, the only other thing you need is some global variable to trigger the "powering up"). Under map_enter_p_proc add something along the lines of:
Code:
if (map_first_run) then begin
if obj_carrying_pid_obj(self_obj, PID_SPEAR) then begin
jordan1 := self_obj;
end
if obj_carrying_pid_obj(self_obj, PID_SHARP_SPEAR) then begin
jordan2 := self_obj;
end
end
if (self_obj == jordan1) and (global_var(GVAR_ARROYO_SLAVERS) == SL_DEAL_SEALED) then begin
set_obj_visibility(self_obj, 1);
end
if (self_obj == jordan2) and (global_var(GVAR_ARROYO_SLAVERS) != SL_DEAL_SEALED) then begin
set_obj_visibility(self_obj, 1);
end
if (self_obj == jordan1) and (global_var(GVAR_ARROYO_SLAVERS) != SL_DEAL_SEALED) then begin
set_obj_visibility(self_obj, 0);
end
if (self_obj == jordan2) and (global_var(GVAR_ARROYO_SLAVERS) == SL_DEAL_SEALED) then begin
set_obj_visibility(self_obj, 0);
end
The map_first_run thing is necessary to avoid a scenario where Jordan throws his spear, doesn't pick it up, and turns invisible when you come back to the map (not terribly likely, I know, but might as well rule it out). When you want to use the same trick only with multiple carriers of the same script, for instance to beef up all the Arroyo warriors, then all you need is a combination of the method used for the bouncers in New Reno and the method outlined above. After all, for all the warriors within their respective groups (i.e. the "beefed up group" and the "un-beefed up group) we don't have to be specific (they are all either invisible or visible); we only need to differentiate between the two groups. So what you get is (again under map_enter_p_proc):
Code:
if (map_first_run) then begin
if (warrior1 == 0) and obj_carrying_pid_obj(self_obj, PID_SPEAR) then begin
warrior1 := self_obj;
end else if (warrior2 == 0) and obj_carrying_pid_obj(self_obj, PID_SPEAR) then begin
warrior2 := self_obj;
end else if (warrior3 == 0) and obj_carrying_pid_obj(self_obj, PID_SPEAR) then begin
warrior3 := self_obj;
end else if (warrior4 == 0) and obj_carrying_pid_obj(self_obj, PID_SPEAR) then begin
warrior4 := self_obj;
end else if (warrior11 == 0) and obj_carrying_pid_obj(self_obj, PID_10MM_PISTOL) then begin
warrior11 := self_obj;
end else if (warrior21 == 0) and obj_carrying_pid_obj(self_obj, PID_SHOTGUN) then begin
warrior21 := self_obj;
end else if (warrior31 == 0) and obj_carrying_pid_obj(self_obj, PID_10MM_SMG) then begin
warrior31 := self_obj;
end else if (warrior41 == 0) and obj_carrying_pid_obj(self_obj, PID_COMBAT_KNIFE) then begin
warrior41 := self_obj;
end
end
if (self_obj == warrior1) and (global_var(GVAR_ARROYO_SLAVERS) == SL_DEAL_SEALED) then begin
set_obj_visibility(self_obj, 1);
end
if (self_obj == warrior11) and (global_var(GVAR_ARROYO_SLAVERS) != SL_DEAL_SEALED) then begin
set_obj_visibility(self_obj, 1);
end
if (self_obj == warrior1) and (global_var(GVAR_ARROYO_SLAVERS) != SL_DEAL_SEALED) then begin
set_obj_visibility(self_obj, 0);
end
if (self_obj == warrior11) and (global_var(GVAR_ARROYO_SLAVERS) == SL_DEAL_SEALED) then begin
set_obj_visibility(self_obj, 0);
end
if (self_obj == warrior2) and (global_var(GVAR_ARROYO_SLAVERS) == SL_DEAL_SEALED) then begin
set_obj_visibility(self_obj, 1);
end
if (self_obj == warrior21) and (global_var(GVAR_ARROYO_SLAVERS) != SL_DEAL_SEALED) then begin
set_obj_visibility(self_obj, 1);
end
if (self_obj == warrior2) and (global_var(GVAR_ARROYO_SLAVERS) != SL_DEAL_SEALED) then begin
set_obj_visibility(self_obj, 0);
end
if (self_obj == warrior21) and (global_var(GVAR_ARROYO_SLAVERS) == SL_DEAL_SEALED) then begin
set_obj_visibility(self_obj, 0);
end
if (self_obj == warrior3) and (global_var(GVAR_ARROYO_SLAVERS) == SL_DEAL_SEALED) then begin
set_obj_visibility(self_obj, 1);
end
if (self_obj == warrior31) and (global_var(GVAR_ARROYO_SLAVERS) != SL_DEAL_SEALED) then begin
set_obj_visibility(self_obj, 1);
end
if (self_obj == warrior3) and (global_var(GVAR_ARROYO_SLAVERS) != SL_DEAL_SEALED) then begin
set_obj_visibility(self_obj, 0);
end
if (self_obj == warrior31) and (global_var(GVAR_ARROYO_SLAVERS) == SL_DEAL_SEALED) then begin
set_obj_visibility(self_obj, 0);
end
if (self_obj == warrior4) and (global_var(GVAR_ARROYO_SLAVERS) == SL_DEAL_SEALED) then begin
set_obj_visibility(self_obj, 1);
end
if (self_obj == warrior41) and (global_var(GVAR_ARROYO_SLAVERS) != SL_DEAL_SEALED) then begin
set_obj_visibility(self_obj, 1);
end
if (self_obj == warrior4) and (global_var(GVAR_ARROYO_SLAVERS) != SL_DEAL_SEALED) then begin
set_obj_visibility(self_obj, 0);
end
if (self_obj == warrior41) and (global_var(GVAR_ARROYO_SLAVERS) == SL_DEAL_SEALED) then begin
set_obj_visibility(self_obj, 0);
end
And there you have it.