Entra na casa caso seja atacado
Const
MoveWhere = 'north' // mude conforme o lado da porta
procedure Event_Attacked(ID:integer);
begin
UpdateWorld;
for i := 0 to Creatures.Count -1 do
begin
if Creatures.Creature.ID = ID then
if Creatures.Creature.NPC = false then
begin
case MoveWhere of
'north': Self.MoveUp;
'south': Self.MoveDown;
'east': Self.MoveLeft;
'west': Self.MoveRight;
end;
Leave := true;
end;
sleep(100);
end;
end;
while not terminated do
begin
updateWorld;
if (MoveWhere <> 'north') and (MoveWhere <> 'south') and (MoveWhere <> 'west') and (MoveWhere <> 'east')then
begin
Self.DisplayText('You MUST enter north, south, east or west! Script will close now, please try again.');
break;
end;
Leave := false;
UpdateWorld;
ProcessEvents;
if Leave then break;
sleep(500);
end;