
Ok, je m'attendais un peu à ça !… C'est un peu compliqué (l'unité en question comporte 800 lignes) mais je vais essayer d'être simple (tout en gardant le sujet de mon projet confidentiel pour + de surprise lorsqu'il sera opérationnel !) …
Bon, alors… Voici ce que j'ai et qui fonctionne :
procedure CompartmentDestination(Player: TPlayer);
begin
if Player.Tag = 1 then
Player.MoveTo(Point3D(7,42,1));
if Player.Tag = 2 then
Player.MoveTo(Point3D(12,42,1));
if Player.Tag = 3 then
//..................................................................etc
end;
Et grâce au code suivant :
plugin TRetourCasePlugin
hint 'Revenir en début de case (Touche Back Space)';
on PressKey do
begin
if Key = VK_BACK then
begin
CompartmentDestination(Player);
Handled := True;
end;
end;
end;
Le joueur a la possibilité de revenir à un point de départ si il s'est un peu trop perdu… Cela fonctionne parfaitement si il n'a pas quitté la
MainMap dans le cas contraire niet !.. Et donc je voudrais modifier ma procédure avec quelque chose dans le genre de :
procedure CompartmentDestination(Player: TPlayer);
var
Dest: TQualifiedPos;
begin
Dest.Map := Master.Maps['MainMap'];
if Player.Tag = 1 then
Dest.Position := Point3D(7,42,1);
if Player.Tag = 2 then
Dest.Position := Point3D(12,42,1);
if Player.Tag = 3 then
//...............................................................etc
Player.MoveTo(Dest);
end;