Difference between revisions of "Talk:Arrays (Papyrus)"

Jump to navigation Jump to search
635 bytes added ,  08:33, 6 August 2017
imported>Lisselli
imported>Lisselli
 
Line 269: Line 269:
: There is a work around for this. [http://forums.bethsoft.com/topic/1583034-quick-questions-quick-answers-thread-63/page-3#entry24889636 Source] --[[User:Terra Nova2|Terra Nova2]] ([[User talk:Terra Nova2|talk]]) 2016-01-24T09:29:12 (EST)
: There is a work around for this. [http://forums.bethsoft.com/topic/1583034-quick-questions-quick-answers-thread-63/page-3#entry24889636 Source] --[[User:Terra Nova2|Terra Nova2]] ([[User talk:Terra Nova2|talk]]) 2016-01-24T09:29:12 (EST)


== Additional examples ==
= Additional examples =


Attempting my hand at explaining arrays. My examples have been tested. I explain what they do in comments in the code, and try not to present their
Attempting my hand at explaining arrays. My examples have been tested. I explain what they do in comments in the code, and try not to present their
Line 432: Line 432:
You might wonder why I didn't just change an element that isn't 100 to "none". This is because Floats and Ints can't have a "none" type. They can only be 0.0 or 0.
You might wonder why I didn't just change an element that isn't 100 to "none". This is because Floats and Ints can't have a "none" type. They can only be 0.0 or 0.
I will add more complex ways(with details of course!) when I come up with some. These functions were tested with my current character using an older save. The return values for function 2(function was used random numbers) was 5, the return value for function 3 was 1125, and the return value for function 4 was 13. I hope this helps someone out there. I had trouble with arrays for a very long time and am pleased that I'm now getting somewhere with them. --[[User:Lisselli|Lisselli]] ([[User talk:Lisselli|talk]]) 2017-08-06T03:34:54 (EDT)
I will add more complex ways(with details of course!) when I come up with some. These functions were tested with my current character using an older save. The return values for function 2(function was used random numbers) was 5, the return value for function 3 was 1125, and the return value for function 4 was 13. I hope this helps someone out there. I had trouble with arrays for a very long time and am pleased that I'm now getting somewhere with them. --[[User:Lisselli|Lisselli]] ([[User talk:Lisselli|talk]]) 2017-08-06T03:34:54 (EDT)
<source lang="papyrus">
Function PickEveryFlowerInCell(Actor akFlowerPicker) Global
Cell kCell = akFlowerPicker.GetParentCell()                 
Int iIndex = kCell.GetNumRefs(39) ; kFlora = 39              ; Total number of forms in this cell that are type flora.
While iIndex
iIndex -= 1                                          ; Loop from the last index.
kCell.GetNthRef(iIndex, 39).Activate(akFlowerPicker) ; Activate all the forms in this cell that are type flora
EndWhile
EndFunction
</source>
This one is sligtly different since it uses a SKSE function but the basics behind this array remains the same as you can see.
Anonymous user

Navigation menu