Jump to content

Pokeball Mod - Need help with script


raccoon122

Recommended Posts

I'm currently making a mod where it spawns an NPC via a baseball.

 

What I need help with is how to make a menu with a script, one that pops up on the activation of the Pokeball.

 

All I know is

 

scn PBall
begin OnActivate
;need to know what goes here
end

 

Thanks, I've tried to find a message thing on the Bethsoft page, but I didn't quite understand what it meant.

Link to comment
Share on other sites

My preferred method for scripting menus is to use a scripted token - an unplayable, therefore invisible, piece of armour. This token can be added to the player via AddItem when the menu is to be shown, and uses ShowMessage and GetButtonPressed in order to implement the menu.

 

Single level menus are fairly simple, and you can use a script like this for them (remember that button indices start at 0):

ScriptName ExampleMenuScript

short Button

Begin OnAdd
ShowMessage MenuMessage
; MenuMessage is a placeholder for the EditorID of your MESG form
End

Begin GameMode
set Button to GetButtonPressed
if Button == -1 ; No buttons have been pressed yet
	Return
elseif Button == 0
	; Result for button 0
elseif Button == 1
	; Result for button 1
elseif ...
	...
endif
End

To close the menu, use RemoveMe in a button result script.

 

If you want to create a mutli-level menu, you'll want to introduce a new variable to track the current level of the menu, and probably use a different button variable for each level of the menu. If you get confused with this, hopefully this page can help you - Basic Structure Of A Menu Level

 

Cipscis

Link to comment
Share on other sites

Yep, that would definitely be possible. You'd want to use AddItem in the result of a "keypress" hook (I've re-posted my preferred one at the end of this post), so long as the player has the appropriate weapon equipped and doesn't have the menu token in their inventory.

 

Here's the "keypress" hook:

short sIsNPressed

if sIsNPressed != IsKeyPressed 49; N
set sIsNPressed to sIsNPressed == 0
if sIsNPressed; N has been pressed
; Result
endif
endif

 

Cipscis

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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