Jump to content

How can use SetNPCWeight (or similar) in scripts?


Tiranno71

Recommended Posts

Hi,

 

i need to change weight of target NPC casting a spell as effect. i've looked around but i've found a function that change player weight only.

 

My problem is, there is a function to change weight to npc too?

If yes, can anyone post an example?

 

Thank you in advance.

 

Link to comment
Share on other sites

 


SKSE's SetWeight can be used for any actor not just the player.

 

 

Thanks for reply, i'm new with scripting ....

trying to do this:

Scriptname WeightEffect extends activemagiceffect  
 



Event OnEffectFinish(Actor akTarget, Actor akCaster)
    
    actorbase pakTarget = akTarget.GetActorBase()
     pakTarget.SetWeight(100.0)
    pakTarget.QueueNiNodeUpdate()

 EndEvent
 


the compiler give me these errors:

WeightEffect.psc(7,12): SetWeight is not a function or does not exist
WeightEffect.psc(8,11): QueueNiNodeUpdate is not a function or does not exist

how can I solve?

Edited by Tiranno71
Link to comment
Share on other sites

Make sure SKSE is installed including the PSC files.

 

 

Other things work well just this not.

 

can you post a working script for my knowledge? I've just started scripting from a few days. i've created some scripts already with no problems, but never used functions till now.

i wull appreciate your help.

 

...anyway ... thanks.

Link to comment
Share on other sites

SKSE stuff will run in game without the PSC scripts installed in the Data > Scripts > Source folder, but SKSE functions will not be located and prevent scripts from being compiled. Hence I said to make sure that the PSC files were also installed.

 

The following is a modification of your script. It compiles. No idea if it works. Only thing different is that the QueueNiNodeUpdate needed to be called with an actor rather than an actorbase. The SetWeight did not produce an error at all. Thus my suggestion to ensure that SKSE was fully installed is warranted.

 

 

 

Scriptname WeightEffect extends activemagiceffect  

Event OnEffectFinish(Actor akTarget, Actor akCaster)
	actorbase pakTarget = akTarget.GetActorBase()
	pakTarget.SetWeight(100.0)
	akTarget.QueueNiNodeUpdate()
EndEvent 

Link to comment
Share on other sites

Thanks to all, finally has been compiled without errors. I've reinstalled manually all SKSE package and everything is gone right even if the script don't show the change weight when casted the related spell on target. For now it's hard find a solution....

 

anyway thanks so much again! :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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