Strange Non-Lethal Severity 3 Error [Solved]

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
jedimoose32
Field Commander
Field Commander
Posts: 938
Joined: Thu Jan 24, 2008 12:41 am
Projects :: Engineering Degree
Location: The Flatlands of Canada

Strange Non-Lethal Severity 3 Error [Solved]

Post by jedimoose32 »

Hey, has anyone seen this before? I think it might have something to do with the AddMissionObjective callback but I'm not sure because unlike most other Sev-3 errors it doesn't point me to the line or function that's causing the problem.
Here's what it looks like in my log (brace yourself):
Hidden/Spoiler:
[code]
Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 10 out of range [0..10)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 11 out of range [0..10)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 12 out of range [0..10)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 13 out of range [0..10)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 14 out of range [0..10)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 15 out of range [0..10)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 16 out of range [0..10)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 17 out of range [0..10)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 18 out of range [0..10)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 19 out of range [0..10)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 20 out of range [0..10)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 21 out of range [0..10)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 22 out of range [0..10)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 23 out of range [0..10)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 24 out of range [0..10)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 25 out of range [0..10)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 26 out of range [0..10)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 27 out of range [0..10)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 28 out of range [0..10)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 29 out of range [0..10)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 30 out of range [0..10)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 31 out of range [0..10)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 16 out of range [0..16)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 17 out of range [0..16)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 18 out of range [0..16)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 19 out of range [0..16)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 20 out of range [0..16)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 21 out of range [0..16)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 22 out of range [0..16)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 23 out of range [0..16)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 24 out of range [0..16)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 25 out of range [0..16)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 26 out of range [0..16)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 27 out of range [0..16)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 28 out of range [0..16)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 29 out of range [0..16)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 30 out of range [0..16)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found

Message Severity: 3
.\Source\LuaCallbacks_Mission.cpp(3441)
Slot 31 out of range [0..16)

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(3640)
Character -276123 not found
[/code]
Thankfully it has no effect on the game (doesn't cause any functions to crash, doesn't halt gameplay progression or cause anything to return nil values) but I'm definitely curious as to what it means.
Edit: It's worth mentioning that my script has plenty of debug printing, and what I've found is that this wall of errors tends to appear shortly after ShowMessageText("game.assn.whatever"). The localization directory game > assn is where I keep all the gamemode specific localization.
Last edited by jedimoose32 on Wed Apr 01, 2015 1:40 pm, edited 1 time in total.
ZoomV
Rebel Warrant Officer
Rebel Warrant Officer
Posts: 308
Joined: Thu Aug 15, 2013 11:27 am
Projects :: Old Republic Map pack
Games I'm Playing :: BF2 SWTOR and GW2
xbox live or psn: No gamertag set
Location: Belsavis, Maximum Security Ward

Re: Strange Non-Lethal Severity 3 Error

Post by ZoomV »

"Slot out of range" is making me think of a array or vector.
jedimoose32
Field Commander
Field Commander
Posts: 938
Joined: Thu Jan 24, 2008 12:41 am
Projects :: Engineering Degree
Location: The Flatlands of Canada

Re: Strange Non-Lethal Severity 3 Error

Post by jedimoose32 »

Yeah, me too. But "Character -276123 not found" sounds like it's trying to read a letter or symbol and can't do it.
Noobasaurus
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2006
Joined: Tue Aug 17, 2010 5:56 pm

Re: Strange Non-Lethal Severity 3 Error

Post by Noobasaurus »

I've encountered the "Character -276123 not found" before. I'm fairly sure it's when you try to GetCharacterUnit of someone that doesn't exist. Or something like that. Something to do with trying to find or get something out of a character that doesn't exist. Either that or the input for GetCharacterUnit is invalid. I think.
jedimoose32
Field Commander
Field Commander
Posts: 938
Joined: Thu Jan 24, 2008 12:41 am
Projects :: Engineering Degree
Location: The Flatlands of Canada

Re: Strange Non-Lethal Severity 3 Error

Post by jedimoose32 »

Interesting. I'm not sure if that's the case though, because usually GetCharacterUnit will return a "Expected string, got nil" error if the unit doesn't exist. Plus there is no GetCharacterUnit in the section of code that's running at the time this error is printed.
Noobasaurus
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2006
Joined: Tue Aug 17, 2010 5:56 pm

Re: Strange Non-Lethal Severity 3 Error

Post by Noobasaurus »

What is running at the time this error is printed?
jedimoose32
Field Commander
Field Commander
Posts: 938
Joined: Thu Jan 24, 2008 12:41 am
Projects :: Engineering Degree
Location: The Flatlands of Canada

Re: Strange Non-Lethal Severity 3 Error

Post by jedimoose32 »

This, I believe:
Hidden/Spoiler:
[code]
local eachDifUnit = function(lvlPtr)
local spawnernode = GetPathPoint(self.difGuardSpawners[math.random(table.getn(self.difGuardSpawners))], 0)
if lvlPtr == 2 then
for i = 0, 3 do
local spawnmember = GetTeamMember(self.teamDF2, i)
SpawnCharacter(spawnmember, spawnernode)
end
elseif lvlPtr == 3 then
for i = 4, 7 do
local spawnmember = GetTeamMember(self.teamDF2, i)
SpawnCharacter(spawnmember, spawnernode)
end
elseif lvlPtr == 4 then
for i = 8, 11 do
local spawnmember = GetTeamMember(self.teamDF2, i)
SpawnCharacter(spawnmember, spawnernode)
end
elseif lvlPtr == 5 then
for i = 12, 15 do
local spawnmember = GetTeamMember(self.teamDF2, i)
SpawnCharacter(spawnmember, spawnernode)
end
end
end
[/code]
Edit: This too:
Hidden/Spoiler:
[code]
if self.endGame == false then
ShowMessageText("game.assn.kill" .. (self.numTargetsDone + 1))
AddMissionObjective(self.teamATT, "game.assn.kill" .. (self.numTargetsDone + 1))
ActivateObjective("game.assn.kill" .. (self.numTargetsDone + 1))
end
[/code]
Followed immediately by this:
Hidden/Spoiler:
[code]
if self.detected == 0 and self.endGame == false then
self:PrintMe("State: Anonymous")
self.guardDefconLevel = 0
self.IncreaseDiff = 0
StartTimer("detecttimer")
ShowTimer("hunttimer")
StartTimer("hunttimer")
spawnNextTarget()
local detectMatrix = GetEntityMatrix(self.detector)
SetEntityMatrix(self.hotzone, CreateMatrix(0.0, 0.0, 0.0, 0.0, 0.0, -150.0, 0.0, detectMatrix))
SetTeamAsFriend(self.teamATT, self.teamDEF)
SetTeamAsFriend(self.teamDEF, self.teamATT)
assignWalkSpeeds()
assignGuardDuties()
adjustGuardStrength()
end
[/code]
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: Strange Non-Lethal Severity 3 Error

Post by [RDH]Zerted »

1) Remove the ShowMessageText line. If the error stops then you know where to look.
2) Post your Lua script.

GetCharacterUnit returns that when you pass in a nil, which is the most common mistake people make. If you happen to be passing in a valid string that doesn't match up to any character then you'll get a different error or it simply returns nil or both (I don't remember which, but most likely both).

You don't have tons of objectives do you? Are you constantly adding new unit classes to a team? I remember seeing similar errors but don't recall from what.

--- and then you posted before me ---

Oh, if you're doing that you need to have full control over the AI spawns (or add in a bunch of error checking). The game doesn't spawn bot 1 then respawns bot 1 when it dies. It spawns bot 2 when bot 1 dies. Then bot 3 when bot 2 dies, etc... (or maybe it selects a random bot to spawn each time, but I know it's not the same bot). If you didn't take complete control, some of the units may already be alive.

You might not be able to spawn them if the team is at its unit limit.

The characters that have spawned at least once will have pre-selected unit classes. The ones that haven't spawned won't. You should select what class they are. I believe this is related to your error. Only so many units may select a unit class at any given time. I think if you try to force it over that limit you get errors like yours. I was almost certain I knew those errors in context of units and spawning, and your code confirms it.
jedimoose32
Field Commander
Field Commander
Posts: 938
Joined: Thu Jan 24, 2008 12:41 am
Projects :: Engineering Degree
Location: The Flatlands of Canada

Re: Strange Non-Lethal Severity 3 Error

Post by jedimoose32 »

Sorry it took me a while to see your post...

Upon further inspection, I think you and Noobasaurus are actually right and it is coming from GetCharacterUnit. My bad.
Here's the code that I think is the source:
Hidden/Spoiler:
[code]
for k=0, 15 do
local guardMember = GetTeamMember(self.teamDEF, k)
if guardMember ~= nil then
local guardUnit = GetCharacterUnit(guardMember)
if guardUnit ~= nil then
*do stuff*
end etc...
[/code]
Basically I'm having the game search through 16 team members, some of which may be dead, and others of which may simply not exist. I've been trying to follow the suggestion that you've given in some of my other threads and just nil-check before I do anything crazy like GetWorldPosition (which, coincidentally, is part of the "do stuff" in that for loop). So the nil-check, in this case, prohibits the game from checking guardUnit's world position if guardUnit doesn't exist, but still returns this other error if k represents a dead team member, or if k is higher than the number of units on teamDEF. So it's not so bad. Just means my error log is a little fuller. For this team I might just have the game check GetNumTeamMembersAlive half a second after the game starts to determine the team's size and thereby set a more appropriate limit on the for loop.

By the way, I do have full control over the AI classes for teamDF2 (which is the special guard team). Here is my code for that:
Hidden/Spoiler:
[code]
local assignDifficultGuards = function()
AddUnitClass(self.teamDF2, self.guardClassIndex[2], 4)
AddUnitClass(self.teamDF2, self.guardClassIndex[3], 4)
AddUnitClass(self.teamDF2, self.guardClassIndex[4], 4)
AddUnitClass(self.teamDF2, self.guardClassIndex[5], 4)
for i=1, 4 do
local unitmax
if i == 1 then
unitmax = 0
elseif i == 2 then
unitmax = 4
elseif i == 3 then
unitmax = 8
elseif i == 4 then
unitmax = 12
end
local thisClass = self.guardClassIndex[i + 1]
local thisMember = GetTeamMember(self.teamDF2, unitmax)
SelectCharacterClass(thisMember, thisClass)
self:PrintMe("Difficult unit " .. thisMember .. " is assigned class " .. thisClass)
unitmax = unitmax + 1
thisMember = GetTeamMember(self.teamDF2, unitmax)
SelectCharacterClass(thisMember, thisClass)
self:PrintMe("Difficult unit " .. thisMember .. " is assigned class " .. thisClass)
unitmax = unitmax + 1
thisMember = GetTeamMember(self.teamDF2, unitmax)
SelectCharacterClass(thisMember, thisClass)
self:PrintMe("Difficult unit " .. thisMember .. " is assigned class " .. thisClass)
unitmax = unitmax + 1
thisMember = GetTeamMember(self.teamDF2, unitmax)
SelectCharacterClass(thisMember, thisClass)
self:PrintMe("Difficult unit " .. thisMember .. " is assigned class " .. thisClass)
end
end
[/code]
And then I am very controlling when I spawn them as well:
Hidden/Spoiler:
[code]
local eachDifUnit = function(lvlPtr)
local spawnernode = GetPathPoint(self.difGuardSpawners[math.random(table.getn(self.difGuardSpawners))], 0)
if lvlPtr == 2 then
for i = 0, 3 do
local spawnmember = GetTeamMember(self.teamDF2, i)
SpawnCharacter(spawnmember, spawnernode)
end
elseif lvlPtr == 3 then
for i = 4, 7 do
local spawnmember = GetTeamMember(self.teamDF2, i)
SpawnCharacter(spawnmember, spawnernode)
end
elseif lvlPtr == 4 then
for i = 8, 11 do
local spawnmember = GetTeamMember(self.teamDF2, i)
SpawnCharacter(spawnmember, spawnernode)
end
elseif lvlPtr == 5 then
for i = 12, 15 do
local spawnmember = GetTeamMember(self.teamDF2, i)
SpawnCharacter(spawnmember, spawnernode)
end
end
end
[/code]
While we're on this topic, I know I recently read somewhere that there is a callback or a uf_[something] for checking whether a unit class has already been added to the game, but I can't remember what it was and I can't find it using Search. Do you happen to remember what it is?
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: Strange Non-Lethal Severity 3 Error

Post by [RDH]Zerted »

It's uf_isKnownClass(<class>). Part of v1.3 (in file utility_functions2.lua) and a complement to uf_updateClassIndex(). You can see uf_updateClassIndex() print out in the debug log every time it detects a new class. The Fake Console commands are applied to every unit class detected. This is how they work on custom units. If you want the listing of detected classes, they're stored in the array: uf_classes

uf_isKnownClass() returns false if the given class is unknown or the index into uf_classes if the class is known.

I don't have time to evaluate the rest of your post right now. Good night.

GetTeamSize(<team>) gives you the amount of team members. Your 'k' loop should be more like: for k=0, GetTeamSize((self.teamDEF))-1 do ...

Do you call assignDifficultGuards() multiple times? Because you shouldn't be adding a lot of unit classes to the same team. Teams can only have 10-12 unit classes. Once you add one you can't remove it.
jedimoose32
Field Commander
Field Commander
Posts: 938
Joined: Thu Jan 24, 2008 12:41 am
Projects :: Engineering Degree
Location: The Flatlands of Canada

Re: Strange Non-Lethal Severity 3 Error

Post by jedimoose32 »

So here's what I've done with uf_isKnownClass(), thanks!
Hidden/Spoiler:
[code]
local assignDifficultGuards = function()
if uf_isKnownClass(self.guardClassIndex[2]) == false then
AddUnitClass(self.teamDF2, self.guardClassIndex[2], 4)
end
if uf_isKnownClass(self.guardClassIndex[3]) == false then
AddUnitClass(self.teamDF2, self.guardClassIndex[3], 4)
end
if uf_isKnownClass(self.guardClassIndex[4]) == false then
AddUnitClass(self.teamDF2, self.guardClassIndex[4], 4)
end
if uf_isKnownClass(self.guardClassIndex[5]) == false then
AddUnitClass(self.teamDF2, self.guardClassIndex[5], 4)
end
etc...
[/code]
I do call assignDifficultGuards a few times. However, I'm not adding more than 4 classes to the same team. guardClassIndex[#] contains exactly one class (e.g., print(guardClassIndex[2]) would result in >> cis_inf_rocketeer). So what was happening before I added the uf_isKnownClass check is that the same 4 classes were being added every time the function assignDifficultGuards was being called. Which, as far as I can tell, wasn't causing any problems, but it would output a severity-2 error (I think?) saying something along the lines of "Class cis_inf_whatever is already known!".
Post Reply