Jump to content

Quick Question -> Quick Answer


portbash

Recommended Posts

In 2009 user Cipscis had this wonderful idea of a thread called: "Quick Question - Quick Answer".

 

This thread is for all those small modding questions that need asking, but might not feel big enough for a thread of their own ...

 

The lack of a Skyrim-One surprised me, so why don't we have one too? Let's stick to the Do & Don't Guideline, Cipscis came up with and please keep in mind: This thread is for answering questions about creating mods, not for questions about using mods. Now let's have some quick questions & answers!

 

 

 

I'm (very papyrus-noobish, but fallout veteranish) going to start with a simple one, but which troubles me cuz IT MAKES NO SENSE! :wallbash:

 

It's not counting:

   if (DevGlobal.getValue() == 0)
       debug.notficiation("ping!")
       DevGlobal.SetValue(1)
   endif

 

Simple, yes. But it's not counting. I tried a lot of variations and in different events. The upper code is the simplest I ended up with and still: I receive a debug.ping, but still not setvalue happens. Of course the global has been added to the script (GlobalVariable Property DevGlobal Auto). So is there anything additional that needs to be done to make it counting, or should it just work and I do have some other issues going on? :biggrin:

Link to comment
Share on other sites

You've declared the property, but have you 'tied' it to the global in the CK? It's a very common mistake and easy to forget.

You need to go into the CK and assign all properties of scripts. If you use the same proeprty name as an editorID names then you can often just use the 'auto' button.

Link to comment
Share on other sites

You've declared the property, but have you 'tied' it to the global in the CK?

 

 

DOH! :whistling: That just popped into my mind when I opened the browser... totally forgotten to create the global. thx fish!

Edited by portbash
Link to comment
Share on other sites

sorry chargerguy, I'm no armor smith, but maybe you can PM an armor author if no one replies in here.

 

 

I got two papyrus ones:

 

I wonder: What's the counterpart of the getSecondsPassed in papyrus? How to create a timer like the "old" ones?

 

If Timer > 0
   set Timer to Timer -getSecondsPassed
else
   do stuff
endif

;and the other way:
If Timer < 0
   set Timer to Timer +getSecondsPassed
else
   do stuff
endif

 

The other one:

I'm using a constant setposition(x,y,z) on a spawned reference (called by placeAtme) in a looped state. Now the problem is: The reference gets re-enabled (fades in) as soon it's reaches the the new coordinates. Due the fast update speed it can't come to rest and is almost invisible. How to prevent that?

Edited by portbash
Link to comment
Share on other sites

The other one:

I'm using a constant setposition(x,y,z) on a spawned reference (called by placeAtme) in a looped state. Now the problem is: The reference gets re-enabled (fades in) as soon it's reaches the the new coordinates. Due the fast update speed it can't come to rest and is almost invisible. How to prevent that?

 

 

An enable(0) prevents the object from fading... almost... depending on the update speed it blinks, but isn't transparent all the time. Maybe there is a better way of doing this...

Link to comment
Share on other sites

There is no GetSecondsPassed function in Papyrus because papyrus scripts don't run every frame. The closest you could come to it would be to find the difference in time between updates by checking how long the game has been launched.

 

Float UpdateTime

Event OnInit()
UpdateTime = Utility.GetCurrentRealTime()
RegisterForSingleUpdate(0.01)	;i doubt that you can actually have this short of an interval
EndEvent

Event OnUpdate()
UpdateTime = Utility.GetCurrentRealTime() - UpdateTime
if (UpdateTime < 0)
	;game was relaunched
else
	Debug.Notification("Seconds passed since last update: " + UpdateTime)
endif
RegisterForSingleUpdate(0.01)
EndEvent

 

Instead of constantly using SetPosition, I would use one of the TranslateTo functions.

Link to comment
Share on other sites

There is no GetSecondsPassed ...

 

Yeah, it slowly began to dawn on me that's something I have to let go... . A pity that you can't use utility.wait() without having ALL related scripts to be paused too. Still messing with states to avoid that. Thanks again for the example code... I'll look into it + thanks for the tip on the TranslateTo :wub: function, I knew that there is a "better" way.

 

Cheers!

 

EDIT:

uuuh, I love it! (translateTo) :thumbsup:

Edited by portbash
Link to comment
Share on other sites

  • 1 month later...

Been staring at this one for about an hour, others would be pulling out their hair by now.

ScriptName WTF extends Form
int Function Megafail()
int x = 0
int y = 0
x = 22
y = x-1
Return y
endFunction


Starting 1 compile threads for 1 files...

Compiling "WTF"...

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\WTF.psc(6,5): no viable alternative at input 'x'

No output generated for WTF, compilation failed.

 

Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on WTF

Link to comment
Share on other sites

  • Recently Browsing   0 members

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