Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

A* Pathfinding API


  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
2 odpowiedzi w tym temacie

#1 Adminek AMXX.PL

    Admin :)

  • Bot

Reputacja: 156
Profesjonalista

  • Postów:7 476
  • Lokalizacja:AMXX.PL
Offline

Napisano 15.06.2014 23:21

<!-- BEGIN TEMPLATE: postbit_external -->
<div><font size="+3">A* Pathfinding API</font><br /><font size="+1">Pathfinding API based on the A* method.</font><br /><br /><font size="+1">Functions:</font><br /><!-- BEGIN TEMPLATE: bbcode_code -->
<!-- Code block -->
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px">Code:</div>
<pre class="alt2" dir="ltr" style="margin: 0px;padding: 6px;border: 1px inset;width: auto; height: px; text-align: left; overflow: auto"><div class="pawn" style="font-family: monospace;"><span style="color: #ff0000; font-style: italic;">/** Array:AStar(Float:Start[3], Float:Goal[3], StepSize = 30, Ignore = IGNORE_MONSTERS, IgnoreID = 0, GroundDistance = 35, Heuristic = 50);
&nbsp;*
&nbsp;* Finds a path between Start and Goal.
&nbsp;*
&nbsp;*
&nbsp;* Parameters:
&nbsp;*
&nbsp;*&nbsp; Float:Start[3]
&nbsp;*&nbsp; &nbsp; Starting position.
&nbsp;*
&nbsp;*&nbsp; Float:Goal[3]
&nbsp;*&nbsp; &nbsp; Hopefully the end position.
&nbsp;*
&nbsp;*&nbsp; (Optional) StepSize = 30
&nbsp;*&nbsp; &nbsp; Defines how far between each step to take in a pattern of -X + X in all three dimensions. This means that diagonally, the step will be longer.
&nbsp;*
&nbsp;*&nbsp; (Optional) Ignore = IGNORE_MONSTERS
&nbsp;*&nbsp; &nbsp; Flags for the traceline check.
&nbsp;*
&nbsp;*&nbsp; (Optional) IgnoreID = 0
&nbsp;*&nbsp; &nbsp; id of the calling player if IGNORE_MONSTERS is not set. Again, this is for the traceline.
&nbsp;*
&nbsp;*&nbsp; (Optional) GroundDistance = 35
&nbsp;*&nbsp; &nbsp; Set the maximum distance from the ground for the point to be accepted as valid. If set to 0 this check is disabled, meaning pathfinding for flying entities.
&nbsp;*
&nbsp;*&nbsp; (Optional) Heuristic = 50
&nbsp;*&nbsp; &nbsp; Optimization parameter. Decides how much importance the distance from the target has.
&nbsp;*&nbsp; &nbsp; Higher values might result in a faster execution but may also result in a suboptimal path.
&nbsp;*
&nbsp;* Returns a handle to a dynamic array that will contain each step between start and goal.
&nbsp;* On failure it will return Invalid_Array.
**/</span>
native Array:AStar<span style="color: #000000;">(</span><span style="color: #00c0c0;">Float</span>:Start<span style="color: #000000;">[</span><span style="color: #0000dd;">3</span><span style="color: #000000;">]</span>, <span style="color: #00c0c0;">Float</span>:Goal<span style="color: #000000;">[</span><span style="color: #0000dd;">3</span><span style="color: #000000;">]</span>, StepSize = <span style="color: #0000dd;">30</span>, Ignore = IGNORE_MONSTERS, IgnoreID = <span style="color: #0000dd;">0</span>, GroundDistance = <span style="color: #0000dd;">35</span>, Heuristic = <span style="color: #0000dd;">50</span><span style="color: #000000;">)</span>;

<span style="color: #ff0000; font-style: italic;">/** AStarThreaded(Float:Start[3], Float:Goal[3], Handler[], StepSize = 30, Ignore = IGNORE_MONSTERS, IgnoreID = 0, GroundDistance = 35, Heuristic = 50);
&nbsp;*
&nbsp;* Finds a path between Start and Goal.
&nbsp;*
&nbsp;*
&nbsp;* Parameters:
&nbsp;*
&nbsp;*&nbsp; Float:Start[3]
&nbsp;*&nbsp; &nbsp; Starting position.
&nbsp;*
&nbsp;*&nbsp; Float:Goal[3]
&nbsp;*&nbsp; &nbsp; Hopefully the end position.
&nbsp;*
&nbsp;*&nbsp; Handler[]
&nbsp;*&nbsp; &nbsp; The function that will be called once the pathfinding is done.
&nbsp;*&nbsp; &nbsp; The format of the handler function should be as such:
&nbsp;*&nbsp; &nbsp; &nbsp; public PathDone(Index, Array:hPath, Float:Distance, NodesAdded, NodesValidated, NodesCleared)
&nbsp;*
&nbsp;*&nbsp; (Optional) StepSize = 30
&nbsp;*&nbsp; &nbsp; Defines how far between each step to take in a pattern of -X + X in all three dimensions. This means that diagonally, the step will be longer.
&nbsp;*
&nbsp;*&nbsp; (Optional) Ignore = IGNORE_MONSTERS
&nbsp;*&nbsp; &nbsp; Flags for the traceline check.
&nbsp;*
&nbsp;*&nbsp; (Optional) IgnoreID = 0
&nbsp;*&nbsp; &nbsp; id of the calling player if IGNORE_MONSTERS is not set. Again, this is for the traceline.
&nbsp;*
&nbsp;*&nbsp; (Optional) GroundDistance = 35
&nbsp;*&nbsp; &nbsp; Set the maximum distance from the ground for the point to be accepted as valid. If set to 0 this check is disabled, meaning pathfinding for flying entities.
&nbsp;*
&nbsp;*&nbsp; (Optional) Heuristic = 50
&nbsp;*&nbsp; &nbsp; Optimization parameter. Decides how much importance the distance from the target has.
&nbsp;*&nbsp; &nbsp; Higher values might result in a faster execution but may also result in a suboptimal path.
&nbsp;*
&nbsp;* Returns a que index that can be used in the handler to identify which path is complete.
&nbsp;* On failure it will return -1.
**/</span>
native AStarThreaded<span style="color: #000000;">(</span><span style="color: #00c0c0;">Float</span>:Start<span style="color: #000000;">[</span><span style="color: #0000dd;">3</span><span style="color: #000000;">]</span>, <span style="color: #00c0c0;">Float</span>:Goal<span style="color: #000000;">[</span><span style="color: #0000dd;">3</span><span style="color: #000000;">]</span>, Handler<span style="color: #000000;">[</span><span style="color: #000000;">]</span>, StepSize = <span style="color: #0000dd;">30</span>, Ignore = IGNORE_MONSTERS, IgnoreID = <span style="color: #0000dd;">0</span>, GroundDistance = <span style="color: #0000dd;">35</span>, Heuristic = <span style="color: #0000dd;">50</span><span style="color: #000000;">)</span>;



<span style="color: #cf0020;">// The following functions are only used with the AStar() function, not AStarThreaded().</span>

<span style="color: #ff0000; font-style: italic;">/**
&nbsp;* AStar_GetDistance()
&nbsp;*
&nbsp;* Returns the distance of the last non-threaded path.
**/</span>
native <span style="color: #00c0c0;">Float</span>:AStar_GetDistance<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;

<span style="color: #ff0000; font-style: italic;">/**
&nbsp;* AStar_GetNodesAdded()
&nbsp;*
&nbsp;* Returns the ammount of nodes that were created from the last non-threaded path.
**/</span>
native AStar_GetNodesAdded<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;

<span style="color: #ff0000; font-style: italic;">/**
&nbsp;* AStar_GetNodesValidated()
&nbsp;*
&nbsp;* Returns the ammount of nodes that were validated from the last non-threaded path.
**/</span>
native AStar_GetNodesValidated<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;

<span style="color: #ff0000; font-style: italic;">/**
&nbsp;* AStar_GetNodesValidated()
&nbsp;*
&nbsp;* Returns the ammount of nodes that were cleared from the last non-threaded path.
**/</span>
native AStar_GetNodesCleared<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;</div></pre>
</div>
<!-- /Code block -->
<!-- END TEMPLATE: bbcode_code --><br />A new example so you can test in game<br />This time it's based on 2 points that you create using the commands astar_pos1 and astar_pos2 instead of distance by aim. This allows you to test much bigger paths.<br />Run the pathfinding by using astar_run for &quot;threaded&quot; or astar_run2 for non-threaded.<br />The execution time is pretty similar, the non-threaded being slightly faster but will freeze the server while working.<br /><!-- BEGIN TEMPLATE: bbcode_code -->
<!-- Code block -->
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px">Code:</div>
<pre class="alt2" dir="ltr" style="margin: 0px;padding: 6px;border: 1px inset;width: auto; height: px; text-align: left; overflow: auto"><div class="pawn" style="font-family: monospace;"><span style="color: #339900;">#include &lt;amxmodx&gt;</span>
<span style="color: #339900;">#include &lt;fakemeta&gt;</span>
<span style="color: #339900;">#include &lt;astar&gt;</span>
<span style="color: #339900;">#include &lt;xs&gt;</span>

<span style="color: #ff0000; font-style: italic;">/*
new hTimer = TimerStart();
// ...
TimerStop(hTimer);
server_print(&quot;Timer: %d days, %d hours, %d minutes, %d seconds and %d milliseconds.&quot;, TimerDays(hTimer), TimerHours(hTimer), TimerMinutes(hTimer), TimerSeconds(hTimer), TimerMilliseconds(hTimer));
*/</span>
<span style="color: #339900;">#define TimerStart()&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tickcount()</span>
<span style="color: #339900;">#define TimerMid(%0)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ( tickcount() - %0 )</span>
<span style="color: #339900;">#define TimerStop(%0)&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;( %0 = tickcount() - %0 )</span>
<span style="color: #339900;">#define TimerDays(%0)&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;( %0 / 86400000 )</span>
<span style="color: #339900;">#define TimerHours(%0)&nbsp; &nbsp; &nbsp; ( %0 % 86400000 / 3600000 )</span>
<span style="color: #339900;">#define TimerMinutes(%0)&nbsp; &nbsp; &nbsp; &nbsp; ( %0 % 3600000 / 60000 )</span>
<span style="color: #339900;">#define TimerSeconds(%0)&nbsp; &nbsp; &nbsp; &nbsp; ( %0 % 60000 / 1000 )</span>
<span style="color: #339900;">#define TimerMilliseconds(%0)&nbsp; &nbsp;( %0 % 1000 )</span>

<span style="color: #339900;">#define RGB(%0,%1,%2) ( ( ( %0 &amp; 255 ) &lt;&lt; 16 ) | ( ( %1 &amp; 255 ) &lt;&lt; 8 ) | ( %2 &amp; 255 ) )</span>

<span style="color: #007700;">new</span> <span style="color: #00c0c0;">Float</span>:gPos<span style="color: #000000;">[</span><span style="color: #0000dd;">2</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #0000dd;">3</span><span style="color: #000000;">]</span>;
<span style="color: #007700;">new</span> gLastStep<span style="color: #000000;">[</span><span style="color: #0000dd;">11</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #0000dd;">3</span><span style="color: #000000;">]</span>;
<span style="color: #007700;">new</span> Array:gPath<span style="color: #000000;">[</span><span style="color: #0000dd;">11</span><span style="color: #000000;">]</span>;
<span style="color: #007700;">new</span> gTimer<span style="color: #000000;">[</span><span style="color: #0000dd;">10</span><span style="color: #000000;">]</span>;

<span style="color: #007700;">new</span> Colors<span style="color: #000000;">[</span><span style="color: #000000;">]</span> = <span style="color: #000000;">{</span>
&nbsp; &nbsp; RGB<span style="color: #000000;">(</span><span style="color: #0000dd;">0</span>, <span style="color: #0000dd;">0</span>, <span style="color: #0000dd;">255</span><span style="color: #000000;">)</span>,
&nbsp; &nbsp; RGB<span style="color: #000000;">(</span><span style="color: #0000dd;">0</span>, <span style="color: #0000dd;">255</span>, <span style="color: #0000dd;">0</span><span style="color: #000000;">)</span>,
&nbsp; &nbsp; RGB<span style="color: #000000;">(</span><span style="color: #0000dd;">0</span>, <span style="color: #0000dd;">255</span>, <span style="color: #0000dd;">255</span><span style="color: #000000;">)</span>,
&nbsp; &nbsp; RGB<span style="color: #000000;">(</span><span style="color: #0000dd;">255</span>, <span style="color: #0000dd;">0</span>, <span style="color: #0000dd;">0</span><span style="color: #000000;">)</span>,
&nbsp; &nbsp; RGB<span style="color: #000000;">(</span><span style="color: #0000dd;">255</span>, <span style="color: #0000dd;">0</span>, <span style="color: #0000dd;">255</span><span style="color: #000000;">)</span>,
&nbsp; &nbsp; RGB<span style="color: #000000;">(</span><span style="color: #0000dd;">255</span>, <span style="color: #0000dd;">255</span>, <span style="color: #0000dd;">0</span><span style="color: #000000;">)</span>,
&nbsp; &nbsp; RGB<span style="color: #000000;">(</span><span style="color: #0000dd;">255</span>, <span style="color: #0000dd;">255</span>, <span style="color: #0000dd;">255</span><span style="color: #000000;">)</span>
<span style="color: #000000;">}</span>

<span style="color: #ff0000;">public</span> plugin_init<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">{</span>
&nbsp; &nbsp; <span style="color: #00c0c0;">register_plugin</span><span style="color: #000000;">(</span><span style="color: #800080;">&quot;A* Sample code&quot;</span>, <span style="color: #800080;">&quot;2.0&quot;</span>, <span style="color: #800080;">&quot;[ --{-@ ]&quot;</span><span style="color: #000000;">)</span>;

&nbsp; &nbsp; <span style="color: #00c0c0;">register_clcmd</span><span style="color: #000000;">(</span><span style="color: #800080;">&quot;astar_run&quot;</span>, <span style="color: #800080;">&quot;run&quot;</span><span style="color: #000000;">)</span>;
&nbsp; &nbsp; <span style="color: #00c0c0;">register_clcmd</span><span style="color: #000000;">(</span><span style="color: #800080;">&quot;astar_run2&quot;</span>, <span style="color: #800080;">&quot;run2&quot;</span><span style="color: #000000;">)</span>;
&nbsp; &nbsp; <span style="color: #00c0c0;">register_clcmd</span><span style="color: #000000;">(</span><span style="color: #800080;">&quot;astar_pos1&quot;</span>, <span style="color: #800080;">&quot;pos1&quot;</span><span style="color: #000000;">)</span>;
&nbsp; &nbsp; <span style="color: #00c0c0;">register_clcmd</span><span style="color: #000000;">(</span><span style="color: #800080;">&quot;astar_pos2&quot;</span>, <span style="color: #800080;">&quot;pos2&quot;</span><span style="color: #000000;">)</span>;
<span style="color: #000000;">}</span>

<span style="color: #007700;">new</span> g_sprite;

<span style="color: #ff0000;">public</span> plugin_precache<span style="color: #000000;">(</span><span style="color: #000000;">)</span>
&nbsp; &nbsp; g_sprite = <span style="color: #00c0c0;">precache_model</span><span style="color: #000000;">(</span><span style="color: #800080;">&quot;sprites/laserbeam.spr&quot;</span><span style="color: #000000;">)</span>

<span style="color: #ff0000;">stock</span> beam<span style="color: #000000;">(</span>origin1<span style="color: #000000;">[</span><span style="color: #0000dd;">3</span><span style="color: #000000;">]</span>, origin2<span style="color: #000000;">[</span><span style="color: #0000dd;">3</span><span style="color: #000000;">]</span>, <span style="color: #00c0c0;">Float</span>:seconds, rgb<span style="color: #000000;">)</span> <span style="color: #000000;">{</span>
&nbsp; &nbsp; <span style="color: #00c0c0;">message_begin</span><span style="color: #000000;">(</span>MSG_BROADCAST ,SVC_TEMPENTITY<span style="color: #000000;">)</span>
&nbsp; &nbsp; <span style="color: #00c0c0;">write_byte</span><span style="color: #000000;">(</span>TE_BEAMPOINTS<span style="color: #000000;">)</span>
&nbsp; &nbsp; <span style="color: #00c0c0;">write_coord</span><span style="color: #000000;">(</span>origin1<span style="color: #000000;">[</span><span style="color: #0000dd;">0</span><span style="color: #000000;">]</span><span style="color: #000000;">)</span>&nbsp;<span style="color: #cf0020;">// start position</span>
&nbsp; &nbsp; <span style="color: #00c0c0;">write_coord</span><span style="color: #000000;">(</span>origin1<span style="color: #000000;">[</span><span style="color: #0000dd;">1</span><span style="color: #000000;">]</span><span style="color: #000000;">)</span>
&nbsp; &nbsp; <span style="color: #00c0c0;">write_coord</span><span style="color: #000000;">(</span>origin1<span style="color: #000000;">[</span><span style="color: #0000dd;">2</span><span style="color: #000000;">]</span><span style="color: #000000;">)</span>
&nbsp; &nbsp; <span style="color: #00c0c0;">write_coord</span><span style="color: #000000;">(</span>origin2<span style="color: #000000;">[</span><span style="color: #0000dd;">0</span><span style="color: #000000;">]</span><span style="color: #000000;">)</span>&nbsp;<span style="color: #cf0020;">// end position</span>
&nbsp; &nbsp; <span style="color: #00c0c0;">write_coord</span><span style="color: #000000;">(</span>origin2<span style="color: #000000;">[</span><span style="color: #0000dd;">1</span><span style="color: #000000;">]</span><span style="color: #000000;">)</span>
&nbsp; &nbsp; <span style="color: #00c0c0;">write_coord</span><span style="color: #000000;">(</span>origin2<span style="color: #000000;">[</span><span style="color: #0000dd;">2</span><span style="color: #000000;">]</span><span style="color: #000000;">)</span>
&nbsp; &nbsp; <span style="color: #00c0c0;">write_short</span><span style="color: #000000;">(</span>g_sprite<span style="color: #000000;">)</span>&nbsp; &nbsp;<span style="color: #cf0020;">// sprite index</span>
&nbsp; &nbsp; <span style="color: #00c0c0;">write_byte</span><span style="color: #000000;">(</span><span style="color: #0000dd;">0</span><span style="color: #000000;">)</span>&nbsp; &nbsp;<span style="color: #cf0020;">// starting frame</span>
&nbsp; &nbsp; <span style="color: #00c0c0;">write_byte</span><span style="color: #000000;">(</span><span style="color: #0000dd;">10</span><span style="color: #000000;">)</span>&nbsp; <span style="color: #cf0020;">// frame rate in 0.1's</span>
&nbsp; &nbsp; <span style="color: #00c0c0;">write_byte</span><span style="color: #000000;">(</span><span style="color: #00c0c0;">floatround</span><span style="color: #000000;">(</span>seconds*<span style="color: #0000dd;">10</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span>&nbsp; <span style="color: #cf0020;">// life in 0.1's</span>
&nbsp; &nbsp; <span style="color: #00c0c0;">write_byte</span><span style="color: #000000;">(</span><span style="color: #0000dd;">10</span><span style="color: #000000;">)</span>&nbsp; <span style="color: #cf0020;">// line width in 0.1's</span>
&nbsp; &nbsp; <span style="color: #00c0c0;">write_byte</span><span style="color: #000000;">(</span><span style="color: #0000dd;">1</span><span style="color: #000000;">)</span>&nbsp; &nbsp;<span style="color: #cf0020;">// noise amplitude in 0.01's</span>
&nbsp; &nbsp; <span style="color: #00c0c0;">write_byte</span><span style="color: #000000;">(</span><span style="color: #000000;">(</span> rgb &gt;&gt; <span style="color: #0000dd;">16</span> <span style="color: #000000;">)</span> &amp; <span style="color: #0000dd;">255</span><span style="color: #000000;">)</span>&nbsp;<span style="color: #cf0020;">// Red</span>
&nbsp; &nbsp; <span style="color: #00c0c0;">write_byte</span><span style="color: #000000;">(</span><span style="color: #000000;">(</span> rgb &gt;&gt; <span style="color: #0000dd;">8</span> <span style="color: #000000;">)</span> &amp; <span style="color: #0000dd;">255</span><span style="color: #000000;">)</span>&nbsp; <span style="color: #cf0020;">// Green</span>
&nbsp; &nbsp; <span style="color: #00c0c0;">write_byte</span><span style="color: #000000;">(</span>rgb &amp; <span style="color: #0000dd;">255</span><span style="color: #000000;">)</span>&nbsp; &nbsp;<span style="color: #cf0020;">// Blue</span>
&nbsp; &nbsp; <span style="color: #00c0c0;">write_byte</span><span style="color: #000000;">(</span><span style="color: #0000dd;">127</span><span style="color: #000000;">)</span>&nbsp;<span style="color: #cf0020;">// brightness</span>
&nbsp; &nbsp; <span style="color: #00c0c0;">write_byte</span><span style="color: #000000;">(</span><span style="color: #0000dd;">10</span><span style="color: #000000;">)</span>&nbsp; <span style="color: #cf0020;">// scroll speed in 0.1's</span>
&nbsp; &nbsp; <span style="color: #00c0c0;">message_end</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>
<span style="color: #000000;">}</span>

<span style="color: #ff0000;">public</span> pos1<span style="color: #000000;">(</span>id<span style="color: #000000;">)</span>
&nbsp; &nbsp; SavePos<span style="color: #000000;">(</span>id, <span style="color: #0000dd;">0</span><span style="color: #000000;">)</span>;

<span style="color: #ff0000;">public</span> pos2<span style="color: #000000;">(</span>id<span style="color: #000000;">)</span>
&nbsp; &nbsp; SavePos<span style="color: #000000;">(</span>id, <span style="color: #0000dd;">1</span><span style="color: #000000;">)</span>;

SavePos<span style="color: #000000;">(</span>id, pos<span style="color: #000000;">)</span> <span style="color: #000000;">{</span>

&nbsp; &nbsp; <span style="color: #007700;">new</span> <span style="color: #00c0c0;">Float</span>:Origin<span style="color: #000000;">[</span><span style="color: #0000dd;">3</span><span style="color: #000000;">]</span>;
&nbsp; &nbsp; <span style="color: #007700;">new</span> <span style="color: #00c0c0;">Float</span>:End<span style="color: #000000;">[</span><span style="color: #0000dd;">3</span><span style="color: #000000;">]</span>;
&nbsp; &nbsp; <span style="color: #007700;">new</span> hTrace;

&nbsp; &nbsp; pev<span style="color: #000000;">(</span>id, pev_origin, Origin<span style="color: #000000;">)</span>;
&nbsp; &nbsp;
&nbsp; &nbsp; xs_vec_copy<span style="color: #000000;">(</span>Origin, End<span style="color: #000000;">)</span>;
&nbsp; &nbsp; End<span style="color: #000000;">[</span><span style="color: #0000dd;">2</span><span style="color: #000000;">]</span> -= <span style="color: #0000dd;">1000</span>
&nbsp; &nbsp;
&nbsp; &nbsp; engfunc<span style="color: #000000;">(</span>EngFunc_TraceLine, Origin, End, IGNORE_MONSTERS, id, hTrace<span style="color: #000000;">)</span>;
&nbsp; &nbsp; get_tr2<span style="color: #000000;">(</span>hTrace, TR_vecEndPos, Origin<span style="color: #000000;">)</span>;
&nbsp; &nbsp; free_tr2<span style="color: #000000;">(</span>hTrace<span style="color: #000000;">)</span>;
&nbsp; &nbsp;
&nbsp; &nbsp; Origin<span style="color: #000000;">[</span><span style="color: #0000dd;">2</span><span style="color: #000000;">]</span> += <span style="color: #0000dd;">10</span>;

&nbsp; &nbsp; xs_vec_copy<span style="color: #000000;">(</span>Origin, gPos<span style="color: #000000;">[</span>pos<span style="color: #000000;">]</span><span style="color: #000000;">)</span>;
<span style="color: #000000;">}</span>

<span style="color: #ff0000;">public</span> run<span style="color: #000000;">(</span>id<span style="color: #000000;">)</span> <span style="color: #000000;">{</span>
&nbsp; &nbsp; <span style="color: #00c0c0;">client_print</span><span style="color: #000000;">(</span><span style="color: #0000dd;">0</span>, print_chat, <span style="color: #800080;">&quot;Start: %.0f, %.0f, %.0f. End: %.0f, %.0f, %.0f. Distance: %.0f units.&quot;</span>, gPos<span style="color: #000000;">[</span><span style="color: #0000dd;">0</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #0000dd;">0</span><span style="color: #000000;">]</span>, gPos<span style="color: #000000;">[</span><span style="color: #0000dd;">0</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #0000dd;">1</span><span style="color: #000000;">]</span>, gPos<span style="color: #000000;">[</span><span style="color: #0000dd;">0</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #0000dd;">2</span><span style="color: #000000;">]</span>, gPos<span style="color: #000000;">[</span><span style="color: #0000dd;">1</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #0000dd;">0</span><span style="color: #000000;">]</span>, gPos<span style="color: #000000;">[</span><span style="color: #0000dd;">1</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #0000dd;">1</span><span style="color: #000000;">]</span>, gPos<span style="color: #000000;">[</span><span style="color: #0000dd;">1</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #0000dd;">2</span><span style="color: #000000;">]</span>, <span style="color: #00c0c0;">get_distance_f</span><span style="color: #000000;">(</span>gPos<span style="color: #000000;">[</span><span style="color: #0000dd;">0</span><span style="color: #000000;">]</span>, gPos<span style="color: #000000;">[</span><span style="color: #0000dd;">1</span><span style="color: #000000;">]</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span>;
&nbsp; &nbsp;
&nbsp; &nbsp; <span style="color: #007700;">new</span> Index = AStarThreaded<span style="color: #000000;">(</span>gPos<span style="color: #000000;">[</span><span style="color: #0000dd;">0</span><span style="color: #000000;">]</span>, gPos<span style="color: #000000;">[</span><span style="color: #0000dd;">1</span><span style="color: #000000;">]</span>, <span style="color: #800080;">&quot;PathDone&quot;</span>, <span style="color: #0000dd;">30</span>, IGNORE_MONSTERS, id, <span style="color: #0000dd;">35</span>, <span style="color: #0000dd;">50</span><span style="color: #000000;">)</span>;

&nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #000000;">(</span> Index == <span style="color: #0000dd;">-1</span> <span style="color: #000000;">)</span> <span style="color: #000000;">{</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00c0c0;">client_print</span><span style="color: #000000;">(</span>id, print_chat, <span style="color: #800080;">&quot;All pathfinding slots are busy.&quot;</span><span style="color: #000000;">)</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">return</span>;
&nbsp; &nbsp; <span style="color: #000000;">}</span>
&nbsp; &nbsp; gTimer<span style="color: #000000;">[</span>Index<span style="color: #000000;">]</span> = TimerStart<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;

<span style="color: #000000;">}</span>

<span style="color: #ff0000;">public</span> run2<span style="color: #000000;">(</span>id<span style="color: #000000;">)</span> <span style="color: #000000;">{</span>
&nbsp; &nbsp; <span style="color: #00c0c0;">client_print</span><span style="color: #000000;">(</span><span style="color: #0000dd;">0</span>, print_chat, <span style="color: #800080;">&quot;Start: %.0f, %.0f, %.0f. End: %.0f, %.0f, %.0f. Distance: %.0f units.&quot;</span>, gPos<span style="color: #000000;">[</span><span style="color: #0000dd;">0</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #0000dd;">0</span><span style="color: #000000;">]</span>, gPos<span style="color: #000000;">[</span><span style="color: #0000dd;">0</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #0000dd;">1</span><span style="color: #000000;">]</span>, gPos<span style="color: #000000;">[</span><span style="color: #0000dd;">0</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #0000dd;">2</span><span style="color: #000000;">]</span>, gPos<span style="color: #000000;">[</span><span style="color: #0000dd;">1</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #0000dd;">0</span><span style="color: #000000;">]</span>, gPos<span style="color: #000000;">[</span><span style="color: #0000dd;">1</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #0000dd;">1</span><span style="color: #000000;">]</span>, gPos<span style="color: #000000;">[</span><span style="color: #0000dd;">1</span><span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #0000dd;">2</span><span style="color: #000000;">]</span>, <span style="color: #00c0c0;">get_distance_f</span><span style="color: #000000;">(</span>gPos<span style="color: #000000;">[</span><span style="color: #0000dd;">0</span><span style="color: #000000;">]</span>, gPos<span style="color: #000000;">[</span><span style="color: #0000dd;">1</span><span style="color: #000000;">]</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span>;
&nbsp; &nbsp;
&nbsp; &nbsp; <span style="color: #007700;">new</span> hTimer = TimerStart<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;
&nbsp; &nbsp; <span style="color: #007700;">new</span> Array:hPath = AStar<span style="color: #000000;">(</span>gPos<span style="color: #000000;">[</span><span style="color: #0000dd;">0</span><span style="color: #000000;">]</span>, gPos<span style="color: #000000;">[</span><span style="color: #0000dd;">1</span><span style="color: #000000;">]</span>, <span style="color: #0000dd;">30</span>, IGNORE_MONSTERS, id, <span style="color: #0000dd;">35</span>, <span style="color: #0000dd;">50</span><span style="color: #000000;">)</span>;
&nbsp; &nbsp; TimerStop<span style="color: #000000;">(</span>hTimer<span style="color: #000000;">)</span>;

&nbsp; &nbsp; <span style="color: #007700;">new</span> Timer<span style="color: #000000;">[</span><span style="color: #0000dd;">32</span><span style="color: #000000;">]</span>;
&nbsp; &nbsp; TimerFormat<span style="color: #000000;">(</span>hTimer, Timer, charsmax<span style="color: #000000;">(</span>Timer<span style="color: #000000;">)</span>, <span style="color: #0000dd;">2</span><span style="color: #000000;">)</span>;

&nbsp; &nbsp; <span style="color: #00c0c0;">client_print</span><span style="color: #000000;">(</span><span style="color: #0000dd;">0</span>, print_chat, <span style="color: #800080;">&quot;Execution time: %s (%d nodes, %d validated, %d successful)&quot;</span>, Timer, AStar_GetNodesAdded<span style="color: #000000;">(</span><span style="color: #000000;">)</span>, AStar_GetNodesValidated<span style="color: #000000;">(</span><span style="color: #000000;">)</span>, AStar_GetNodesCleared<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span>;
&nbsp; &nbsp;
&nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #000000;">(</span> hPath == Invalid_Array <span style="color: #000000;">)</span> <span style="color: #000000;">{</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00c0c0;">client_print</span><span style="color: #000000;">(</span><span style="color: #0000dd;">0</span>, print_chat, <span style="color: #800080;">&quot;Pathfinding failed.&quot;</span><span style="color: #000000;">)</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">return</span>;
&nbsp; &nbsp; <span style="color: #000000;">}</span>

&nbsp; &nbsp; <span style="color: #00c0c0;">client_print</span><span style="color: #000000;">(</span><span style="color: #0000dd;">0</span>, print_chat, <span style="color: #800080;">&quot;Distance of path: %.0f units, %d steps.&quot;</span>, AStar_GetDistance<span style="color: #000000;">(</span><span style="color: #000000;">)</span>, ArraySize<span style="color: #000000;">(</span>hPath<span style="color: #000000;">)</span> - <span style="color: #0000dd;">1</span><span style="color: #000000;">)</span>;

&nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #000000;">(</span> gPath<span style="color: #000000;">[</span><span style="color: #0000dd;">10</span><span style="color: #000000;">]</span> != Invalid_Array <span style="color: #000000;">)</span>
&nbsp; &nbsp; &nbsp; &nbsp; ArrayDestroy<span style="color: #000000;">(</span>gPath<span style="color: #000000;">[</span><span style="color: #0000dd;">10</span><span style="color: #000000;">]</span><span style="color: #000000;">)</span>;

&nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #000000;">(</span> <span style="color: #00c0c0;">task_exists</span><span style="color: #000000;">(</span><span style="color: #0000dd;">10</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00c0c0;">remove_task</span><span style="color: #000000;">(</span><span style="color: #0000dd;">10</span><span style="color: #000000;">)</span>;
&nbsp; &nbsp;
&nbsp; &nbsp; <span style="color: #00c0c0;">arrayset</span><span style="color: #000000;">(</span>gLastStep<span style="color: #000000;">[</span><span style="color: #0000dd;">10</span><span style="color: #000000;">]</span>, <span style="color: #0000dd;">0</span>, sizeof gLastStep<span style="color: #000000;">[</span><span style="color: #000000;">]</span><span style="color: #000000;">)</span>;
&nbsp; &nbsp; gPath<span style="color: #000000;">[</span><span style="color: #0000dd;">10</span><span style="color: #000000;">]</span> = hPath;
&nbsp; &nbsp; <span style="color: #00c0c0;">set_task</span><span style="color: #000000;">(</span><span style="color: #0000dd;">0.2</span>, <span style="color: #800080;">&quot;ShowPath&quot;</span>, <span style="color: #0000dd;">10</span>, . <span style="color: #00eeff;">flags</span> = <span style="color: #800080;">&quot;a&quot;</span>, . <span style="color: #00eeff;">repeat</span> = ArraySize<span style="color: #000000;">(</span>hPath<span style="color: #000000;">)</span><span style="color: #000000;">)</span>;

<span style="color: #000000;">}</span>

<span style="color: #ff0000;">public</span> PathDone<span style="color: #000000;">(</span>Index, Array:hPath, <span style="color: #00c0c0;">Float</span>:Distance, NodesAdded, NodesValidated, NodesCleared<span style="color: #000000;">)</span> <span style="color: #000000;">{</span>

&nbsp; &nbsp; TimerStop<span style="color: #000000;">(</span>gTimer<span style="color: #000000;">[</span>Index<span style="color: #000000;">]</span><span style="color: #000000;">)</span>;

&nbsp; &nbsp; <span style="color: #007700;">new</span> Timer<span style="color: #000000;">[</span><span style="color: #0000dd;">32</span><span style="color: #000000;">]</span>;
&nbsp; &nbsp; TimerFormat<span style="color: #000000;">(</span>gTimer<span style="color: #000000;">[</span>Index<span style="color: #000000;">]</span>, Timer, charsmax<span style="color: #000000;">(</span>Timer<span style="color: #000000;">)</span>, <span style="color: #0000dd;">2</span><span style="color: #000000;">)</span>;

&nbsp; &nbsp; <span style="color: #00c0c0;">client_print</span><span style="color: #000000;">(</span><span style="color: #0000dd;">0</span>, print_chat, <span style="color: #800080;">&quot;Execution time: %s (%d nodes, %d validated, %d successful)&quot;</span>, Timer, NodesAdded, NodesValidated, NodesCleared<span style="color: #000000;">)</span>;
&nbsp; &nbsp;
&nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #000000;">(</span> hPath == Invalid_Array <span style="color: #000000;">)</span> <span style="color: #000000;">{</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00c0c0;">client_print</span><span style="color: #000000;">(</span><span style="color: #0000dd;">0</span>, print_chat, <span style="color: #800080;">&quot;Pathfinding failed.&quot;</span><span style="color: #000000;">)</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">return</span>;
&nbsp; &nbsp; <span style="color: #000000;">}</span>

&nbsp; &nbsp; <span style="color: #00c0c0;">client_print</span><span style="color: #000000;">(</span><span style="color: #0000dd;">0</span>, print_chat, <span style="color: #800080;">&quot;Distance of path: %.0f units, %d steps.&quot;</span>, Distance, ArraySize<span style="color: #000000;">(</span>hPath<span style="color: #000000;">)</span> - <span style="color: #0000dd;">1</span><span style="color: #000000;">)</span>;

&nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #000000;">(</span> gPath<span style="color: #000000;">[</span>Index<span style="color: #000000;">]</span> != Invalid_Array <span style="color: #000000;">)</span>
&nbsp; &nbsp; &nbsp; &nbsp; ArrayDestroy<span style="color: #000000;">(</span>gPath<span style="color: #000000;">[</span>Index<span style="color: #000000;">]</span><span style="color: #000000;">)</span>;

&nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #000000;">(</span> <span style="color: #00c0c0;">task_exists</span><span style="color: #000000;">(</span>Index<span style="color: #000000;">)</span> <span style="color: #000000;">)</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00c0c0;">remove_task</span><span style="color: #000000;">(</span>Index<span style="color: #000000;">)</span>;
&nbsp; &nbsp;
&nbsp; &nbsp; <span style="color: #00c0c0;">arrayset</span><span style="color: #000000;">(</span>gLastStep<span style="color: #000000;">[</span>Index<span style="color: #000000;">]</span>, <span style="color: #0000dd;">0</span>, sizeof gLastStep<span style="color: #000000;">[</span><span style="color: #000000;">]</span><span style="color: #000000;">)</span>;
&nbsp; &nbsp; gPath<span style="color: #000000;">[</span>Index<span style="color: #000000;">]</span> = hPath;
&nbsp; &nbsp; <span style="color: #00c0c0;">set_task</span><span style="color: #000000;">(</span><span style="color: #0000dd;">0.2</span>, <span style="color: #800080;">&quot;ShowPath&quot;</span>, Index, . <span style="color: #00eeff;">flags</span> = <span style="color: #800080;">&quot;a&quot;</span>, . <span style="color: #00eeff;">repeat</span> = ArraySize<span style="color: #000000;">(</span>hPath<span style="color: #000000;">)</span><span style="color: #000000;">)</span>;
<span style="color: #000000;">}</span>

<span style="color: #ff0000;">public</span> ShowPath<span style="color: #000000;">(</span>Index<span style="color: #000000;">)</span> <span style="color: #000000;">{</span>

&nbsp; &nbsp; <span style="color: #ff0000;">static</span> curStep<span style="color: #000000;">[</span><span style="color: #0000dd;">3</span><span style="color: #000000;">]</span>;

&nbsp; &nbsp; ArrayGetArray<span style="color: #000000;">(</span>gPath<span style="color: #000000;">[</span>Index<span style="color: #000000;">]</span>, <span style="color: #0000dd;">0</span>, curStep<span style="color: #000000;">)</span>;
&nbsp; &nbsp; ArrayDeleteItem<span style="color: #000000;">(</span>gPath<span style="color: #000000;">[</span>Index<span style="color: #000000;">]</span>, <span style="color: #0000dd;">0</span><span style="color: #000000;">)</span>;

&nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #000000;">(</span> gLastStep<span style="color: #000000;">[</span>Index<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #0000dd;">0</span><span style="color: #000000;">]</span> &amp;&amp; gLastStep<span style="color: #000000;">[</span>Index<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #0000dd;">1</span><span style="color: #000000;">]</span> &amp;&amp; gLastStep<span style="color: #000000;">[</span>Index<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #0000dd;">2</span><span style="color: #000000;">]</span> <span style="color: #000000;">)</span>
&nbsp; &nbsp; &nbsp; &nbsp; beam<span style="color: #000000;">(</span>gLastStep<span style="color: #000000;">[</span>Index<span style="color: #000000;">]</span>, curStep, <span style="color: #0000dd;">4.0</span>, Colors<span style="color: #000000;">[</span>Index % sizeof Colors<span style="color: #000000;">]</span><span style="color: #000000;">)</span>;

&nbsp; &nbsp; gLastStep<span style="color: #000000;">[</span>Index<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #0000dd;">0</span><span style="color: #000000;">]</span> = curStep<span style="color: #000000;">[</span><span style="color: #0000dd;">0</span><span style="color: #000000;">]</span>;
&nbsp; &nbsp; gLastStep<span style="color: #000000;">[</span>Index<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #0000dd;">1</span><span style="color: #000000;">]</span> = curStep<span style="color: #000000;">[</span><span style="color: #0000dd;">1</span><span style="color: #000000;">]</span>;
&nbsp; &nbsp; gLastStep<span style="color: #000000;">[</span>Index<span style="color: #000000;">]</span><span style="color: #000000;">[</span><span style="color: #0000dd;">2</span><span style="color: #000000;">]</span> = curStep<span style="color: #000000;">[</span><span style="color: #0000dd;">2</span><span style="color: #000000;">]</span>;
<span style="color: #000000;">}</span>

<span style="color: #ff0000; font-style: italic;">/* TimerFormat(hTimer, output[], maxlen, mode = 1, bool:full = 0)
* Formats the result of a timer handle into a string.
*
* Parameters:
*
* hTimer
*&nbsp; &nbsp; Timer Handle
*
* output[]
*&nbsp; &nbsp; The output string
*
* maxlen
*&nbsp; &nbsp; Maximum size of the output string
*
* mode
*&nbsp; &nbsp; 1: 00:00:00:00.000
*&nbsp; &nbsp; 2: 0d 0h 0m 0s 0ms
*
* bool:full
*&nbsp; &nbsp; If full is set to true it will print all fields, even those which contains no value.
*&nbsp; &nbsp; If full is set to false and mode is set to 1, it will print the first field that contains a value and everything after that point. For example: 03:00:00.295
*&nbsp; &nbsp; If full is set to false and mode is set to 2, it will print only the fields that contains a value. For example: 3h 295ms
*/</span>
<span style="color: #ff0000;">stock</span> TimerFormat<span style="color: #000000;">(</span>hTimer, output<span style="color: #000000;">[</span><span style="color: #000000;">]</span>, maxlen, mode = <span style="color: #0000dd;">1</span>, <span style="color: #ff0000;">bool</span>:full = <span style="color: #007700;">false</span><span style="color: #000000;">)</span> <span style="color: #000000;">{</span>
&nbsp; &nbsp; <span style="color: #007700;">new</span> len, <span style="color: #ff0000;">bool</span>:started;
&nbsp; &nbsp;
&nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #000000;">(</span> full || TimerDays<span style="color: #000000;">(</span>hTimer<span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">{</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #000000;">(</span> mode == <span style="color: #0000dd;">1</span> <span style="color: #000000;">)</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; len = formatex<span style="color: #000000;">(</span>output, maxlen, <span style="color: #800080;">&quot;%02d:&quot;</span>, TimerDays<span style="color: #000000;">(</span>hTimer<span style="color: #000000;">)</span><span style="color: #000000;">)</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">else</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; len = formatex<span style="color: #000000;">(</span>output, maxlen, <span style="color: #800080;">&quot;%dd &quot;</span>, TimerDays<span style="color: #000000;">(</span>hTimer<span style="color: #000000;">)</span><span style="color: #000000;">)</span>;
&nbsp; &nbsp; &nbsp; &nbsp; started = <span style="color: #007700;">true</span>;
&nbsp; &nbsp; <span style="color: #000000;">}</span>
&nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #000000;">(</span> full || <span style="color: #000000;">(</span> started &amp;&amp; mode == <span style="color: #0000dd;">1</span> <span style="color: #000000;">)</span> || TimerHours<span style="color: #000000;">(</span>hTimer<span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">{</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #000000;">(</span> mode == <span style="color: #0000dd;">1</span> <span style="color: #000000;">)</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; len += formatex<span style="color: #000000;">(</span>output<span style="color: #000000;">[</span>len<span style="color: #000000;">]</span>, maxlen - len, <span style="color: #800080;">&quot;%02d:&quot;</span>, TimerHours<span style="color: #000000;">(</span>hTimer<span style="color: #000000;">)</span><span style="color: #000000;">)</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">else</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; len += formatex<span style="color: #000000;">(</span>output<span style="color: #000000;">[</span>len<span style="color: #000000;">]</span>, maxlen - len, <span style="color: #800080;">&quot;%dh &quot;</span>, TimerHours<span style="color: #000000;">(</span>hTimer<span style="color: #000000;">)</span><span style="color: #000000;">)</span>;
&nbsp; &nbsp; &nbsp; &nbsp; started = <span style="color: #007700;">true</span>;
&nbsp; &nbsp; <span style="color: #000000;">}</span>
&nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #000000;">(</span> full || <span style="color: #000000;">(</span> started &amp;&amp; mode == <span style="color: #0000dd;">1</span> <span style="color: #000000;">)</span> || TimerMinutes<span style="color: #000000;">(</span>hTimer<span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">{</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #000000;">(</span> mode == <span style="color: #0000dd;">1</span> <span style="color: #000000;">)</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; len += formatex<span style="color: #000000;">(</span>output<span style="color: #000000;">[</span>len<span style="color: #000000;">]</span>, maxlen - len, <span style="color: #800080;">&quot;%02d:&quot;</span>, TimerMinutes<span style="color: #000000;">(</span>hTimer<span style="color: #000000;">)</span><span style="color: #000000;">)</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">else</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; len += formatex<span style="color: #000000;">(</span>output<span style="color: #000000;">[</span>len<span style="color: #000000;">]</span>, maxlen - len, <span style="color: #800080;">&quot;%dm &quot;</span>, TimerMinutes<span style="color: #000000;">(</span>hTimer<span style="color: #000000;">)</span><span style="color: #000000;">)</span>;
&nbsp; &nbsp; &nbsp; &nbsp; started = <span style="color: #007700;">true</span>;
&nbsp; &nbsp; <span style="color: #000000;">}</span>
&nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #000000;">(</span> full || <span style="color: #000000;">(</span> started &amp;&amp; mode == <span style="color: #0000dd;">1</span> <span style="color: #000000;">)</span> || TimerSeconds<span style="color: #000000;">(</span>hTimer<span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">{</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #000000;">(</span> mode == <span style="color: #0000dd;">1</span> <span style="color: #000000;">)</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; len += formatex<span style="color: #000000;">(</span>output<span style="color: #000000;">[</span>len<span style="color: #000000;">]</span>, maxlen - len, <span style="color: #800080;">&quot;%02d.&quot;</span>, TimerSeconds<span style="color: #000000;">(</span>hTimer<span style="color: #000000;">)</span><span style="color: #000000;">)</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">else</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; len += formatex<span style="color: #000000;">(</span>output<span style="color: #000000;">[</span>len<span style="color: #000000;">]</span>, maxlen - len, <span style="color: #800080;">&quot;%ds &quot;</span>, TimerSeconds<span style="color: #000000;">(</span>hTimer<span style="color: #000000;">)</span><span style="color: #000000;">)</span>;
&nbsp; &nbsp; &nbsp; &nbsp; started = <span style="color: #007700;">true</span>;
&nbsp; &nbsp; <span style="color: #000000;">}</span>
&nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #000000;">(</span> full || <span style="color: #000000;">(</span> started &amp;&amp; mode == <span style="color: #0000dd;">1</span> <span style="color: #000000;">)</span> || TimerMilliseconds<span style="color: #000000;">(</span>hTimer<span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">{</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #000000;">(</span> mode == <span style="color: #0000dd;">1</span> <span style="color: #000000;">)</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; len += formatex<span style="color: #000000;">(</span>output<span style="color: #000000;">[</span>len<span style="color: #000000;">]</span>, maxlen - len, <span style="color: #800080;">&quot;%03d&quot;</span>, TimerMilliseconds<span style="color: #000000;">(</span>hTimer<span style="color: #000000;">)</span><span style="color: #000000;">)</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">else</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; len += formatex<span style="color: #000000;">(</span>output<span style="color: #000000;">[</span>len<span style="color: #000000;">]</span>, maxlen - len, <span style="color: #800080;">&quot;%dms&quot;</span>, TimerMilliseconds<span style="color: #000000;">(</span>hTimer<span style="color: #000000;">)</span><span style="color: #000000;">)</span>;
&nbsp; &nbsp; <span style="color: #000000;">}</span>
<span style="color: #000000;">}</span></div></pre>
</div>
<!-- /Code block -->
<!-- END TEMPLATE: bbcode_code --><br />And here's an example image of a path between two points that has objects, corners and height differences.<br /><div style="margin: 5px;">
<div class="smallfont" style="margin-bottom: 2px;">
<b>Spoiler</b> <input value="Show" style="margin: 0px; padding: 0px; width: 45px; font-size: 10px;" onclick="if(this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != 'inline')
{ this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'inline'; this.innerText = ''; this.value = 'Hide'; }
else
{ this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value='Show'; }" type="button">
</div>
<div class="alt2" style="border: 1px inset; padding: 6px;">
<div class="spoiler" style="display: none;"><br /><img src="http://DivinityX.eu/...mages/AStar.jpg" border="0" alt="" /><br /></div>
</div>
</div><br />It was hard taking a good picture since the beams disappear really fast. You get the point.<br /><br /><font size="+1">Changelog:</font><br /><!-- BEGIN TEMPLATE: bbcode_code_printable -->
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px">Code:</div>
<hr /><code style="margin:0px" dir="ltr" style="text-align:left">Version 1.0<br />* Initial release.<br /><br />Version 1.1<br />* Added possibility of running the pathfinding as &quot;threaded&quot;. (Thinking entity, not actually threaded.)</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable --><font size="+1">Additional notes:</font><br />Use this file however you want. Credit not required.<br /><br />The best would probably be to make it a module. Feel free to do so (I'm not good enough). You have my permission to use any of this code in that project.<br /><br />I'm always open to suggestions, feedback and criticism. I aim to add as much support as possible. Please share your thoughts.</div>


<br /> <div style="padding:6px">








<fieldset class="fieldset">
<legend>Attached Files</legend>
<table cellpadding="0" cellspacing="3" border="0">
<!-- BEGIN TEMPLATE: postbit_attachment -->
<tr>
<td><img class="inlineimg" src="https://forums.allie.../attach/sma.gif" alt="File Type: sma" width="16" height="16" border="0" style="vertical-align:baseline" /></td>
<td>

<a href="http://www.amxmodx.o...?file_id=134552"><strong>Get Plugin</strong></a> or
<a href="https://forums.allie...38;d=1403320822">Get Source</a> (astar.sma - 11.9 KB)

</td>
</tr>
<!-- END TEMPLATE: postbit_attachment --><!-- BEGIN TEMPLATE: postbit_attachment -->
<tr>
<td><img class="inlineimg" src="https://forums.allie.../attach/inc.gif" alt="File Type: inc" width="16" height="16" border="0" style="vertical-align:baseline" /></td>
<td>


<a href="https://forums.allie...38;d=1403358826">astar.inc</a> (3.7 KB)


</td>
</tr>
<!-- END TEMPLATE: postbit_attachment -->
</table>
</fieldset>


</div>

<!-- END TEMPLATE: postbit_external -->

Wyświetl pełny artykuł

#2 gravelpootis

    Nowy

  • Nowy

Reputacja: 0
Nowy

  • Postów:1
  • Imię:Gravel Pootis
  • Lokalizacja:Slovakia
Offline

Napisano 24.11.2017 12:58

where i need to put this code ? it looks like html


  • +
  • -
  • 0

#3 Robiin

    Godlike

  • Support Team

Reputacja: 1 103
Super Hero

  • Postów:2 043
  • Imię:Robert
  • Lokalizacja:Wrocław
Offline

Napisano 24.11.2017 13:38

where i need to put this code ? it looks like html

https://forums.allie...ad.php?t=242208


  • +
  • -
  • 0

Nie dołączam do żadnej sieci, nie pomagam z tworzeniem paczek, nie napisze pluginów za zero.





Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych