|
You last visited: Today at 05:53
Advertisement
[R]Quest Funktion, Entfernung zum Spieler
Discussion on [R]Quest Funktion, Entfernung zum Spieler within the Metin2 PServer Guides & Strategies forum part of the Metin2 Private Server category.
08/23/2018, 18:22
|
#1
|
elite*gold: 0
Join Date: May 2013
Posts: 605
Received Thanks: 580
|
[R]Quest Funktion, Entfernung zum Spieler
"Nur für Quester"
Ich Release das mal hier, weil ich es bestimmt wieder vergesse wie ich es gemacht habe.
Man kann diese Funktion benutzen um bestimmte Spieler im Radius einen Buff zu geben oder man kann auch Pets erstellen die in einem radius diesen bonus gibt.
(Man erstellt ein Imaginären Kreis, wenn der spieler im kreis ist, wird ein text übergeben)
PHP Code:
pc = pc or {}
pc.inRadius = function(xpos,ypos,radius)
return ((xpos-pc.get_x())^2+(ypos-pc.get_y())^2 <= radius)
end
radius = 10
spielerx,spielery,spielervid = math.random(),math.random(),npc.vid()
if pc.inRadius(spielerx,spielery,radius) then
print(npc.vid().." ist im kreis")
end
|
|
|
09/01/2018, 11:43
|
#2
|
elite*gold: 83
Join Date: Nov 2013
Posts: 2,891
Received Thanks: 2,764
|
Du hast vergessen die Quadratwurzel zur korrekten Berechnung der Entfernung zu ziehen. (a² + b² = c²). Du willst aber ja nicht auf c² kommen, sondern auf c.
Beispiel:
Code:
function calculateDistance(x0, y0, x1, y1)
return math.sqrt(math.pow(x0 - x1, 2) + math.pow(y0 - y1, 2))
end
function inRadius(x0, y0, x1, y1, radius)
return calculateDistance(x0, y0, x1, y1) <= radius
end
function pc.inRadius(x, y, radius)
return inRadius(x, y, pc.get_x(), pc.get_y(), radius)
end
|
|
|
09/02/2018, 13:13
|
#3
|
elite*gold: 0
Join Date: May 2013
Posts: 605
Received Thanks: 580
|
Quote:
Originally Posted by rollback
Du hast vergessen die Quadratwurzel zur korrekten Berechnung der Entfernung zu ziehen. (a² + b² = c²). Du willst aber ja nicht auf c² kommen, sondern auf c.
Beispiel:
Code:
function calculateDistance(x0, y0, x1, y1)
return math.sqrt(math.pow(x0 - x1, 2) + math.pow(y0 - y1, 2))
end
function inRadius(x0, y0, x1, y1, radius)
return calculateDistance(x0, y0, x1, y1) <= radius
end
function pc.inRadius(x, y, radius)
return inRadius(x, y, pc.get_x(), pc.get_y(), radius)
end
|
hatte ich noch vergessen die wurzel zu Ziehen
ps: ich bin es gewohnt den Code immer so kurz zu halten wie möglich
PHP Code:
radius = 10
pc.inRadius = function(xpos,ypos,radius)
return math.sqrt((xpos-pc.get_x())^2+(ypos-pc.get_y())^2)<= radius
end
-- Test
if pc.inRadius(pc.get_x()+10,pc.get_y()+10,radius) then
print(npc.vid().." ist im kreis")
end
|
|
|
 |
Similar Threads
|
Quest Funktion: Spieler verwandeln
07/15/2014 - Metin2 Private Server - 2 Replies
Gibt es eine Funktion, mit der man Spieler in Mobs verwandeln kann? Wenn ja welche? :D
MFG
|
Compile all quest without quest's files list // Kompilieren Sie alle Quest ohne Quest
07/17/2011 - Metin2 PServer Guides & Strategies - 3 Replies
ENGLISH
Hello dear community, this is a very simple guide but at the same time useful.
How to compile ALL quest in the folder "quest" without the files list in the file "locale_list"?
Easy!
Open the file "make" and replace the content of the file with this:
for f in *.quest; do ./qc $f; done
Oki. Now set the 0777 permission to the file.
Finally open a SSH client and sign in. Write the command:
cd /game_file_folder
|
Hilfe bei Send Funktion mit Stop Funktion
04/02/2011 - AutoIt - 11 Replies
Hallo Elitepvpers
ich habe ein Problem und Mein Problem ist das mein Text einfach weiter schreibt wenn ich mit HotKey verwende... gib es keine Funktion das der Text einmal kommt und nicht wenn man einmal die HotKey das er 10 min das selbe schreibt :confused:
|
[C++]Funktion einer Klasse in einer anderen Funktion der Klasse verwenden, aber wie?
07/25/2010 - C/C++ - 3 Replies
Mein Problem ist eigentlich recht simpel und die Lösung wahrscheinlich auch.
Da ich bisher fast 0 mit Klassen am Hut hatte, wollte ich mich doch mit dem Thema anfreunden und hatte gleich angefangen:
int test::Funktion2()
{
int temp;
cin>>temp;
return temp;
}
|
All times are GMT +1. The time now is 05:53.
|
|