BlockActivation on MiscItem

Post » Fri Nov 16, 2012 9:36 am

Hello everyone.

I am not a native english speaker so I want to appologize for every mistake and error in advance.

I am new to Papyrus scripting and I can't figure out this simple problem:
I want to block the default activation event of a misc item (in this case 'take') that I can implement my own activation behaviour via MessageBoxes to be controlled by the player.

Scriptname dsaAdventureScript extends ObjectReference  Event OnInit()	Debug.MessageBox("OnInit")	self.BlockActivation()	Debug.MessageBox(self.IsActivationBlocked())endEvent

My item keeps ignoring the BlockActivation function. Am I doing something wrong or does BlockActivation not work for MiscItems?

Thanks in advance.

Best regards
Fenrik
User avatar
Claudia Cook
 
Posts: 3450
Joined: Mon Oct 30, 2006 10:22 am

Post » Sat Nov 17, 2012 12:16 am

There is a script already made for you! Its called defaultBlockActivation. Check it out!
User avatar
Jake Easom
 
Posts: 3424
Joined: Sun Jul 29, 2007 4:33 am

Post » Fri Nov 16, 2012 7:36 pm

BlockActivation will not remove the text "take whatever" from the item however.

you can use SetDestroyed to make it totally non-interactable (no text on mouse-over or anything). since skyrim doesnt really use destruction on items, this has been safe to use in my experience.
User avatar
Valerie Marie
 
Posts: 3451
Joined: Wed Aug 15, 2007 10:29 am

Post » Fri Nov 16, 2012 3:35 pm

There is a script already made for you! Its called defaultBlockActivation. Check it out!

Thanks for the quick answer, but I am not quite sure what you mean. Is defaultBlockActivation a standard script in the creation kit or is it some custom script? I am asking because searching for it in this forum did not show anything.

BlockActivation will not remove the text "take whatever" from the item however.

you can use SetDestroyed to make it totally non-interactable (no text on mouse-over or anything). since skyrim doesnt really use destruction on items, this has been safe to use in my experience.

Thanks, but I do not want to make the item non-interactable. I want to implement my own activate behaviour controlled by commands through message boxes. So basically I want to block the 'take' command and show a message box with options for the player. The problem that the text will say 'take whatever' is secondary.
User avatar
Soku Nyorah
 
Posts: 3413
Joined: Tue Oct 17, 2006 1:25 pm

Post » Fri Nov 16, 2012 9:50 pm

Whatever you add defaultBlockActivation to, it will block that event. If you want to create a different script that captures that event, then do so, its safe. You can have more than one script on an object.
User avatar
Jynx Anthropic
 
Posts: 3352
Joined: Fri Sep 08, 2006 9:36 pm

Post » Sat Nov 17, 2012 12:28 am

Whatever you add defaultBlockActivation to, it will block that event. If you want to create a different script that captures that event, then do so, its safe. You can have more than one script on an object.

Ah, now I understood. Thank you very much. I just tried it and it works perfectly.
I still don't get why the command works for when you call it 'On Load', like it is done in defaultBlockActivation, and not 'On Init' but maybe it is one of the many mysteries of the creation kit.
User avatar
Phoenix Draven
 
Posts: 3443
Joined: Thu Jun 29, 2006 3:50 am

Post » Fri Nov 16, 2012 5:03 pm

oninit will run only once when the script is first introduced in your savegame.

if you saved since editing the script, your oninit is already "fired" in the save game and subsequent changes to the oninit block will not fire.


for testing purposes, always use a clean save with no history of the mod you're testing.
User avatar
Miss Hayley
 
Posts: 3414
Joined: Tue Jun 27, 2006 2:31 am

Post » Fri Nov 16, 2012 9:18 pm

oninit will run only once when the script is first introduced in your savegame.

if you saved since editing the script, your oninit is already "fired" in the save game and subsequent changes to the oninit block will not fire.


for testing purposes, always use a clean save with no history of the mod you're testing.

There was no save game involved. For testing reasons i coc'd from the starting screen to a test area and added the item by player.additem -> OnInit fires
then I dropped the item from the player inventory to the cell -> OnInit fires again
It seem OnInit fires everytime when the item is displayed, or created somehow in the game environment.
User avatar
Rachel Eloise Getoutofmyface
 
Posts: 3445
Joined: Mon Oct 09, 2006 5:20 pm


Return to V - Skyrim