Jump to content

Can't change properties with an array at run-time..


Lisselli

Recommended Posts

I'm trying to change 18 Int properties with an array at runtime. The integers are set to what I want in the array, but the Int properties themselves remain at 0.

 

Example...


Int property iNumber auto
Int property iNumberTwo auto

Int[] NumberArray

Event OnInit()
     SomeFunction()
EndEvent

Function SomeFunction()
      NumberArray = new Int[2]
      NumberArray[0] = iNumber
      NumberArray[1] = iNumberTwo

      Int Index = NumberArray.Length
      While Index
                Index -= 1
                NumberArray[Index] = 5
       EndWhile
EndFunction

While they are added to the arrays and have their values changed to 5, the properties outside the function remain at 0 and this is reflected in my other scripts that access those properties.

If I just say.. "iNumber = 5" then the property is changed accordingly.

This currently has me stuck on my project. No I cannot use variables since you can't call them from outside a script.

Anyone know how to get around this?

Link to comment
Share on other sites

Well, its embarrassing but I know why they aren't changing. The array is filled with the 0 value from the properties and then set to 5... -.- So it was working as intended.

But I'm still stuck. While I can change them all to what I want, I want to be able to change the value for all of them, at one time, at run-time. Like if I need the values to be 10 instead of 5.

 

 

Edit: Solved. I changed the function and got rid of the array. Instead I set them all with a passed in default value that will change them all to whatever number I pass into the parameter.

Edited by Lisselli
Link to comment
Share on other sites

  • Recently Browsing   0 members

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