i made an array that contains many cinematic sequence devices, the initialization of the array has no apparent issues, but when i try to access the first element it doesnt work
i know that, to play an animation sequence, you should state “animation.Play()” so to access a certain one contained inside the array i figured it would be “arrayname[0].Play()” but theres an error in the [0] part
by checking the documentation i think its supposed to be correct, any help on what the issue may be?
I’m not 100% sure on this but I believe that you need to initialize your array in a separate function under OnBegin.
For example:
If you are going to create a player map you need to first declare the variable, then you want to add an initialization function, and that will propagate the array.
var PlayerMap : [player]int = map{}
OnBegin<override>()<suspends>:void=
InitPlayers()
InitPlayers() : void=
AllPlayers := GetPlayspace().GetPlayers()
for (Player : AllPlayers, FortCharacter := Player.GetFortCharacter[]):
if (set PlayerMap[Player] = 0):
Print("Storing player")
Also there is this code in the template project called Domination.
@editable
Sequencers_Team1:[]cinematic_sequence_device = array{}
OnBegin<override>()<suspends>:void=
# more code here but its not really relevant to the point
PointCaptured(MyAgent:agent, CaptureIndex:int):void=
TeamCollection := GetPlayspace().GetTeamCollection()
if:
Team1Sequence := Sequencers_Team1[CaptureIndex]
Team2Sequence := Sequencers_Team2[CaptureIndex]
then:
if (TeamCollection.IsOnTeam[MyAgent, TeamCollection.GetTeams()[0]]):
Team1Sequence.Play()
Team2Sequence.Stop()
else:
Team1Sequence.Stop()
Team2Sequence.Play()
I would open up that project or take a look at the documentation, may get you your solution: