Quote:
Originally Posted by Exolent[jNr]
Show your full code in getting the first original origin.
|
i tested the
RuneMod plugin today, found that sometimes two or three runes spawned at a same location,so i thought this part of code is not that good.
PHP Code:
new EntNum = SpawnRune(RuneIndex,g_SpawnOrigin[SpawnPoint]) // We spawn the rune
new LocStatus = CheckDistance(EntNum,SpawnPoint) // We check the the Spawn location the rune was spawned at, and
if(LocStatus == 2) // This means the newly spawned rune was to close to 1 of the other runes. We now try 5 random other locations to see if their free
{
new CPS=0 // Just incase, we will only check 5 diffrent spawn locations
while( LocStatus == 2 && CPS < 5)
{
CPS++
SpawnPoint = random_num(1,g_NumberOfSpawnPoints)
LocStatus = CheckDistance(EntNum,SpawnPoint)
}
set_origin(EntNum,g_SpawnOrigin[SpawnPoint])
}
PHP Code:
stock CheckDistance(EntNum,IndexInSpawnArray) // This stuck is used to check the distance between where a rune is spawned, and the other runes ingame. To make sure their not spawned to close together
{
new Origin[3]
for(new i=0;i<=MAX_RUNESINGAME;i++) if(g_RuneEntNum[i][0] && g_RuneEntNum[i][0] != EntNum)
{
get_origin(g_RuneEntNum[i][0],Origin)
if(get_distance(Origin,g_SpawnOrigin[IndexInSpawnArray]) < MIN_DISTANCE_BETWEEN_RUNES)
{
return 2
}
}
return 1
}