Using XML to make the persuasion button either invisible or

Post » Tue May 08, 2012 1:28 am

I've been looking into making use of XML, but am not too clued up on it. Can anyone tell me if and how I can use the OBSE commands for manipualting XML to make the button that opens the persuasion minigame either invisible or inactive.

Thanks,
PM
User avatar
Juliet
 
Posts: 3440
Joined: Fri Jun 23, 2006 12:49 pm

Post » Mon May 07, 2012 4:44 pm

Wouldn't using SetNoPersuasion be easier? Then it's not invisible or inactive, it's absent!
User avatar
sam smith
 
Posts: 3386
Joined: Sun Aug 05, 2007 3:55 am

Post » Mon May 07, 2012 8:45 pm

That's what I'm doing at present. But it means that people would be stuck with my mod for life, as if they uninstalled it, everyone would be unpersuadable.
User avatar
Toby Green
 
Posts: 3365
Joined: Sun May 27, 2007 5:27 pm

Post » Mon May 07, 2012 1:43 pm

There's a few xml-related ways you can do it.

You can set to false for the persuation button to hide it, or you can set to false to make it non-clickable. Or you can run your script every frame and detect when the mouse is over the Peruasion button, and disable left mouse button as long as the mouse is pointing there. The Persuasion menu's xml path seems to be: "dialog_topics\dialog_button_layout\dialog_persuade", so altering the two would need:
SetMenuFloatValue "dialog_topics\dialog_button_layout\dialog_persuade\visible" 1009 1
or
SetMenuFloatValue "dialog_topics\dialog_button_layout\dialog_persuade\target" 1009 1

...where the last "1" means false, and "2" is true and would enable them.

Note that the specific xml menus are re-built by the engine at various times. I'm not sure whether the Dialogue menu is rebuilt every time you activate a new NPC, but I would guess so. If that's the case, you can just forget the changes when the dialogue menu has been closed. If not, you need to change it back to enable it.


But from looking at the SetNoPersuasion function, I think it works like most other OBSE functions: It lasts for the reminder of that game session, but is not stored in the savegame. And even if it was, it would be relatively simple to detect when you're back in GameMode again, and then call SetNoPersuasion to enable Persuasion again.
User avatar
Julia Schwalbe
 
Posts: 3557
Joined: Wed Apr 11, 2007 3:02 pm

Post » Mon May 07, 2012 10:32 pm

Thanks TNO, that was exactly what I needed. I decided to go with the setting 'target' to false; as it doesn't involve the brief flicker of the button, as is caused by the other method, when employed through a Begin Menumode block.

Oh, and if you're interested, SetNoPersuasion DOES persist after a game is saved and reloaded.
User avatar
Jason White
 
Posts: 3531
Joined: Fri Jul 27, 2007 12:54 pm


Return to IV - Oblivion