Jump to content

Conditions with Papyrus scripting


Xilante

Recommended Posts

I'm quite new to modding (and scripting in general), so far I managed to use only a "few" conditions successfully (Such as Getitemcount and some other "Game.getplayer") but I was unlucky with some other and no matter how much I looked to complete script examples or various tutorials, I couldn't find a way to make them work through papyrus, so here I am :P.

 

What I'm looking to do is to make a trigger with a message popping up when there's a particular weather, something like that:

 

 

Scriptname ExampleTrigger extends ObjectReference

 

Event OnTriggerEnter(Weather Rain)

if(rain == Game.GetPlayer().israining) ;

Debug.MessageBox("It's raining!")

endif

EndEvent

 

 

Which doesn't seem to be working, I know the condition (In dialogue atleast) is called "israining", but I just don't know how to set it up on a papyrus script (may it be a trigger or other).

 

In the trigger example it was originally "(ObjectReference akActionRef)" but I figured out "akactionref" is the propriety I have to set as rain while it can't be objectreference as I can't choose the rain climate as an objectreference but it's instead "weather".

I also looked various proprieties and stuff regarding Weather, climate, small examples in creationkit official website hoping I would "guess" the right way to set it up but no luck.

 

Any help/suggestion you can give me is highly appreciated =).

Link to comment
Share on other sites

Weather CurrentWeather = Weather.GetCurrentWeather()

Event OnTriggerEnter(ObjectReference akActionRef)
    if akActionRef == Game.GetPlayer()
        if CurrentWeather.GetClassification() == 2
            Debug.MessageBox("It's raining!")
        else
            Debug.MessageBox("It's not raining!")
        Endif
    Endif
EndEvent

 

Can't test it myself, so i don't really know if it could work!

 

EDIT: Obviously the Scriptname bla bla bla is still there at the beginning

Edited by gasti89
Link to comment
Share on other sites

Thank you! :) I'll test it right now.

 

I get three errors when compiling:

 

no viable alternative at input 'Weather'

required (...)+ loop did not match anything at input '.'

Unknown user flag Weather

 

 

In first and third one, correct me if I'm wrong, I should put a propriety "weather" with the rain climate (?)

While the second error I have no idea what that means xD If it's because of an unset propriety or something else.

Edited by Xilante
Link to comment
Share on other sites

Uhm.....

 


Event OnTriggerEnter(ObjectReference akActionRef)
    if akActionRef == Game.GetPlayer()
        if Weather.GetCurrentWeather().GetClassification() == 2
            Debug.MessageBox("It's raining!")
        else
            Debug.MessageBox("It's not raining!")
        Endif
    Endif
EndEvent

 

Try this, delete the first line from the previous script

Edited by gasti89
Link to comment
Share on other sites

I think there was a mistake on the 1st script, you can also try this (i'm still a scripting noob, so i take stuff from CKwiki)

 

Weather CurrentWeather

Event OnTriggerEnter(ObjectReference akActionRef)
    Weather CurrentWeather = Weather.GetCurrentWeather()
    
    if akActionRef == Game.GetPlayer()
        if CurrentWeather.GetClassification() == 2
            Debug.MessageBox("It's raining!")
        else
            Debug.MessageBox("It's not raining!")
        Endif
    Endif
EndEvent

Link to comment
Share on other sites

The first one worked perfectly! =) Thank you a lot!

And you're not a noob! or at least you're way way more better than me, I tried for days and days by looking countless times at CKwiki and couldn't even come close to what you wrote in a few minutes =P Definitively helped me a lot! *Gives a kudo*

Link to comment
Share on other sites

  • Recently Browsing   0 members

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