Jump to content

values in actor array returning as none


Deleted800173User

Recommended Posts

SOLVED!

I have a script that creates leveled enemies and stores them in an array. However when I recall them from the array they return as "none". I can't figure out why this is. I've checked the values immediately after storing them and they return "none" at that point in time. I've also tested these values before they enter the array and they do not return as "none". Does anyone have any advice or information that might help me get these values to stay?

 

Here is my script:

setenemies(highestSpawned - 1, spawnPoints[spawnChoice].placeActorAtMe(enemyTypes[enemyChoice], 4, enchZone))
debug.notification("spawn level. is NONE: " + (enemies(highestSpawned - 1) ==  None))

Here is the getter and setter functions used:

;GETTERS AND SETTERS
Actor function enemies(int n)
return enemies[n]
endFunction

function setEnemies(int n, Actor ref)
enemies[n] = ref
debug.notification("enemies function: is NONE: " + (enemies(n) == none))
debug.notification("enemies array: is NONE: " + (enemies[n] == none))
endFunction

All three of these debug messages return with "True" attached to them.

Earlier I tested the "ref" value in the setter function above and it returned as "false" meaning that the value was not "none" before it was put into the array.

Edited by Guest
Link to comment
Share on other sites

new update! I changed the array to be of the objectreference type and re wrote the getter to be:

;GETTERS AND SETTERS
Actor function enemies(int n)
return enemies[n] as Actor
endFunction

the value in the array is no longer none but when it is casted as an actor it becomes none!? what's up with actor type variables? Not sure how to get the values to stop becoming none

 

EDIT: new new update! I found a work around solution.

Edited by Guest
Link to comment
Share on other sites

  • 3 years later...

Which was? Come on, don't hold a carrot out and not let us bite. Seriously

Wow this is a pretty old post.

I can't remember what I did. I think I made a giant switch statement using 100 individual actor variables. It sounds ludicrous I know, but apparently Papyrus doesn't like storing actors in arrays so I basically made an array function using a switch statement

Link to comment
Share on other sites

  • Recently Browsing   0 members

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