Best way to set variable?

Post » Wed Jun 20, 2012 9:08 am

Hi.

In my trap mod I wanna give the player the option to choose between two different styles to manage the traps:
1. When activating a closed trap the player is prompted with a message box asking if he/she wants to "reset" or "pick up" the trap.
2. When activating a closed trap the player automatically picks up the trap.

Here's my code:

GlobalVariable Property HT_TrapMessageCheck  AutoMiscObject  Property HT_TrapReplacement  AutoMessage Property HT_ActiTrapMessage  Autoevent OnActivate(objectReference TriggerRef)   int whichbutton = 0   if (HT_TrapMessageCheck == true)					   ; This is a global variable property that I want to set to true/false	  whichbutton = HT_ActiTrapMessage.Show()     ; Show the message box	  if (whichbutton == 0)                 : Reset the trap		 playAnimationAndWait("Reset01","Trans02")		 goToState("Open")	  else                                 ; Pick up the trap		 Delete()		 TriggerRef.AddItem(HT_TrapReplacement, 1, false)	  endif   else                    ; Pick up the trap without showing the message box (automatically)	  Delete()	  TriggerRef.AddItem(HT_TrapReplacement, 1, false)   endifendEvent

What I want to do is in another script set the global variable.
For example if the player activates something that makes a message box pop-up and ask which way the player prefers. But the player has to be able to open this menu anytime to change it, if he/she wants.
User avatar
Anthony Rand
 
Posts: 3439
Joined: Wed May 09, 2007 5:02 am

Post » Wed Jun 20, 2012 9:13 am

Bump.
User avatar
KiiSsez jdgaf Benzler
 
Posts: 3546
Joined: Fri Mar 16, 2007 7:10 am

Post » Wed Jun 20, 2012 1:50 am

Well we know you can actually interact with objects in your inventory (The space Core, for example, talks if you click on it in your inventory)* - how about making it so clicking on a trap in your inventory pulls up the options box?

* At least mine used to...I think mine got mad at me or something, it no longer talks
User avatar
Andres Lechuga
 
Posts: 3406
Joined: Sun Aug 12, 2007 8:47 pm

Post » Wed Jun 20, 2012 9:21 am

Well we know you can actually interact with objects in your inventory (The space Core, for example, talks if you click on it in your inventory)* - how about making it so clicking on a trap in your inventory pulls up the options box?

* At least mine used to...I think mine got mad at me or something, it no longer talks

That sounds like a really good idea. I will try to figure it out.
-What event runs when I click on a misc object? (I am guessing "OnEquipped()" runs when clicking on a weapon/armor)

If this does not work, any other ideas?
I was thinking of giving the player a book ("a manual") on how the traps work, that could somehow set the variable. -Is there any way of adding buttons in a book?



EDIT: Using "OnEquipped()" works!
Thanks for the great idea. =)
User avatar
Dorian Cozens
 
Posts: 3398
Joined: Sat May 26, 2007 9:47 am

Post » Wed Jun 20, 2012 6:10 am

I don't want to bump this thread, but I got a quick question and I rather not make a new thread about it..

Does global variables save in the player's save file?
-I tested it and it seems like they do, but I wanted to be sure.

Thanks.
User avatar
Sunnii Bebiieh
 
Posts: 3454
Joined: Wed Apr 11, 2007 7:57 pm

Post » Wed Jun 20, 2012 12:03 pm

Does global variables save in the player's save file?
yes
User avatar
sexy zara
 
Posts: 3268
Joined: Wed Nov 01, 2006 7:53 am


Return to V - Skyrim