Jump to content

[LE] Help: RandomInt & Player generated arrays.


javaplaza

Recommended Posts

I'm familiar with CK and basic papyrus, but now I'm moving onto to harder things.

Since I'm not sure how to script what I'm trying to do, this may be a bit confusing. If it is, just say so, I'll do my best to explain.


The player will be shown a messagebox with multiple enemy types to select from (they are able to choose more than one). Once their selection is made, my script takes the enemy list and randomly selects one at a time for random-attacks on a specific location. I'm aware of the randomInt function, and successfully got that working. But I'm less familiar with arrays.


Thanks in advance,

java

Edited by javaplaza
Link to comment
Share on other sites


Message PROPERTY msg auto ; the messagebox to show enemy types

FormList PROPERTY List01 auto ; type 1
FormList PROPERTY List02 auto ; type 2
FormList PROPERTY List03 auto ; type 3

Int choice ; [default=0]

;----------------------------------
Actor FUNCTION myF_GetRandomActor()
;----------------------------------
formList fml
IF (choice == 1)
fml = List01
ELSEIF (choice == 2)
fml = List02
ELSEIF (choice == 3)
fml = List03
ENDIF

int i = fml.GetSize() - 1
IF (i >= 0)
i = Utility.RandomInt(0, i)
RETURN fml.GetAt(i) as Actor
ENDIF
RETURN None
ENDFUNCTION

;------------------
FUNCTION myF_Menu()
;------------------
choice = msg.Show()
ENDFUNCTION

 

Edited by ReDragon2013
Link to comment
Share on other sites

The way ive made my mod, there is one list of enemy types. (not a form list, so far its only location is in a script.)

ie: -bandits

-warlocks
-giants

-forsworn

 

 

By default, the player will have to defend the location from random attacks (one enemy type at a time of course) based off that list. The player has the option to toggle (turn off/on) any of those enemy types via a messagebox menu.

 

I'm not sure the code above does this, it seems the it allows you to select one of the enemy types, not more than one.

Edited by javaplaza
Link to comment
Share on other sites

when i wrote this blog i didn't have a code at all, because i don't know how to do what i am trying to accomplish.

 

simply put, i was asking how to fill an array with variables the player chooses from a messagebox menu.

after a lot of tinkering, i may be onto something right now, will update with my code when its complete

Link to comment
Share on other sites

  • Recently Browsing   0 members

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