Jump to content

[LE] GlobalVar not setting through Script


Rizalgar

Recommended Posts

From what I understand (take this with a grain of salt) ...

It's best not to rely on a variable to hold a value based off a gather call.

 

ie: The same problem you get when you call the player as a variable then

try to use that variable from a call that needs to gather it's data. I can't explain why

it could be a limitation of the language or the game setup ...
In any case sometimes you do need to gather that data directly.

Case and point: this IF statement will never fail. But if you use
GetCasterActor() in both parts it will from time to time fail.
Notice getcasteractor is used directly but when pulling the data

for the IF statement the direct form would be game.getplayer.

If(Game.GetPlayer().HasSpell(PolymorphSpell))
HasBeastflag=(1)
Else
GetCasterActor().AddSpell(PolymorphSpell)
Endif

It would seem with longer scripts the direct forms are the way to go.
Again I may be way off ... but also have made scripts with well over
1000 lines that will not work at all unless this form of the calls are used.

Some games that use many many scripts to maintain the game seem to suffer from this.
At some point some script is using the same data you are so direct calls are needed.

Again who knows why ... this defies programming and has to be a result of design.

In short: If it's not working as expected try a more direct call to get your data.

Link to comment
Share on other sites

I thank you for your reply, sir! I'll keep that in mind. Now if only I could figure out why a script calling a function from another script keeps compiling with "aktarget is not defined... blah blah..."

Link to comment
Share on other sites

  • Recently Browsing   0 members

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