Script for testing spawns by man_at_arms

Click here for Support Forum

On Win2k or Winxp just save it as badspawn.vbs in the map directory, and you should be able to execute it running "cscript badspawn.vbs" from a command line.

Const ForReading = 1
Dim Array(10000)
Dim x(10000)
Dim y(10000)
Dim z(10000)

Dim strFlag
Dim intState, intArgIter
Dim objFileSystem

If Wscript.Arguments.Count > 0 Then
strFlag = Wscript.arguments.Item(0)
End If

If IsEmpty(strFlag) Then 'No arguments have been received
wscript.echo "Must supply an entity file name"
wscript.quit
End If

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile (strflag, ForReading)

i=0
l=0
Do Until objTextFile.AtEndOfStream
i=i+1
Array(i) = objTextFile.Readline
If InStr(Array(i),"info_player_deathmatch") or InStr(Array(i),"info_player_start") Then
If InStr(Array(i-1),"origin") Then temp=Mid(Array(i-1),11,Len( Array(i-1) )-11)
If InStr(Array(i-2),"origin") Then temp=Mid(Array(i-2),11,Len( Array(i-2) )-11)
arrayn=split(temp," ")
x(l)=arrayn(0)
y(l)=arrayn(1)
z(l)=arrayn(2)
l=l+1
End If
Loop

bs=0
For j=1 to l
For u=j to l
If u<>j Then
If Sqr( (( x(j)-x(u) )^2) + (( y(j)-y(u) )^2) + (( z(j)-z(u) )^2) ) < 80 Then
wscript.echo "Bad Spawn Found:"
wscript.echo x(u),y(u),z(u)
wscript.echo x(j),y(j),z(j)
wscript.echo "Distance: " & Sqr( (( x(j)-x(u) )^2) + (( y(j)-y(u) )^2) + (( z(j)-z(u) )^2) )
wscript.echo
a=createarrow(x(u),y(u),z(u))
b=createarrow(x(j),y(j),z(j))
bs=bs+1
End If
End If
Next
Next

n=l+( l* ( (l-1)/2) )
wscript.echo
wscript.echo l & " Spawns found"
wscript.echo bs & " Bad spawns pairs out of "& n & " found"

Function createarrow(f,g,h)
wscript.echo "{"
wscript.echo chr(34) & "origin" & chr(34) & " " & chr(34) & f & " " & g & " " & h & chr(34)
wscript.echo chr(34) & "scale" & chr(34) & " " & chr(34) & "1.0" & chr(34)
wscript.echo chr(34) & "model" & chr(34) & " " & chr(34) & "sprites/arrow1.spr" &chr(34)
wscript.echo chr(34) & "rendercolor" & chr(34) & " " & Chr(34) & "255 255 255" & chr(34)
wscript.echo chr(34) & "renderamt" & chr(34) & " " & chr(34) & "200" & chr(34)
wscript.echo chr(34) & "rendermode" & chr(34) & " " & chr(34) & "4" & chr(34)
wscript.echo chr(34) & "renderfx" & chr(34) & " " & chr(34) & "14" & chr(34)
wscript.echo chr(34) & "classname" & chr(34) & " " & chr(34) & "env_glow" & chr(34)
wscript.echo "}"
End Function