Hi everybody.
Chris Parks, the following pieces of code simply are copies of the code in the original game.
First of all you define what you need the critter to do. I put the following define in my town header. I'm sure that any header will do, simply include it in all the critters and map script.
Code:
#define Do_Attacking_Smug(x,y) if (obj_is_visible_flag(self_obj)) then begin \
if (obj_can_see_obj(self_obj, Smuggler_obj)) then begin \
attack(Smuggler_obj); \
end else begin \
Follow_Dude(x,y) \
end \
end
The following stuff goes in the attacking critters script:
Code:
import variable cop_obj;
import variable Smuggler_obj;
procedure start begin
cop_obj := self_obj;
end
procedure critter_p_proc begin
if (given_var(GIVEN_VAR) == X) then begin
Do_Attacking_Smug(12,9)
end
end
You import the variables from the map script: the critters will know who they are, whom they must attack and what theyr behaviour must be (according to what you defined in the header).
In the attacked critter script:
import variable Smuggler_obj;
procedure start begin
Smuggler_obj := self_obj;
end
Now the critter knows who it is, and the attacker as well...
In the map script:
export variable Smuggler_obj;
export variable cop_obj;
I included the header containing the define in both critters and map scripts.
As I said this is directly copied from the original game. I tested it extensively and had no problem, apart from the usual wrong variable values and so on
...
If you have more problems, then please post pieces of your code.
See you.