Jump to content

i need help with making a mod


adamchaggama

Recommended Posts

thanks for trying to help but am not sure if thats it. i want to make a spell that when you use it a box pops up on your screen and you have options there am trying to make a castle mod and at the gatewhen i use the spell options pop up and lets sey one of them is when i press that option the guard opens the gate
Link to comment
Share on other sites

The page that Xilante gave you is the right thing. You will have to study the wiki example and adapt the code to work with a spell, and adapt the options presented to open/close the gate.

 

You'll need the script to extend ActiveMagicEffect instead of ObjectReference.

Instead of the OnRead() event, you will rename it to OnEffectStart().

You should omit the OnContainerChanged() block completely.

 

Maybe later if I have time I'll write the spell script for you.

Edited by steve40
Link to comment
Share on other sites

This is a template of how you would open a menu using a Spell with a script attached to a MagicEffect. You will need to modify this template to your needs and write your custom functions etc.

 

 

 

ScriptName _CustomMenuScript extends ActiveMagicEffect
{
A template for a MagicEffect script that opens a custom menu.
}

Message property _Menu1 auto    ; You need to create at lease one Message form in the CK. This one is for the main menu
Message property _Menu2 auto    ; If you want to have a sub-menu, you will need to create a second Message form in the CK

;==============================================================

Event OnEffectStart(Actor akTarget, Actor akCaster)

If akCaster = game.GetPlayer()
	Menu()
EndIf

Dispel()				; Kill the spell and quit

EndEvent

;==============================================================

Function Menu()

int option = _Menu1.show()		; Show the Main Menu

If option == 0				; This would be the "Open Drawbridge" option
	OpenDrawbridge()		; Calls a custom function to do something useful
	Menu()				; Return to the Main Menu

       ElseIf option == 1			; This would be the "Close Drawbridge" option
               CloseDrawbridge()		; Calls another custom function to do something useful
               Menu()				; Return to the Main Menu

       ElseIf option == 2			; This would be an option to open a sub-menu, if required
               ShowMenu2()			; This is how you would call a custom function to open a sub-menu
               Menu()				; Return to the Main Menu

       ElseIf option == 3                      ; This would be the "Cancel menu" option
               Return
       EndIf

EndFunction

;==============================================================

Function OpenDrawbridge()

       ; do stuff here to open the drawbridge

EndFunction

;==============================================================

Function CloseDrawbridge()

       ; do stuff here to close the drawbridge

EndFunction

;==============================================================

;\ remove this comment block if you want to use this part

Function ShowMenu2()

       int option = _Menu2.show()              ; Show the sub-menu

       If option == 0
               myCustomFunction()              ; do something useful
               ShowMenu2()                     ; Return to the sub-menu
       ElseIf option == 1
               Return                          ; Return to the Main Menu
       EndIf

EndFunction

\;

;==============================================================

 

 

EDIT: I've re-written the code a little.

Edited by steve40
Link to comment
Share on other sites

  • Recently Browsing   0 members

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