How To Externally Set Property On Only One Instance Of A Scr

Post » Sun Nov 18, 2012 10:53 pm

Hello, and welcome to my dungeon thread.

So, background and context: I have one spell that, when cast, allows the PC to store the next spell she casts for later recall. Then I have a few more spells that actually recall the stored spell (e.g. recall first stored spell, recall second stored spell, etc.)

How I've set this up is each recall spell just calls a Cast function on a "stored spell" which is declared as a property. I'd like to be able to set that property from inside the Storage spell.

But, I'd like to not have to use 3 identical duplicates of the recall script, i.e. I just want to use the same script on each recall effect.

THUS, I need to be able set a property on the recalleffectscript that's attached to recall effect 1 separately from the property on the recalleffectscript that's attached to recall effect 2.

The CK Wiki says that I can manipulate properties by declaring the script that holds them as a property of the script that's doing the manipulating, but it says nothing about how to specify which object-holding-that-script should get manipulated.

How do?
User avatar
Nick Pryce
 
Posts: 3386
Joined: Sat Jul 14, 2007 8:36 pm

Post » Sun Nov 18, 2012 3:13 pm

Simplest approach is probably to have a quest running silently in the background, and give it a script with the properties you want to set.

Then give your effect scripts a reference to the quest script and they can set the properties like so:

	myQuestProp.shared_prop = value_from_effect_script
User avatar
Doniesha World
 
Posts: 3437
Joined: Sun Jan 07, 2007 5:12 pm

Post » Sun Nov 18, 2012 1:25 pm

So, basically use a quest as an intermediary between the two magic effects? Storage script sets a quest property and recall script reads from the quest?
User avatar
sw1ss
 
Posts: 3461
Joined: Wed Nov 28, 2007 8:02 pm

Post » Mon Nov 19, 2012 1:43 am

Basically, yeah. And if you use auto properties, you shouldn't even lose any time doing it.
User avatar
Pumpkin
 
Posts: 3440
Joined: Sun Jun 25, 2006 10:23 am

Post » Sun Nov 18, 2012 5:39 pm

Okay, so, would I need to have multiple quests, one for each duplicate of my recall spell?

Honestly, it may be simpler to just use several renamed copies of the recall script.
User avatar
Kayla Bee
 
Posts: 3349
Joined: Fri Aug 24, 2007 5:34 pm

Post » Sun Nov 18, 2012 11:24 pm

One Quest, give each spell a property pointing at it. If you need to store different values for different spells, you can have different properties on the quest
User avatar
john palmer
 
Posts: 3410
Joined: Fri Jun 22, 2007 8:07 pm

Post » Sun Nov 18, 2012 1:33 pm

But I would need the quest to hold a different spell for each copy of the recall spell.

I don't see how one quest could hold three different copies of the same property at the same time.

I feel like drawing diagrams would help XD
User avatar
Cool Man Sam
 
Posts: 3392
Joined: Thu May 10, 2007 1:19 pm

Post » Sun Nov 18, 2012 2:16 pm

But I would need the quest to hold a different spell for each copy of the recall spell.

I don't see how one quest could hold three different copies of the same property at the same time.

Well, no. But you could give the quest three different properties: stored_spell1, stored_spell2 and stored_spell3 and access a different one in each version of the recall spell.

If you want to store an arbitrary number of spells it gets a bit more difficult, but if it's three spells, each with its own storage capacity, just use three properties. You can give the spell script an index property as well, set to 1, 2 or 3 and use that to decide which property to access.

Alternatively you could use an array and have a stack of however many spells you wanted up to 128 of the things, but that takes a little more bookkeeping.
User avatar
rae.x
 
Posts: 3326
Joined: Wed Jun 14, 2006 2:13 pm

Post » Sun Nov 18, 2012 4:30 pm

It might not be three, but it won't be an arbitrary number.

I think I understand now. Thanks so much for your patience XD I'll test this out and come back if anything doesn't work :D
User avatar
~Sylvia~
 
Posts: 3474
Joined: Thu Dec 28, 2006 5:19 am


Return to V - Skyrim