• Announcements

    • Ashal

      SITE MOVED - IN READ ONLY MODE   12/08/2015

      Please use http://www.loverslab.com moving forward. Site has been restored to a previous version, and this one placed into a read-only mode. This is available for a limited time so users may reference/copy content that has been lost in the transition. This will no longer be accessible by December 22nd, 2015.
Halstrom

Fallout New Vegas GECK / Scripting Help 101

2,597 posts in this topic

Nope. Did that compile ? :)


0

Share this post


Link to post

Nope. Did that compile ? :)

Yeah compiled fine, I couldn't find anything about it in Wiki and haven't seen it used by anyone in GECK scripts, so was suspecting it was something I got in my head from another language :)
0

Share this post


Link to post


Ehm. Having problems with function buildref


 


 


I managed to build ref Sexout functions (ActPrep, SetRef,SetInt,ActRun) but I'm having problwm with "inuse" function


 


 


fnSexoutActorInuse - xx08BD79  - xx0572793



if eval (call aaSCMainQuest.fnSexoutActorInuse "PlayerRef") always returns 0, no matter if player is locked by Sexout or not.


Any ideas?



let aaSCMainQuest.SexoutIndex := GetModIndex "Sexout.esm"
let aaSCMainQuest.fnSexoutActorInuse := BuildRef aaSCMainQuest.SexoutIndex 0572793


    if eval (call aaSCMainQuest.fnSexoutActorInuse PlayerRef)
     let GreetSexDay := GameDaysPassed +2
    endif


 


 


 


EDIT: Fixed it by introducing new int. It works fine now.



    let aaSCMainQuest.SexoutIndex := GetModIndex "Sexout.esm"
    let aaSCMainQuest.fnSexoutActorInuse := BuildRef aaSCMainQuest.SexoutIndex 0572793
    let SexoutPlayerinUse := call aaSCMainQuest.fnSexoutActorInuse PlayerRef

0

Share this post


Link to post

So, is there any alternatives to NX variables?


(not everybody has NX Extender installed + there could be up for 15 actors and 15x4 == 60 NX variables bloating inside savegame)


 


I want to store Actor's variables (aggression, assistance, confidence, ignore crime) before setting them all to 0


Then I want to restore them


 


I can't use tokens because even quest tokens are removed by "RemoveAllItems"


I can't use variables 1-10 because they can be used by somebody else.


Now I can only use form lists


 


 


Store





Scriptname aaSCFunctionMainStatsStore

ref ActorRef

Begin Function {}

let ActorRef := GetSelf

if ActorRef.GetAV Aggression == 0
AddFormToFormList aaSCSlaveListStatsAggression0 ActorRef
elseif ActorRef.GetAV Aggression == 1
AddFormToFormList aaSCSlaveListStatsAggression1 ActorRef
elseif ActorRef.GetAV Aggression == 2
AddFormToFormList aaSCSlaveListStatsAggression2 ActorRef
elseif ActorRef.GetAV Aggression == 3
AddFormToFormList aaSCSlaveListStatsAggression3 ActorRef
endif


if ActorRef.GetAV Assistance == 0
AddFormToFormList aaSCSlaveListStatsAssistance0 ActorRef
elseif ActorRef.GetAV Assistance == 1
AddFormToFormList aaSCSlaveListStatsAssistance1 ActorRef
elseif ActorRef.GetAV Assistance == 2
AddFormToFormList aaSCSlaveListStatsAssistance2 ActorRef
endif

if ActorRef.GetAV Confidence == 0
AddFormToFormList aaSCSlaveListStatsConfidence0 ActorRef
elseif ActorRef.GetAV Confidence == 1
AddFormToFormList aaSCSlaveListStatsConfidence1 ActorRef
elseif ActorRef.GetAV Confidence == 2
AddFormToFormList aaSCSlaveListStatsConfidence2 ActorRef
elseif ActorRef.GetAV Confidence == 3
AddFormToFormList aaSCSlaveListStatsConfidence3 ActorRef
elseif ActorRef.GetAV Confidence == 4
AddFormToFormList aaSCSlaveListStatsConfidence4 ActorRef
elseif ActorRef.GetAV Confidence == 5
AddFormToFormList aaSCSlaveListStatsConfidence5 ActorRef
endif

if ActorRef.GetIgnoreCrime == 1
AddFormToFormList aaSCSlaveListStatsIgnoreCrime1 ActorRef
endif


end


 


 


Restore


 





Scriptname aaSCFunctionMainStatsReStore


int iListIndex
int iListTotal
ref ActorRef

ref ActorInListRef
ref CurrentList

array_var ArrayList
array_var Entry

Begin function {}

let ActorRef :=GetSelf
let ArrayList := ar_construct array
let ArrayList := Ar_List aaSCSlaveListStatsAggression0, aaSCSlaveListStatsAggression1, aaSCSlaveListStatsAggression2, aaSCSlaveListStatsAggression3, aaSCSlaveListStatsAssistance0, aaSCSlaveListStatsAssistance1, aaSCSlaveListStatsAssistance2, aaSCSlaveListStatsConfidence0, aaSCSlaveListStatsConfidence1, aaSCSlaveListStatsConfidence2, aaSCSlaveListStatsConfidence3, aaSCSlaveListStatsConfidence4, aaSCSlaveListStatsConfidence5, aaSCSlaveListStatsIgnoreCrime1


foreach Entry <- ArrayList
    let CurrentList := Entry["value"]


        let iListIndex := -1
        let iListTotal := ListGetCount CurrentList

        While ( iListIndex < iListTotal )
            let iListIndex +=1
            let ActorInListRef := ListGetNthForm CurrentList iListIndex

            if ActorinListRef == ActorRef
        
                if CurrentList  == aaSCSlaveListStatsAggression0
                    ActorRef.SetAV Aggression 0
                elseif CurrentList  == aaSCSlaveListStatsAggression1
                    ActorRef.SetAV Aggression 1
                elseif CurrentList  == aaSCSlaveListStatsAggression2
                    ActorRef.SetAV Aggression 2
                elseif CurrentList  == aaSCSlaveListStatsAggression3
                    ActorRef.SetAV Aggression 3
                endif

                if CurrentList  == aaSCSlaveListStatsAssistance0
                    ActorRef.SetAV Assistance 0
                elseif CurrentList  == aaSCSlaveListStatsAssistance1
                    ActorRef.SetAV Assistance 1
                elseif CurrentList  == aaSCSlaveListStatsAssistance2
                    ActorRef.SetAV Assistance 2
                endif

                if CurrentList  == aaSCSlaveListStatsConfidence0
                    ActorRef.SetAV Confidence 0
                elseif CurrentList  == aaSCSlaveListStatsConfidence1
                    ActorRef.SetAV Confidence 1
                elseif CurrentList  == aaSCSlaveListStatsConfidence2
                    ActorRef.SetAV Confidence 2
                elseif CurrentList  == aaSCSlaveListStatsConfidence3
                    ActorRef.SetAV Confidence 3
                elseif CurrentList  == aaSCSlaveListStatsConfidence4
                    ActorRef.SetAV Confidence 4
                elseif CurrentList  == aaSCSlaveListStatsConfidence5
                    ActorRef.SetAV Confidence 5
                endif

                if CurrentList  == aaSCSlaveListStatsIgnoreCrime1
                    ActorRef.IgnoreCrime 1
                endif


            endif


        Loop


loop



End


 


 


Any other ways?


 


0

Share this post


Link to post

Is 'NX bloat' really a problem we should be concerned about?  Just curious.


0

Share this post


Link to post

It's possible, though I've never seen it.

The only way it can realistically happen is if a mod dynamically constructs the NX key that changes every time, like by incorporating an integer into it so you end up with "myvar:1", "myvar:2", ... "myvar:nnnnn". If you don't clean up the old ones when you're done, they'll stick around until the reference they are stored on goes away.

If you're storing them on the player or other refs that don't come from your mod, a clean save won't help either.

They can always be cleaned up by a script that knows how to find or construct the keys though, so they're unlike "lost" NVSE vars in that sense. There's no way to be permanently stuck with an NX var like can happen with NVSE. Worst case you can just look in the NX file (it's just a CSV) and delete them manually -- or at least get their names and then write a script to do it.

1

Share this post


Link to post

So.. How many NXvars do you think should exists in the savegame for player to notice that load time has increased?


 


Are they eval to simple quest variables in terms of loading time\memory use?


0

Share this post


Link to post

Depends on how fast the drive where FONV is installed is, how many mods are active, how much the load order has changed since the save was made, and how quick the CPU is. The time it takes is:

- File load time

- Time to convert strings to ints and floats.

- Time to compare any formIDs (the owner of every NX record, and any EVFO values) to the current load order.

If you just want to store the vars yourself and use them only in your mod, you can just put an array var in a quest. The major "selling points" of NX vars are that any mod can create and share the values there with any other, with no need for one to be the master of the other, and no need for buildref or anything like that. All both mods need to know are the key names and the ref the var is stored on -- both are easy with a readme saying "I store my vars in 'foo:bar:whatever' on playerREF" or all NPCs or whatever.

0

Share this post


Link to post

So arrays.. Are they "heavier" than NX vars? (array which consists of 15 strings vs 15 NX vars (strings) on various actors)


0

Share this post


Link to post

Nobody has noticed any performance problems with either, so nobody has done any kind of comparison like this. I suspect they are nearly identical.

Make a test ESP and try it out. Make 10000 entries in an array and 10000 in an NX and test save/load times. Try 100k if 10k isn't enough. Etc.

0

Share this post


Link to post

Well, that's what I wanted to hear, thanks. :)


0

Share this post


Link to post

Post content deleted.

Reason: I'm an idiot nevermind.

0

Share this post


Link to post

I'm an idiot nevermind.

 

Why?

Had a problem with a script. Posted it and the output. Proofreading the post back to myself, I learned I don't know the difference between true and false. MOAR coffee.

0

Share this post


Link to post

If anyone wants to look this over to see if I made any other dumbass mistakes.. I'd appreciate it. Some of it is probably a little confusing, I know, but it seems to be working correctly.. so far. This is the current script in SexoutNG 89beta6.

GitLab link

0

Share this post


Link to post

Oh, sorry. I was thinking you wrote that in the course of the talk =)


0

Share this post


Link to post

I would have tested if the actor was busy with Sexout before testing if he was sitting :)


 


Also technically ar_Find should return -99999 when not found.


0

Share this post


Link to post

I would have tested if the actor was busy with Sexout before testing if he was sitting :)

Why's that? Unless he's just starting to stand up after an act has started, but still registering as sitting, a sitting actor should never be locked by sexout. Is my brain working backwards here, or yours? ;)

Also technically ar_Find should return -99999 when not found.

Yeah I saw that, but I don't really want to check for the specific error, in case other specific errors are introduced later. This will keep it working even if you ad -99998 or -5 as a possible result.

Anything else stand out?

Edit: I guess both ways make the same amount of sense for sitting. If either is true, the other should be false.

0

Share this post


Link to post

I was thinking, maybe down the line, we could have a sex act where one partner is sitting and the other is playing an animation.


 


0

Share this post


Link to post

I was thinking, maybe down the line, we could have a sex act where one partner is sitting and the other is playing an animation.

In that case I think I'd just want to use refSurface and play a sexout sitting animation, to get around any vanilla sitting replacement anims and so on, so GetSitting would still return false.

0

Share this post


Link to post

Jaam, do you have any insight about why GetCallingScript returns 0 for quest stage/dialog result scripts? If it just returned the Quest refID or the dialog topic refID in those cases, that would be sweet.

0

Share this post


Link to post

 

I was thinking, maybe down the line, we could have a sex act where one partner is sitting and the other is playing an animation.

In that case I think I'd just want to use refSurface and play a sexout sitting animation, to get around any vanilla sitting replacement anims and so on, so GetSitting would still return false.

 

 

The issue's still hypothetical of course, but way back when I had the damndest time trying to set an anim on a couch using the refsurface vars and eventually gave up. I wager this was due to the actual sitting surface of the couch being a sight lower than where the actors were set, and clipping with the back of it. Chairs will probably suffer the same fate. Although maybe it all depends on the nifs, combined with the specific anims, really.

0

Share this post


Link to post