Jump to content

[LE] Problem with displaying debug notifications and casting spells on player


Recommended Posts

Good afternoon, I have a problem with displaying debug notifications and casting spells on player. I made kind of magic altar with activator and script which should, when you click on the activator, show a menu on the screen in which you can choose one of three options and get a temporary magic effect. So far, I've managed to get only one option from the menu to give out a magic effect and show debug notification. I can't cram two Event OnActivate into one script, and I also can't make two separate scripts with these events, since only one still works

 

When I try to make a function with IntButton and Elseif then I don't have any debug notification displayed at all despite the fact that when compiling the script, I don't get any errors

I'm just lost in guesses and don't know what to do with it and how to make my altar works correctly

Link to comment
Share on other sites

Event OnActivate(ObjectReference akActionRef)
Bool ShowMenu = akActionRef.GetFormID() == 0x14 && WhateverOtherConditionsYouWant()
If ShowMenu
Int Prompt = WhateverMessage.Show()
If Prompt == 1; Choice 1
EffectOne.Cast(akActionRef)
Debug.Notification("You have gained " + EffectOne.GetName())
ElseIf Prompt == 2; Choice 2
EffectTwo.Cast(akActionRef)
Debug.Notification("You have gained " + EffectTwo.GetName())
ElseIf Prompt == 3; Choice 3
EffectThree.Cast(akActionRef)
Debug.Notification("You have gained " + EffectThree.GetName())
EndIf
EndIf
EndEvent

 

Above assumes choice 0 is set to cancel so adapt as desired. This also assumes you named your effects so again tailor as wanted

Link to comment
Share on other sites

Thanks for the help! And taking this opportunity, I want to ask: is it possible to make each of these three options give out two more spells in random order and show the corresponding debug notifications? Is it possible to add something to the script for this?

It seems to me that this is an impossible thing, but nevertheless

Link to comment
Share on other sites

  • 2 weeks later...

GetName requires skse. If you don't want to use skse, replace GetName with a string such as "Ability A". You can also use a string property and set it's value in the creation kit.

 

String Property AbilityNameA Auto

 

Debug.Notification("You have gained " + AbilityNameA)

 

Although, I would recommend just using another message form that's not a message box to display the notification. Reason being it makes your mod easier to translate, and with debug.notification sometimes doesn't display capitals correctly.

Link to comment
Share on other sites

String format is just a Bethesda quirk. If the engine has already declared a string in a certain context it doesnt change between upper and lower if it sees that string again

 

A somewhat reliable workaround is to declare a Read Only String Property where it is the visually preferred format. Couple other tricks too but I havent scripted for a while so dont remember them but the readonly thing is good

Link to comment
Share on other sites

  • Recently Browsing   0 members

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