Passing a float from a magic effect to a quest script

Post » Thu Jun 21, 2012 5:36 am

I am trying to pass a floating integer to a quest from a magic effect script.

Here is the function in my quest. How would I pass the value VampireSpellCost of 1.5 to my function below from a magic effect script?

Function UpdateFeedTimer(float VampireSpellCost)    FeedTimer += VampireSpellCost    Debug.Notification("The spell cost was "+VampireSpellCost)    Debug.Notification("FeedTimer is now "+FeedTimer)EndFunction
User avatar
kirsty williams
 
Posts: 3509
Joined: Sun Oct 08, 2006 5:56 am

Post » Thu Jun 21, 2012 4:36 am

Spells aren't my thing ... but ...

If you make the VampireSpellCost a GLOBAL (in Miscellaneous in the CK) can you use it in the spell and then also use it in your function??

(There maybe another way ... http://www.gamesas.com/topic/1368537-passing-properties-between-scripts/ ... but I'm not sure the answer is actually there either?)

Sorry I can't give you a definate answer ...
User avatar
Janette Segura
 
Posts: 3512
Joined: Wed Aug 22, 2007 12:36 am

Post » Thu Jun 21, 2012 4:34 am

Well I know you can pass actor refs from one script to the next, so passing a float is possible, I just don't quite know how to set it up.

Here is what I am trying but it won't compile:

Int Property VampireSpellCost AutoEvent OnEffectStart ()    VampireSpellCost += 1    PlayerVampireQuest.UpdateFeedTimer(VampireSpellCost)EndEvent
User avatar
Rach B
 
Posts: 3419
Joined: Thu Mar 08, 2007 11:30 am

Post » Thu Jun 21, 2012 8:17 am

You should have your quest as a property too.

Quest Property PlayerVampireQuest Auto
....
(PlayerVampireQuest as PlayerVampireQuestScript).UpdateFeedTimer(VampireSpellCost)
User avatar
Jaki Birch
 
Posts: 3379
Joined: Fri Jan 26, 2007 3:16 am

Post » Thu Jun 21, 2012 6:12 am

YourQuestScriptName Property QuestScriptProperty Auto ; Filled with the quest it is attached toInt Property VampireSpellCost AutoEvent OnEffectStart(Actor akTarget, Actor akCaster)    VampireSpellCost += 1    QuestScriptProperty.UpdateFeedTimer(VampireSpellCost)EndEvent
User avatar
Misty lt
 
Posts: 3400
Joined: Mon Dec 25, 2006 10:06 am

Post » Thu Jun 21, 2012 8:11 am

You should have your quest as a property too.

Quest Property PlayerVampireQuest Auto
....
(PlayerVampireQuest as PlayerVampireQuestScript).UpdateFeedTimer(VampireSpellCost)


YourQuestScriptName Property QuestScriptProperty Auto ; Filled with the quest it is attached toInt Property VampireSpellCost AutoEvent OnEffectStart(Actor akTarget, Actor akCaster)	VampireSpellCost += 1	QuestScriptProperty.UpdateFeedTimer(VampireSpellCost)EndEvent
This got it compiling, but the int/float is not passing through to the other quest. It says it is zero. Isn't your code just passing the actor to my function, and not the float?

Here is the current magic effect script:Scriptname AbVampireSpeedScript extends activemagiceffect  PlayerVampireQuestScript Property PlayerVampireQuest  Auto  Float Property VampireSpellCost AutoEvent OnEffectStart (Actor akTarget, Actor akCaster)	VampireSpellCost += 1	PlayerVampireQuest.UpdateFeedTimer(VampireSpellCost)EndEvent

And here is the function from the vampire quest:
Float Property VampireSpellCost AutoFunction UpdateFeedTimer(float VampireSpellCost)	FeedTimer += VampireSpellCost	Debug.Notification("The spell cost was "+VampireSpellCost)	Debug.Notification("FeedTimer is now "+FeedTimer)EndFunction

Seems to me that the effect start is passing the actor target to the function, so we need to get the property vampireSpellCost in the parenthesis don't we?

What about this:
PlayerVampireQuest.UpdateFeedTimer(VampireSpellCost +=1)
would that feed that value to the quest function?
User avatar
Susan Elizabeth
 
Posts: 3420
Joined: Sat Oct 21, 2006 4:35 pm

Post » Thu Jun 21, 2012 7:32 am

Ok I got it working. There is no need to set the value in the magic effect at all and try to pass it to the function in the quest script. You simply change it to what you want from your magic effect IN the other script!

Scriptname AbVampireSpeedScript extends activemagiceffect  PlayerVampireQuestScript Property PlayerVampireQuest  Auto  Float Property VampireSpellCost AutoEvent OnEffectStart (Actor akTarget, Actor akCaster)    PlayerVampireQuest.VampireSpellCost += 1;set it directly on THAT quest!    PlayerVampireQuest.UpdateFeedTimer(VampireSpellCost);call your function.EndEvent
What I am confused about is IF I need the property defined here at all? If I am setting it in the other script (quest) then I wonder if I need to bother having it as a property here?

also I had to have VampireSpellCost in my parenthesis or it wouldn't compile.
User avatar
Ownie Zuliana
 
Posts: 3375
Joined: Thu Jun 15, 2006 4:31 am

Post » Wed Jun 20, 2012 11:03 pm

You can remove the property from your effect script. Just use the one defined on the quest.

In your quest script, if you change
Function UpdateFeedTimer(float VampireSpellCost)
to
Function UpdateFeedTimer()
then you can call the function from the effect script without a parameter.

The principal here is that a quest property can be used anywhere - inside a function, for example, or in another script that has the quest script as a property.
User avatar
Rachel Eloise Getoutofmyface
 
Posts: 3445
Joined: Mon Oct 09, 2006 5:20 pm

Post » Wed Jun 20, 2012 11:22 pm

This got it compiling, but the int/float is not passing through to the other quest. It says it is zero. Isn't your code just passing the actor to my function, and not the float?
Obliviously that shouldn't happened if you don't actually from some reason pass 0. You have the value as a parameter on the call and it should be passed to the function.
But, by any chance are you trying to pass a negative value? I believe once I encountered such issue in my first mod but I dismissed the initial approach without deep investigation.
User avatar
Travis
 
Posts: 3456
Joined: Wed Oct 24, 2007 1:57 am

Post » Thu Jun 21, 2012 2:47 am

By the way, "Floating Integer" is a contradiction in terms. "Float" is short for "Floating Point" which is a number with a decimal part, while "Integer" is a number with no decimal part (I.E. "10.25" is Floating Point, while "10" is an Integer.)

Try this:
Event OnEffectStart(Actor Target, Actor Caster)	MyQuest.VampireSpellCost(1.5)EndEventQuestTypeScript Property MyQuest Auto ; Aim this at your quest. Replace QuestTypeScript with the scriptname that has the function.
User avatar
Elizabeth Falvey
 
Posts: 3347
Joined: Fri Oct 26, 2007 1:37 am


Return to V - Skyrim