Cannot Call A Function in a Quest Script

Post » Mon Jun 18, 2012 7:36 pm

When I try to call a function (one that is defined inside a script that is attached to a quest), it does not work. Now, I've duplicated code from the vampire quest scripts and magic effects, and although THOSE work, MINE do not. Those are far more complicated too.

Basically, the script attached to the magic effect does everything it's supposed to do UNTIL it comes time to call the function, then nothing else happens.

Here's the script attached to the magic effect:

GraniteDevilQuestScript is the script with the function in it. It is attached to the quest GraniteDevilQuest.

Spoiler

Scriptname MyMagicEffectThatOnlyHalfWorks extends activemagiceffect  GraniteDevilQuestScript Property GraniteDevilQuest  Auto  Message Property GDMsgOne AutoEvent OnEffectStart(Actor Target, Actor Caster)		  GDMsgOne.Show()		  GraniteDevilQuest.ForTheLoveOf()EndEvent

Here's the script inside my Quest (the Quest itself is set to Start Game Enabled and its sole purpose is to do exactly what you see here):

Spoiler

Scriptname GraniteDevilQuestScript extends Quest  Message Property GDMsgTwo AutoFunction ForTheLoveOf()		  GDMsgTwo.Show()EndFunction

GDMsgTwo never, ever shows. Never. But GDMsgOne always shows when the effect triggers. I can't figure out why my function isn't getting called.

I should also point out that if I replace MY script (the one attached to the magic effect) with VampireChangeEffect, the vampire change triggers exactly like it should when the effect occurs. THAT function gets called, but mine doesn't.

So I must be missing something here. Can anybody tell me what I'm doing wrong?
User avatar
~Amy~
 
Posts: 3478
Joined: Sat Aug 12, 2006 5:38 am

Post » Mon Jun 18, 2012 1:39 pm

Falling off the first page. I loathe bumping posts, but... I'm really hoping somebody can show me what I'm doing wrong.
User avatar
Nana Samboy
 
Posts: 3424
Joined: Thu Sep 14, 2006 4:29 pm

Post » Mon Jun 18, 2012 2:20 pm

Hmm, try defining the function "ForTheLoveOf" as a global function:
Function ForTheLoveOf() global
Then try calling it like this:
GraniteDevilQuestScript.ForTheLoveOf

The property probably wouldn't work, since you'd be calling it on a type, so try adding a Debug.Notification message in there too, just to see if the function is called.

Cipscis

EDIT:

Also, just checking, all your properties are set up correctly in the editor? Including your GraniteDevilQuestScript property?

Cipscis
User avatar
TWITTER.COM
 
Posts: 3355
Joined: Tue Nov 27, 2007 3:15 pm

Post » Mon Jun 18, 2012 12:50 pm

The other way of doing it would be something like this:

1) In the script attached to the effect, replace

GraniteDevilQuestScript Property GraniteDevilQuest  Auto

with

Quest Property GraniteDevilQuest  Auto

and in the Properties window, set it to your quest.

2) Then change

GraniteDevilQuest.ForTheLoveOf()

to

(GraniteDevilQuest as GraniteDevilQuestScript).ForTheLoveOf()
User avatar
Kristian Perez
 
Posts: 3365
Joined: Thu Aug 23, 2007 3:03 am

Post » Tue Jun 19, 2012 1:53 am

Cipscis, DreamKing, thanks a lot for the suggestions!

I figured it out though: I had to Fill the properties (who knew? - I did it because I was out of ideas). At first I tried just running the Auto-Fill Properties, and it did its thing, and I ran the game and tried it out but my function still wasn't getting called... so I compiled it from GamePlay menu and tried again... and it worked.

Man, what a learning experience this is. So different from the GECK.
User avatar
Sarah Kim
 
Posts: 3407
Joined: Tue Aug 29, 2006 2:24 pm

Post » Mon Jun 18, 2012 10:49 am

At least you can be satisfied knowing that you had the syntax correct :)

As far as I know, "Auto-Fill" will only work if your property's name is the same as the editorID of the form that you want it to represent.

Cipscis
User avatar
Milad Hajipour
 
Posts: 3482
Joined: Tue May 29, 2007 3:01 am

Post » Mon Jun 18, 2012 11:37 am

At least you can be satisfied knowing that you had the syntax correct :smile:

As far as I know, "Auto-Fill" will only work if your property's name is the same as the editorID of the form that you want it to represent.

Cipscis

I know man. Small victories, right?

First time I've used the Fill thing. Didn't even know I had too. Hopefully, I won't have a problem with *that* next since I have been using the editorID of forms to define properties.
User avatar
George PUluse
 
Posts: 3486
Joined: Fri Sep 28, 2007 11:20 pm


Return to V - Skyrim