Function doesn't get loaded at all...
Posted: Fri Nov 07, 2008 7:05 pm
by Aman/Pinguin
Okay short story, I made 3 functions which do nearly the same and use the same method, my problem is that the second and third function don't get used at all. I tested it by putting print commands in...they don't get printed.
I have no idea why, and hope somebody knows a solution.
I made the working part in big letters.
It's pretty hard to read it here in the forum, so here is a download for it in a file: http://files.filefront.com/half+working ... einfo.html
EDIT: Not sure if I explained it how everyone can understand it...it's late here and I'm tired.
If there are any questions fell free to ask I will answer them tomorrow...
I have no idea why, and hope somebody knows a solution.
I made the working part in big letters.
Hidden/Spoiler:
OnCharacterSpawn(
function(character)
if uf_processPlayers then
--a function to kill Roan, the function takes a single table 'players' as an argument/parameter
local KillRoan = function( players )
--can't do anything if the player data table is missing
if not players then return end
--for each player ingame,
local i
for i=1,table.getn(players) do
--search for the player
if (players.namestr == "=][Legend][=Silverstar™=GER=") or
(players.namestr == "=][Legend][=Roan=GER=") or
(players.namestr == "=][Legend][=Roan") or
(players.namestr == "=][Legend][=Roan™") or
(players.namestr == "=][Legend][=RoanShryne=GER=") or
(players.namestr == "=][Legend][=Roan™=GER=") or
(players.namestr == "=][Legend][=RoanShryne™=GER=") or
(players.namestr == "=][Legend][=Silverstar=GER=") or
(players.namestr == "=][Legend][=Silverstar") or
(players.namestr == "=][Legend][=Silverstar™") then
--get Roan's unit
local unit = GetCharacterUnit(players[i].indexstr)
if not unit then return end --Roan is already dead, so there is nothing more for us to do
--kill Roan's Unit
KillObject( unit )
return end
end
end
-- THE FUNCTIONS BELOW DONT GET LOADED AT ALL! the first print there ("user_script_1: Entered Gaman function") doesn't get printed when I spawn!
local Gaman = function( players )
print("user_script_1: Entered Gaman function")
--can't do anything if the player data table is missing
if not players then return end
--for each player ingame,
local i
for i=1,table.getn(players) do
print("user_script_1: 'for i=1,table.getn(players) do' has been reached")
--search for the player
if (players[i].namestr == "=ro[D]Pinguin/Gaman") then
print("user_script_1: Player is Pinguin")
if __thisMapsMode__ == "tat3_con" and JustSpawned == 0 then
print("user_script_1: -SpawnAsGammo- Jabba's Palace has been detected")
local Pingunit = GetCharacterUnit(players[i].indexstr)
if not unit then return end
KillObject( Pingunit )
if GetCharacterTeam(players[i].indexstr) == 1 then
AddReinforcements(1, 1 )
elseif GetCharacterTeam(players[i].indexstr) == 2 then
AddReinforcements(2, 1 )
end
if UserDeathGamPinguin == 1 then
UserDeathGam = 2
elseif UserDeathGamPinguin == 0 then
UserDeathGam = 1
end
if UserDeathGamPinguin == 2 then
JustSpawned = 1
Pinggammo_timer = CreateTimer("Pinggammo_timer")
SetTimerValue(Pinggammo_timer, 5)
StartTimer(Pinggammo_timer)
OnTimerElapse(
function(timer)
JustSpawned = 0
UserDeathGamPinguin = 0
DestroyTimer(timer)
end,
Pinggammo_timer)
end
if GetCharacterTeam(players[i].indexstr) == 1 then
SelectCharacterClass(players[i].indexstr, "gam_inf_gamorreanguard")
SpawnCharacter(players[i].indexstr, GetPathPoint("CP1SPAWN", 0))
end
if GetCharacterTeam(players[i].indexstr) == 2 then
SelectCharacterClass(players[i].indexstr, "gam_inf_gamorreanguard")
SpawnCharacter(players[i].indexstr, GetPathPoint("CP4Spawn", 0))
end
end
return end
end
end
local Smuff = function( players )
--can't do anything if the player data table is missing
if not players then return end
--for each player ingame,
local i
for i=1,table.getn(players) do
--search for the player
if (players[i].namestr == "=ro[D]smuff") then
print("user_script_1: Player is Smove")
if __thisMapsMode__ == "tat3_con" and JustSpawned == 0 then
print("user_script_1: -SpawnAsGammo- Jabba's Palace has been detected")
local Smuffunit = GetCharacterUnit(players[i].indexstr)
if not unit then return end
KillObject( Smuffunit )
if GetCharacterTeam(players[i].indexstr) == 1 then
AddReinforcements(1, 1 )
elseif GetCharacterTeam(players[i].indexstr) == 2 then
AddReinforcements(2, 1 )
end
if UserDeathGamSmove == 1 then
UserDeathGam = 2
elseif UserDeathGamSmove == 0 then
UserDeathGam = 1
end
if UserDeathGamSmove == 2 then
JustSpawned = 1
smuff_timer = CreateTimer("smuff_timer")
SetTimerValue(smuff_timer, 5)
StartTimer(smuff_timer)
OnTimerElapse(
function(timer)
JustSpawned = 0
UserDeathGamSmove = 0
DestroyTimer(timer)
end,
smuff_timer)
end
if GetCharacterTeam(players[i].indexstr) == 1 then
SelectCharacterClass(players[i].indexstr, "gam_inf_gamorreanguard")
SpawnCharacter(players[i].indexstr, GetPathPoint("CP1SPAWN", 0))
end
if GetCharacterTeam(players[i].indexstr) == 2 then
SelectCharacterClass(players[i].indexstr, "gam_inf_gamorreanguard")
SpawnCharacter(players[i].indexstr, GetPathPoint("CP4Spawn", 0))
end
end
return end
end
end
uf_processPlayers( Smuff )
uf_processPlayers( Gaman )
uf_processPlayers( KillRoan )
else
--of course, the player won't see this debug message, but it doesn't hurt to have it...
print("WARNING: Cannot Kill Roan / Spawn Player As Gammo: The uf_processPlayers function is missing. Please update your game to the latest UnOfficial v1.3 patch")
end
end
)
function(character)
if uf_processPlayers then
--a function to kill Roan, the function takes a single table 'players' as an argument/parameter
local KillRoan = function( players )
--can't do anything if the player data table is missing
if not players then return end
--for each player ingame,
local i
for i=1,table.getn(players) do
--search for the player
if (players.namestr == "=][Legend][=Silverstar™=GER=") or
(players.namestr == "=][Legend][=Roan=GER=") or
(players.namestr == "=][Legend][=Roan") or
(players.namestr == "=][Legend][=Roan™") or
(players.namestr == "=][Legend][=RoanShryne=GER=") or
(players.namestr == "=][Legend][=Roan™=GER=") or
(players.namestr == "=][Legend][=RoanShryne™=GER=") or
(players.namestr == "=][Legend][=Silverstar=GER=") or
(players.namestr == "=][Legend][=Silverstar") or
(players.namestr == "=][Legend][=Silverstar™") then
--get Roan's unit
local unit = GetCharacterUnit(players[i].indexstr)
if not unit then return end --Roan is already dead, so there is nothing more for us to do
--kill Roan's Unit
KillObject( unit )
return end
end
end
-- THE FUNCTIONS BELOW DONT GET LOADED AT ALL! the first print there ("user_script_1: Entered Gaman function") doesn't get printed when I spawn!
local Gaman = function( players )
print("user_script_1: Entered Gaman function")
--can't do anything if the player data table is missing
if not players then return end
--for each player ingame,
local i
for i=1,table.getn(players) do
print("user_script_1: 'for i=1,table.getn(players) do' has been reached")
--search for the player
if (players[i].namestr == "=ro[D]Pinguin/Gaman") then
print("user_script_1: Player is Pinguin")
if __thisMapsMode__ == "tat3_con" and JustSpawned == 0 then
print("user_script_1: -SpawnAsGammo- Jabba's Palace has been detected")
local Pingunit = GetCharacterUnit(players[i].indexstr)
if not unit then return end
KillObject( Pingunit )
if GetCharacterTeam(players[i].indexstr) == 1 then
AddReinforcements(1, 1 )
elseif GetCharacterTeam(players[i].indexstr) == 2 then
AddReinforcements(2, 1 )
end
if UserDeathGamPinguin == 1 then
UserDeathGam = 2
elseif UserDeathGamPinguin == 0 then
UserDeathGam = 1
end
if UserDeathGamPinguin == 2 then
JustSpawned = 1
Pinggammo_timer = CreateTimer("Pinggammo_timer")
SetTimerValue(Pinggammo_timer, 5)
StartTimer(Pinggammo_timer)
OnTimerElapse(
function(timer)
JustSpawned = 0
UserDeathGamPinguin = 0
DestroyTimer(timer)
end,
Pinggammo_timer)
end
if GetCharacterTeam(players[i].indexstr) == 1 then
SelectCharacterClass(players[i].indexstr, "gam_inf_gamorreanguard")
SpawnCharacter(players[i].indexstr, GetPathPoint("CP1SPAWN", 0))
end
if GetCharacterTeam(players[i].indexstr) == 2 then
SelectCharacterClass(players[i].indexstr, "gam_inf_gamorreanguard")
SpawnCharacter(players[i].indexstr, GetPathPoint("CP4Spawn", 0))
end
end
return end
end
end
local Smuff = function( players )
--can't do anything if the player data table is missing
if not players then return end
--for each player ingame,
local i
for i=1,table.getn(players) do
--search for the player
if (players[i].namestr == "=ro[D]smuff") then
print("user_script_1: Player is Smove")
if __thisMapsMode__ == "tat3_con" and JustSpawned == 0 then
print("user_script_1: -SpawnAsGammo- Jabba's Palace has been detected")
local Smuffunit = GetCharacterUnit(players[i].indexstr)
if not unit then return end
KillObject( Smuffunit )
if GetCharacterTeam(players[i].indexstr) == 1 then
AddReinforcements(1, 1 )
elseif GetCharacterTeam(players[i].indexstr) == 2 then
AddReinforcements(2, 1 )
end
if UserDeathGamSmove == 1 then
UserDeathGam = 2
elseif UserDeathGamSmove == 0 then
UserDeathGam = 1
end
if UserDeathGamSmove == 2 then
JustSpawned = 1
smuff_timer = CreateTimer("smuff_timer")
SetTimerValue(smuff_timer, 5)
StartTimer(smuff_timer)
OnTimerElapse(
function(timer)
JustSpawned = 0
UserDeathGamSmove = 0
DestroyTimer(timer)
end,
smuff_timer)
end
if GetCharacterTeam(players[i].indexstr) == 1 then
SelectCharacterClass(players[i].indexstr, "gam_inf_gamorreanguard")
SpawnCharacter(players[i].indexstr, GetPathPoint("CP1SPAWN", 0))
end
if GetCharacterTeam(players[i].indexstr) == 2 then
SelectCharacterClass(players[i].indexstr, "gam_inf_gamorreanguard")
SpawnCharacter(players[i].indexstr, GetPathPoint("CP4Spawn", 0))
end
end
return end
end
end
uf_processPlayers( Smuff )
uf_processPlayers( Gaman )
uf_processPlayers( KillRoan )
else
--of course, the player won't see this debug message, but it doesn't hurt to have it...
print("WARNING: Cannot Kill Roan / Spawn Player As Gammo: The uf_processPlayers function is missing. Please update your game to the latest UnOfficial v1.3 patch")
end
end
)
It's pretty hard to read it here in the forum, so here is a download for it in a file: http://files.filefront.com/half+working ... einfo.html
EDIT: Not sure if I explained it how everyone can understand it...it's late here and I'm tired.
If there are any questions fell free to ask I will answer them tomorrow...