Jump to content

make a functional hotplate


YanL

Recommended Posts

If you make it a misc item, you can do it like this:

scn AAACampfireScript
 
BEGIN OnActivate
    If IsActionRef Player
        If player.IsSneaking
            Activate
        Else
            If Player.IsInCombat
;               ShowMessage NVDLC02CampfireNoActivateMSG ; This line is currently commented out and the player will pick up the hot plate when in combat.
                Activate                                 ; Easily changed back to showing the message by deleting this Activate line and removing the
                                                         ; first semicolon from the ShowMessage line.
            Else
                Player.ShowRecipeMenu CampfireRecipes
            Endif
        Endif
    else
        return
    Endif
END

Home On The Range lets you sleep at campfires, and it was for some reason added to the general campfire script rather than the perk, forcing the developers to check the Base ID of the Activator and make sure it was supposed to have the perk. Because this is a new script, none of that was necessary and it is now removed.

Edited by EPDGaffney
Link to comment
Share on other sites

  • Replies 65
  • Created
  • Last Reply

Top Posters In This Topic

There are always many ways to script things. The truth is that most of the time, if it works, it barely even matters how you got it done. I like to script as clean as I can, but that's more a personal thing. It's better for performance of course, but in the majority of cases, it's negligibly so, so I wouldn't worry about it.

Link to comment
Share on other sites

hey guys, thanks for the help.

 

Chill, your script works.....more or less.

 

I can drop the item (and drag with Z), use as a campfire, pick up in sneak mod, not use it in combat, but I have a super strange and annoying issue. When I pick the item, this message never goes away, unless I bring the pipboy.

 

TJYgw8M.jpg

 

 

BUT this occurs only in this type of terrain. On the roads and inside the houses is ok. Very strange huh?

Link to comment
Share on other sites

I don't know why it would do that. I'm finding a lot of stuff in this engine has trouble disabling and zapping itself if the circumstances are wrong. If you use a misc item with my script, I can just about guarantee you this won't happen. Not that Chill's script is wrong, cos it should work, but mine relies on the basic engine functionality of simply picking up the item. If you still have this problem with my script, could be something to do with your model.

 

Also, forgot:

User.Activate was a mistake. It won't come up in-game, thankfully, but this line was telling the object that has this script attached to it, to activate whatever reference was stored in the User variable. Essentially, it's telling the pot to activate the NPC that tried to activate it.

Link to comment
Share on other sites

Ok, I will try.

 

But I´m very bad at this, I don´t understand your script.

 

For example, what is this?

 

 

 

If IsActionRef Player

 

And where I put the object reference in there? This script is for MY hotplate, not all hotplates in the game.

Link to comment
Share on other sites

Essentially, it's telling the pot to activate the NPC that tried to activate it.

Such a nasty pot. oO

 

 

Addition:

IsActionRef is a function similar to GetActionRef.

 

Just that you can use IsActionRef in queries, without needing to use an extra reference variable.

 

Ah, I just had to read it up myself. ^^

https://geckwiki.com/index.php/IsActionRef

It's specifically useful in OnActivate blocks, like here.

Link to comment
Share on other sites

 

Essentially, it's telling the pot to activate the NPC that tried to activate it.

Such a nasty pot. oO

 

 

:laugh: :laugh: :laugh:

 

This could be a mod

Link to comment
Share on other sites

SetDestroyed will visually seem to work, I would think. But the object would probably still be there in the same capacity and if it is, it will probably contribute to bloated saves. I'd like to know what's causing the problem and fix that, or avoid it altogether. Curious, YanL, does the rollover text remain if you go to a different cell and come back?

 

Such a nasty pot. oO

Haha, you got that right.

 

My script simply gets attached to the pot, which should be a misc item. It will work as soon as you do that (unless I typoed something).

Here is a commented version of my script:

scn AAACampfireScript
 
BEGIN OnActivate              ; Activating the object calls the rest of the script.
    If IsActionRef Player     ; If the Player is the Action Ref, or the actor activating the object, proceed.
        If player.IsSneaking  ; If the player is sneaking...
            Activate          ; ...pick up the item.  'Activate' initiates the default activation of the form type,
                              ; which for pick-ups, is to pick them up.  For doors, they would open, and for Activators,
                              ; nothing would happen.

                              ; If you used 'Activate Player 1', it would call the OnActivate block from
                              ; the object's script, which we wouldn't ever do in the object's own script.

        Else                      ; If the Player is NOT sneaking...
            If Player.IsInCombat  ; If the player is in combat:

;               ShowMessage NVDLC02CampfireNoActivateMSG ; This line is currently commented out and the player will pick up the hot plate when in combat.
                Activate                                 ; Easily changed back to showing the message by deleting this Activate line and removing the
                                                         ; first semicolon from the ShowMessage line.

            Else                                      ; If the Player is NOT in combat:
                Player.ShowRecipeMenu CampfireRecipes ; Show the campfire recipe menu.
            Endif
        Endif

    else        ; If the Action Ref (the actor activating this object) is NOT the Player...
        return  ; ...do nothing (and don't call the rest of the script, but there's no scripting
                ; after this line anyway, so it doesn't matter).
    Endif
END
Edited by EPDGaffney
Link to comment
Share on other sites

 

SetDestroyed will visually seem to work, I would think. But the object would probably still be there in the same capacity and if it is, it will probably contribute to bloated saves. I'd like to know what's causing the problem and fix that, or avoid it altogether. Curious, YanL, does the rollover text remain if you go to a different cell and come back?

 

That would be true.

 

But if YanL used my code like posted they should be fine:

        "SetDestroyed 1" ;--> Addition.
        Disable
        MarkForDelete

However, I appreciate your solution. It's pretty uncomplicated. I wish I could do that from scratch, but I mostly start with some sort of pseudo coding. :awkward:

My light mod is actually also just an hommage to JIP LN NVSE functions and the genius behind them.

I have literally no idea why it works.

Just figured some things by trial and error. ^^

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...