Jump to content

[LE] Hod do you handle Array Properties Set/Get ?


Moltenhead

Recommended Posts

Hello !

 

I'm wondering about Array Properties and the way of making use of setters and getters with them :

 

Here is something I'm trying to achieve

Int[] PrivateSoundsId
Int[] Property SoundsId
	Function Set(Int SoundId)
		Debug.MessageBox("[" + StateId + "]" + SoundId)
		PrivateSoundsId[StateId] = SoundId

		Modaltracker = StateId
	EndFunction
	
	Function Get(Int Key)
		return PrivateSoundsId[Key]
	EndFunction
EndProperty

Right now, the only way I was able to succeed Set / Get was with procedural style

Int[] Property SoundsId auto

Event OnInit()
        SoundsInit = new Int[4]
EndEvent

Function SetSoundId(Int Key, Int SoundId)
        SoundsId[Key] = SoundId
EndFunction

Function GetSoundId(Int Key)
        return SoundsId[Key]
EndFunction

Is there another way ?

Setter option would be so cool ...

Link to comment
Share on other sites

I believe it is impossible what you want to aim.

Because "arrays" are placed different in opposite to normal properties or variables like (int, float, bool), (actor, objectReference, ReferenceAlias) and others (quest, sound, armor, weapon, ..)

 

The way you go with papyrus coding (properties get/set) looks professional, but is very hard to understand and not easy to maintain.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...