Jump to content

Fallout New Vegas GECK & Scripting Help 101


Recommended Posts

Posted

I guess I don't understand why you need the "addspell" to begin with.

 

You said you were just using that to turn the light on and off. Using HoldKey will turn the light on and off, without any AddSpell anywhere.

Posted

using Holdkey will prevent my other script which allows to play an animation when I open the pipboy in the case when the player holds the key from a time > of a tap and < of a "hold key" timing (which is about 2 seconds).

Posted

yes, I'm sure because I did the script and I know how the workaround works. Actually you can't playidle if you press the pipboy key. Some thing like that, in that video, isn't really possible. What I did was finding a workaround.

 

Basically, in realtime my script stores the pipboy key and replaces it, and then if IsKeyPressed (the key that the user THINKS is the pipboy key), my script will playidle and at the end will tap the remapped pipboy key. As failsafe, if you reload or if you go in menumode, it will switch back the keys in realtime, so for example if you go in the main menu to change your pipboy key you will see it is still on the TAB.

 

This is how actually it's working:

 

If IsKeyPressed (tab)

   if I release the key before 2 seconds, it means I'm tapping -> play the idle -> tap the real pipboy key

    if I'm holding the key for at least 2 seconds, it means I'm holding -> cast the light spell

 

Now, how a script like this could work with the light?

 

Holding via script the REAL pipboy key, would mean destroying the purpose of the "fake" script. It means that if you hold that key for 1 second and then you release it, the light won't be on because it wasn't enough, but also it will open the pipboy without playing any animation. On the other hand, to understand if the player is really holding, I should hold the key at least 2 seconds, so if I use the Holdkey after 2 seconds I'm holding the fake key, this means I will have a response after 4 seconds, which is inacceptable.

 

I'm not sure if you can see what I mean, because I'm aware this workaround is actually a bit peculiar, but I can assure you it works flawless for now, it never looses a shot. Oh and I really think it's pretty nice as workaround.

Posted

Ahh ok, I understand.

 

Your script is at the wrong "level" to fix the issue you're having in detecting that the key is held vs. pressed, so your only choice there is to "stack" as you're doing, leading to the 4s delay.

 

Since the AddSpell thing doesn't work, and you can't get around the timing issue, I only see two answers.

 

1. Using a new key for the light. If they tap that key (IsKeyPressed), you do the pipboy key hold in a script and play the animation.

 

2. Create an entirely new lightsource, matched with color and intensity to the pipboy light, and move it around with the player. This will probably have to be a reference, not a spell/spell effect (because of your other problem), that you enable/disable and move around.

 

Well there's a 3rd option too...

 

Beg jaam to find the entry point for the pipboy light toggle and create an NVSE function to toggle it. ;)

Posted

I still believe that among all these ones, the most rational and functional is mine... *lol* I'm pretty sure there's a way to remove that box on top left, I just need to find how.

 

Using a new key for the light would destroy the purpose of the script.

 

While creating a new light, it doesn't work too. You can't move a light around with you, it doesn't work just like for statics. The way people usually make flashlights is spamming PlaceAtMe, continuously, and remove the previous light reference created, with disable / mark for delete. This causes a pretty huge fps loss and the light doesn't render very well in the world. This is a solution to avoid in my opinion.

 

For 3rd, no way, Jaam has tons other things more interesting to do. And my "beg list" would have at least 100 other functions more important than this one :P

Guest tomm434
Posted

Has anyone here a working script which can recognize if function is called from another mod?

Posted

GetCallingScript works.

 

int iCaller
int iMe

let iMe := GetModIndex "mymod.esp"
let iCaller := GetCallingScript

if (iCaller == 0)
  ; The calling script is a dialong/quest result script
  ; could be ANY mod.
else
  let iCaller := iCaller >> 24
  if (iMe != iCaller)
    ; The calling script is from a different mod
  endif
endif
edit: slight fix to make it more correct.
Guest tomm434
Posted

Also I've got a problem (

                let Item := ActorRef.GetEquippedObject 6
                printc "%n %i" Item Item

                let texture_path := GeTexturePath Item
                print $texture_path

GetEquippedOject returns base form. Script stops on the third line (getTexturePath) and spams no error in console. Same happens for GetModelPath

 

 

Also is there any way to return actual reference of item which is equiped by actor?

Posted

If that code was copy pasted by your actual code, it misses a "t" (GeTexturePath).

 

When I use GetModelPath for the skeleton, it requires the Ref before it, so maybe for items is the same

let SomeThing := Player.GetModelPath
Guest tomm434
Posted

It doesn't work on refs too. I created a persistent item with its own reference and these functions didn't return me anything.

 

But it works on terminals - that's for sure.

Posted

It probably has some limits depending by the type. Which kind of item you created, Misc/Armor/Weapon? for equippable things there's the GetBipedModelPath that maybe could help

Guest tomm434
Posted
Which kind of item you created, Misc/Armor/Weapon?

Armor

 

Oh thanks I missed that one. I'll try it next time I can. But there's no Biped texture path. And I believe that even if I set another model for armor I'll have to cast update3d on it and it will be noticable.

Posted

Closest I can get is this:

call npTestScriptFunc2Script ar_Map("actorA"::0, "actorB"::playerRef)
but you should be able to decode 0 as getSelf in the called UDF:

scn npTestScriptFunc2Script

array_var aTiti
ref self

begin Function { aTiti }
	set self to GetSelf
	PrintC	"Hello %n [%i]" self self
end

 

The crazy... it works.

 

 

 

scn fnSexoutActRunFull

; args
array_var arParams

; internal
string_var sActor
array_var arActors
array_var element
ref rTarget
string_var sType
string_var sKey
ref rVal
float fVal

Begin Function{arParams}
  let arActors := ar_List("actorA", "actorB", "actorC")

  ; Find our target and handle getself
  foreach element <- arActors
    let sActor := element["Value"]

    let sKey := element["Key"]
    if eval(ar_HasKey arParams $sActor)
      if eval("Form" == TypeOf arParams[$sActor])
        if (0 == IsFormValid rTarget)
          let rTarget := arParams[$sActor]
        endif
      elseif eval("Number" == TypeOf arParams[$sActor])
        if (0 == IsFormValid rTarget)
          let rTarget := GetSelf
          let arParams[$sActor] := rTarget
        endif
      endif
    endif
  loop

  if (1 == IsFormValid rTarget)
    if (1 == isReference rTarget)
      ; Set all NX vars
      foreach element <- arParams
        let sKey := element["Key"]
        if eval("Number" == TypeOf element["Value"])
          let fVal := element["Value"]
          call fnSexoutNXSetEVFl rTarget, "Sexout:Start::" + sKey, fVal
        elseif eval("Form" == TypeOf element["Value"])
          let rVal := element["Value"]
          call fnSexoutNXSetEVFo rTarget, "Sexout:Start::" + sKey, rVal
        endif
      loop

      rTarget.NX_SetEVFl "Sexout:Start::CallVer" 1
      rTarget.CIOS SexoutBegin
    else
      PrintC "fnSARF: Could not find valid target ref."
    endif
  else
    PrintC "fnSARF: Could not find valid target form."
  endif
End

 

Posted

Well - what about script-pressing tab button before player IsSpellTarget of pipboy light (by the way, what spell is it?)E

 

EDIT:

Also try CIOSing the spell instad of adding it.

AddSpell is the only option sometimes, I recently found out WaterBreathing Spell only works if you rActor.AddSpell WaterBreathing, rActor.CIOS WaterBreathing fails

I had allways assumed the only difference between the 2 was one showed a message when cast.

Not sure if the same problem happens with RemoveSpell & Dispel

Posted

AddSpell is the only option sometimes, I recently found out WaterBreating Spell only works if you rActor.AddSpell WaterBreathing, rActor.CIOS WaterBreathing fails

I had allways assumed the only difference between the 2 was one showed a message when cast.

Not sure if the same problem happens with RemoveSpell & Dispel

 

This. And probably you also found annoying that "added" on top left if you casted Player.AddSpell... which is what I would love to erase

Posted

Excluding GetActorBaseFlagsHigh / Low, are there other functions that check flags inside actors? I'm looking for a function that checks if the Aggro Radius flag is flagged or not

Posted

A curiosity about declaring variables inside dialogue result scripts, since some time ago this came out.

I just found a vanilla example of it.

The dialogue is called vDialogueJacobstown, the topic (one of them, there's more) is called vDialogueJacobstownJacobstownCalamityTopic011.

Basically it's when you bring to Calamity a new brain to implant on Rex.

 

Inside the dialogue result script there's the following code:

float RexSpeed

ApplyImageSpaceModifier FadeToBlackAndBackISFX
player.RemoveItem VMS24BrainVioletta 1
SetObjectiveDisplayed VMS24 20 0
SetObjectiveDisplayed VMS24 25 0
SetStage VMS24 100

set RexSpeed to RexRef.GetAV SpeedMult
set RexSpeed to (RexSpeed*1.5)
RexRef.SetAV SpeedMult RexSpeed
ShowMessage RexSpeedIncreaseMsg
set GameHour to (GameHour + 6)

As you can see it declares a float.

 

I checked Calamity's script (since Calamity is my Subject in the dialogue)

It has no declared variables at all, inside of it.

 

Posted

One thing to keep in mind there is that I feel Obsidian just didn't know the engine as well as Beth did. See the plugin limit, the disappearing refs when you have DLCs installed for whatever reason... would be interesting to see if there's an instance of that in FO3.

Posted

When I've read it, I thought almost the same. I thought "ok this doesn't mean that variable really takes some value in game and maybe it is completely ignored... Rex is supposed to go at 150% of its speed, but I wouldn't be surprised if nothing changes and noone ever noticed that... ;) but one thing is sure: I'm not going to play vanilla quest line until that point just to verify that!

If I'll see something in FO3 I'll let you know

 

In the meantime I bump this... noone in love with flags?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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