Okay, it all starts with a check for the map they are at, in the map_enter_p_proc...
Code:
if (cur_map_index != MAP_GHOST_FARM) then begin
critter_add_trait(self_obj,TRAIT_OBJECT,OBJECT_TEAM_NUM,TEAM_MODOC);
end
... where they are assigned to modoc-team (28) if they are NOT at the ghost farm.
Then, in combat_p_proc ...
Code:
end else if (cur_map_index == MAP_GHOST_FARM) then begin
critter_add_trait(self_obj,TRAIT_OBJECT,OBJECT_TEAM_NUM,TEAM_PLAYER);
... they are reassigned to the player-team(0).
The fight is initialized in critter_p_proc...
Code:
if ((cur_map_index == MAP_GHOST_FARM) and (hostile == false) and (dude_enemy_modoc == false)) then begin
Do_Attacking_Slag(10,7)
...where Do_Attacking_Slag(x,y) is a macro defined in modoc.h...
Code:
#define Do_Attacking_Slag(x,y)
if (obj_is_visible_flag(self_obj)) then begin
if (obj_can_see_obj(self_obj, ghost_farm_slag_obj)) then begin
attack(ghost_farm_slag_obj);
end else begin
Follow_Dude(x,y)
end
end
... in which ghost_farm_slag_obj seems to be a pointer to some export variable from ghost farm map script, assigned to all slags as it appears.
And finally 'check_show_ghost_farm_attackers', another macro from modoc.h takes care of their appearance...
Code:
#define check_show_ghost_farm_attackers
if (is_loading_game == false) then begin
if (obj_in_party(self_obj) == false) then begin
if (cur_map_index == MAP_GHOST_FARM) then begin
if (all_slags_dead) then begin
debug_msg("no need for attackers");
check_set_obj_visiblility(self_obj, true);
destroy_object(self_obj);
end else if (attacking_slags) then begin
debug_msg("showing need for attackers");
critter_add_trait(self_obj,TRAIT_OBJECT,OBJECT_TEAM_NUM,TEAM_PLAYER);
check_set_obj_visiblility(self_obj, false);
end else begin
debug_msg("hiding need for attackers");
check_set_obj_visiblility(self_obj, true);
end
end
end
end
This looks like a load at first, but is real easy. It first checks if the object is in players party. next it checks (once again) if the object is in ghost farm. Next, if there are any slags to beat. If not, it displays a msg in debug mode and makes them disappear. If yes, it also displays a debug msg, adds them to the player team and turns them visible. In any other case it shows the notorious msg and turns them invisible.
Is that, what you were particularly interested in?
Edit: yeah, I forgot one: the very first thing, the check_ghost_....blahblah macro does is, what every macro does, it checks if the game loads, as it'll do nothing, if.