Are arrays objects I can create, or do I have to declare the

Post » Wed Jun 20, 2012 5:19 am

Okay, so I have this list of spells. I want to make it into an array that I can easily just "plug in" (import, or maybe make it a property) of a bunch of different scripts without having to redeclare and populate it each time.

I'm trying to make a pokemon, and the goal is to achieve the whole four move limit thing on spells.
Basically this is what I need to do (you don't have to read this part, I'm mostly constructing my thoughts): I need to create an array of spells ranging in values from 0-16. (Roselia has 16 moves and 0 must be empty for this to work properly) I need to have this list consistently populated with the same spells in the same slots.

I also have to have Global variables that memorize a numeric value. An int works fine, it only needs to be two digits. Ok. Hmmm...So, in each script that gives a new move and takes one away I need to basically removespell the spell at the Global Variable's slot in the array. So the dialogue would have to be structured just so...I'll have to figure that out. Anyway, so if all the moveslots have a value other than 0 we get to a dialogue topic that reads "Which move would you like to forget?" and then there are four topics linked, the actual topic text chosen by the player is PKRoseliaMoveArray[PKMoveSlot1], PKRoseliaMoveArray[PKMoveSlot2], etc.

If they choose one of these topics, the response is "Roselia has forgotten" PKRoseliaMoveArray[PKMoveSlotX] (where x is whatever slot they chose) as string"! Roselia has learned Mega Drain!" (for example)

and then run a small script that basically says PKRoseliaActor.removespell(PKRoseliaMoveArray[PKMoveSlotX])
PKMoveSlotX.setValue(new spell's number in the array)
PKRoseliaActor.AddSpell(PKRoseliaMoveArray[PKMoveSlotX])

Does this all make sense? I dunno, I feel like there are a lot of gaps I'm not seeing...
User avatar
Sheila Reyes
 
Posts: 3386
Joined: Thu Dec 28, 2006 7:40 am

Post » Wed Jun 20, 2012 6:48 am

Arrays are defined at compile time, andhttp://www.creationkit.com/Arrays_%28Papyrus%29#Creating_Arrays - for a list you can create on the fly, see the "Linked lists" link in my siggie.
User avatar
Dalia
 
Posts: 3488
Joined: Mon Oct 23, 2006 12:29 pm

Post » Wed Jun 20, 2012 8:07 am

Arrays are defined at compile time, andhttp://www.creationkit.com/Arrays_%28Papyrus%29#Creating_Arrays - for a list you can create on the fly, see the "Linked lists" link in my siggie.

I don't understand anything you just said unfortunately. Are you saying that I Must create an array outside of the script I'm constructing, or that I can't? If I can't I guess I could just make a function that populates it and then copy/paste it into each of my scripts, as annoying as that would be.

I think I'm starting to see what you're saying. I don't want the array to be declared and manipulated within my script, I want it to be immutable and something I can just "plug into" my script somehow. Basically, I need to just have a list of moves that is defined as an array of spells. If I can get that array into my scipts, I think I can take it from there...maybe
User avatar
Isaiah Burdeau
 
Posts: 3431
Joined: Mon Nov 26, 2007 9:58 am


Return to V - Skyrim