Jump to content

Understanding dynamic array correctly


SMB92

Recommended Posts

So now I am getting the error in the Papyrus log, the ActorTypeStruct array on the quest is not filling

 

[06/04/2017 - 02:16:16AM] error: Array index 0 is out of range (0-0)
stack:
[ASC_MasterRandomQuest (BD000F99)].asc_masterrandomquestscript.FillArrays() - "X:\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\ASC_MasterRandomQuestScript.psc" Line 326
[ASC_MasterRandomQuest (BD000F99)].asc_masterrandomquestscript.OnStageSet()
etc etc.
Seems like arrays just won't fill for me whatever I do lol. Back to the drawing board.
Link to comment
Share on other sites

  • Replies 111
  • Created
  • Last Reply

Top Posters In This Topic

Interesting stuff with these refaliases, no doubt I'll get around to testing them more and more in future. Suppose if i really had to or wanted to, i could place the base actor in a prefilled alias, cant recall if i seen a function that could remove that later though (think: uninstall)

 

Thanks for pointing that useless variable out kitcat. Maybe thats whats confusing things but i suspect thats not the problem. It should be adding to the array anyway, but its either adding nothing or garbaging the array instantly. I'll have a test of it.

Not at all :smile: . I also deleted some lines from the part so to put it on place you look at the first line . Apart from script errors (non necessary in the log, some things don`t create log errors but won`t work in the game) there are a number of other potential reasons that can be fixed by adding more conditions .

The reference in the array is not available (already deleted, unloaded etc) so running commands on it fails and can cause the whole function to be aborted. This does not happen with persistent references, but some function still won`t work if the actor has no 3d loaded.

The marker lost all it`s variables including the references due to the reset. This can happen if something forced the marker to reset.

 

 

I see you get other errors.

I can`t really find line 300+ in your script without compiling it or opening in some another program. Please, post the suspeted part .

Edited by kitcat81
Link to comment
Share on other sites

Despite these arrays not filling/holding my variables, my functions are completing to the end, the debugs are telling me this. Arrays always 0 length but. Well, on the version that has the struct array as a property, as previously said i get weird results. Now with the dynamic struct array it doesnt hold at all.
Link to comment
Share on other sites

Despite these arrays not filling/holding my variables, my functions are completing to the end, the debugs are telling me this. Arrays always 0 length but. Well, on the version that has the struct array as a property, as previously said i get weird results. Now with the dynamic struct array it doesnt hold at all.

Did you try that function that should tell you the index of the "deleted" actor? You also need a clean testing. Changing scripts on the run can cause bugs unless you can delete and rebuild your markers. This is why it would be easier to move all functionality to the quest...For example I have a craftable object with a sctipt . I change some things in the script but the existing game objects already have a version with old properties and variables. So I scrap it to rebuilt to get the changes work. But you can`t scrap non workshop objects so you need to start a new game.

Link to comment
Share on other sites

Heres a video anyway.. it has 1 alias handling the dismembering. Debug.Notification is skipping some messages but trace shows them and you see all what's needed in the video. It's about 20sec.

 

I'm not manually forcereffing anything, it's script on that companion that is switching between targets. Only power attacks are dismembering, so that's why it doesn't happen every hit.

 

 

 

 

Sorry, I'll stop offtopic now.

Link to comment
Share on other sites

Heres a video anyway.. it has 1 alias handling the dismembering. Debug.Notification is skipping some messages but trace shows them and you see all what's needed in the video. It's about 20sec.

 

I'm not manually forcereffing anything, it's script on that companion that is switching between targets. Only power attacks are dismembering, so that's why it doesn't happen every hit.

Sorry, I'll stop offtopic now.

Yes, I see you use debug notification for different events. There functions don`t need to run from a reference or on a reference. But did you try to run a command on the actor from the alias script that had been applied by ForceRefTo without restarting the quest? Something Like GetActorReference().MoveTo(Game.GetPlayer()) etc

Edited by kitcat81
Link to comment
Share on other sites

 

Yes, I see you use debug notification for different events. There functions don`t need to run from a reference or on a reference. But did you try to run a command on the actor from the alias script that had been applied by ForceRefTo without restarting the quest? Something Like GetActorReference().MoveTo(Game.GetPlayer()) etc

 

 

Yes, normally I use this:

Event OnHit(ObjectReference akTarget, ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked, string apMaterial)

Actor Victim = akTarget as Actor

MyCompanionActor.DoCombatSpellApply(SpellProperty, Victim)

EndEvent

but I just tried this and it works the same:

Event OnHit(ObjectReference akTarget, ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked, string apMaterial)



MyCompanionActor.DoCombatSpellApply(SpellProperty, Self.GetReference() as Actor)

EndEvent

Not a single error in papyrus log either. Only way you can mess up not getting reference from alias, is if you call it before the alias is filled.

Link to comment
Share on other sites

Thank you for the info, that`s really great to know. I`m sure though that the alias was filled because it recieved "onitemadded" and I got the notification about that and it used the alias package, but it could not get the reference ( I tried both - getreference() and getactorreference()) . I will try to test it again as soon as I find some time. This would really help me with my mod.

Link to comment
Share on other sites

Thank you for the info, that`s really great to know. I`m sure though that the alias was filled because it recieved "onitemadded" and I got the notification about that and it used the alias package, but it could not get the reference ( I tried both - getreference() and getactorreference()) . I will try to test it again as soon as I find some time. This would really help me with my mod.

I don't know if it matter but the alias that I'm filling is "allow reserved", "optional" and in quest window in ck it's Ref Forced None.

Link to comment
Share on other sites

 

Thank you for the info, that`s really great to know. I`m sure though that the alias was filled because it recieved "onitemadded" and I got the notification about that and it used the alias package, but it could not get the reference ( I tried both - getreference() and getactorreference()) . I will try to test it again as soon as I find some time. This would really help me with my mod.

I don't know if it matter but the alias that I'm filling is "allow reserved", "optional" and in quest window in ck it's Ref Forced None.

 

Yes, my alias is the same. I found the script I created for it in winter. Tried to use it again and some things started to work. Magic lol...Maybe they really fixed something there. I`m 100% sure I got tones of "cant`t call getreference on a none object" a half year ago. The Oninit event did not work so I tried to add an item to create an event that I could use to register the alias for some other events. But that error with "getreference " ruined my plans and I had to go another way with a magic effect. I guess there is a possiblity that I missed something that times, but I can`t imagine now what it could be. I still have this quest and the alias in my mod. Have not changed anything. Anyway, thank you again for the info, this is really useful. I`ll l test it more seriously next week :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...