I don't need to test my programs. I have an error-correcting modem.
Difference between revisions of "Legacy talk:TriggeredTexture"
From Unreal Wiki, The Unreal Engine Documentation Site
m (ScriptWarning if 10 textures used) |
m (+Reported on [https://github.com/OldUnreal/UnrealTournamentPatches/issues/612 GitHub] ~~~~) |
||
Line 21: | Line 21: | ||
<uscript>Textures[CurrentTexture] == None</uscript> is evaluated. At this moment, the array is accessed at index 10, which does not exist. | <uscript>Textures[CurrentTexture] == None</uscript> is evaluated. At this moment, the array is accessed at index 10, which does not exist. | ||
--[[User:SeriousBarbie|SeriousBarbie]] 05:01, 5 April 2015 (UTC) | --[[User:SeriousBarbie|SeriousBarbie]] 05:01, 5 April 2015 (UTC) | ||
+ | :Reported on [https://github.com/OldUnreal/UnrealTournamentPatches/issues/612 GitHub]. --[[User:SeriousBarbie|SeriousBarbie]] 12:38, 2 December 2021 (MET) |
Latest revision as of 04:39, 2 December 2021
ScriptWarning if 10 textures used[edit]
Recently I noticed a ScriptWarning:
ScriptWarning: TriggeredTexture MH-TwinTower(SB)-Rev2.TriggeredTexture1 (Function Botpack.TriggeredTexture.Trigger:0046) Accessed array out of bounds (10/10)
I had a look at the code and found the problem:
var() Texture Textures[10]; ... event Trigger( Actor Other, Pawn EventInstigator ) { if( bTriggerOnceOnly && (Textures[CurrentTexture + 1] == None || CurrentTexture == 9) ) return; CurrentTexture++; if( Textures[CurrentTexture] == None || CurrentTexture == 10 ) CurrentTexture = 0; }
If 10 textures are used and the last texture has been choosen, CurrentTexture has the value of 9. With the next function call CurrentTexture will be increased to 10 ("CurrentTexture++") and then the condition
Textures[CurrentTexture] == None
is evaluated. At this moment, the array is accessed at index 10, which does not exist.
--SeriousBarbie 05:01, 5 April 2015 (UTC)
- Reported on GitHub. --SeriousBarbie 12:38, 2 December 2021 (MET)