Name this script winitem.lua and place it in the scriptbank folder.
Assign it to the object you want to be the win object and when the player gets 80 units from it it will jump to an assigned level in the ifused field.
If no next level is assigned there, it will end the game.
In test game you will get a level complete trigger prompt, but when you build your stand alone, then you will see it end the game or jump to the next level.
function winitem_init(e)
end
function winitem_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 80 and g_PlayerHealth > 0 then
PlaySound(e,0)
JumpToLevelIfUsed(e)
Destroy(e)
ActivateIfUsed(e)
end
end
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit