I search for solutions in this order: Past Code, Unreal Source, Wiki, BUF, groups.yahoo, google, screaming at monitor. – RegularX

Legacy talk:TriggeredTexture

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 01:01, 5 April 2015 by SeriousBarbie (Talk | contribs) (ScriptWarning if 10 textures used)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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) )
	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)