Jump to content

[LE] Quick Questions, Quick Answers


Recommended Posts

Indeed, you can simply swap them (move/place and enable the new, disable the old; do ask if you need help with that, should be little scripting) and then do the inverse operations once you want to revert it. if the appearance change is supposed to happen with the player looking just cover the swapping with an appropiate special effect.
Link to comment
Share on other sites

So does the weapondwarvencrossbow or whatever the exact name is apply to anything the game considers a crossbow or just the dwarven crossbow

The keyword WeapDwarvenCrossbow is used on all dwarven crossbows including the enchanted versions. It is also used in-conjunction with a couple idle animations related to attack starting (i.e. DwarvenCrossbowAttackStart and MC_DwarvenCrossbowAttackStart)

 

For the non-dwarven crossbow there is no specific crossbow keyword.

 

If you are adding additional crossbows, you can get away with WeapTypeBow and whatever material and vendor keywords you need.

Link to comment
Share on other sites

unequip a torch?

im here:

Int TypeInLH = PlayerREF.GetEquippedItemType(0)

If TypeInLH == 11

PlayerREF.UnEquipItem(?, 0) ; can i use direct FormID?

No, you cannot use the direct FormID.

 

You can use a property that you assign the torch object.

 

Example:

 

 

;in the empty state outside of all functions or events
Property Light Torch01 Auto

;inside some function or event
  If PlayerRef.GetEquippedItemType(0) == 11
    PlayerRef.UnequipItem(Torch01,false,true)
  EndIf 

 

 

Link to comment
Share on other sites

Is there a way to pass pointers to variables between scripts, as opposed to their values? Right now I'm using 1-element arrays as a kludge, but it IS a kludge, so...

What do you mean by "pointers"?

 

Perhaps an example of what you are doing may help in determining if there is a better way or different way.

Link to comment
Share on other sites

Is there a way to pass pointers to variables between scripts, as opposed to their values? Right now I'm using 1-element arrays as a kludge, but it IS a kludge, so...

 

... pointers. Like in C? Effectively they store the memory addresses for a variable (or other data structure), allowing you to change the data from multiple places by saying "change the data at location FOO from BAR to WEEBLE" from any of them and hence having that change also be immediately noticed by anything else accessing that memory.

 

As I understand it this is how Papyrus implements object reference passing and I know it is how it does array passing and assignments.

 

This is useful in a bunch of ways, obviously. My particular use case is that I have a singular data value (a spell radius) that numerous other things depend on and must frequently access. The data needs to exist in one location, in only one version, and accessing and updating it needs to be as low latency as I can possibly manage.

 

My current solution, therefore, is this:

 

Script 1:

int[] iActiveRadius
 
...
 
Event OnInit()
 
    iActiveRadius = new int[1]
    iAliasCount = Self.GetNumAliases()
...
    GotoState("Startup")
 
EndEvent
 
...
 
State Startup
 
Event OnBeginState()
    int i = 0
    while i < iAliasCount
        foamDetectLootAlias testAlias = (Self.GetNthAlias(i) as foamDetectLootAlias)
...
       testAlias.SetRadiusPointer(iActiveRadius)
        i+=1
    endwhile
...
EndEvent
...
EndState

And then, in the alias script:

 
int[] iActiveRadius
...
 
int Function SetRadiusPointer(int[] aiRadiusPointer)
    iActiveRadius = aiRadiusPointer
    return iActiveRadius[0]
EndFunction

Effectively, I have an int value that can be accessed (and changed) within each script, with each one immediately able to see it without waiting for a Get or Set function to return (avoiding the associated overhead, VM throttling, etc). As I said: kludgey! I was wondering if there was a better implementation of that behaviour.

Edited by foamyesque
Link to comment
Share on other sites

  • Recently Browsing   0 members

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