Jump to content

Help to make message boxes allow text for a mod


Recommended Posts

Hello, me and my friend are doing a mod.

It's going to be a dreaming mod, which allows the player to have nightmares and or dreams whenever they sleep in a bed. They will also have buffs depending upon what dream they have.

 

This is also going to have an mcm for configuration, will use actual 'real-life' dream symbols (like reading a book symbolizes a need for knowledge) all while still being lore friendly, having skyrim and elder lore event related topics

-------------

Well that's the concept, what we're having trouble with, is we're having trouble making message boxes allow text for the prompts that pop up, describing the dream.

 

If somebody knows how to do this, or knows ANYTHING to help us please get this awesome mod to work, please post, pm me, or do both. We would greatly appreciate it... :(

Link to comment

What kind of trouble can there be with message boxes?

You just create MessageBox in CK, and call it by a simple script like

HelloWorld.Show()

where "HelloWorld" is a property of your message box.

 

Whole script shall be looks like

Scriptname DreamScript extends activemagiceffect  

Actor Property Player  Auto  
SPELL Property DreamController  Auto  
Message Property DreamMessageBox00  Auto  
Message Property DreamMessageBox01  Auto  
SPELL Property AfterDreamEffect00  Auto  
SPELL Property AfterDreamEffect01  Auto  

Event OnPlayerLoadGame()
    If Game.GetPlayer().HasSpell (DreamController) == true        ;checking for Dream SpellController (this spell), if player have one - re-applying it
        Game.GetPlayer().RemoveSpell(DreamController)
        Game.GetPlayer().AddSpell(DreamController, false)
    endif
EndEvent

Event OnEffectStart(Actor akTarget, Actor akCaster)
    akTarget.RegisterForSleep()                                             ; Before we can use OnSleepStart we must register.
endEvent

Event OnSleepStop(bool abInterrupted)
    int random = Utility.RandomInt(0, 30)                       ;get random number from 0 up to 30
        if random == 0                                                
            DreamMessageBox00.Show()                            ;show 00 message box with dream description
            Game.GetPlayer().AddSpell(AfterDreamEffect00)       ;apply 00 spell with after-dream effect    
        elseif random == 1
            DreamMessageBox01.Show()                            ;show 01 message box with dream description and so on - up to 30 dreams
            Game.GetPlayer().AddSpell(AfterDreamEffect01)
        endif
endEvent

I think it should work (but i don't test it ingame).

Just attach this script to the effect that will be attached on the player.

 

And sorry about my bad english =)

Link to comment

 

 

 

 

What kind of trouble can there be with message boxes?

You just create MessageBox in CK, and call it by a simple script like

HelloWorld.Show()

where "HelloWorld" is a property of your message box.

 

Whole script shall be looks like

Scriptname DreamScript extends activemagiceffect  

Actor Property Player  Auto  
SPELL Property DreamController  Auto  
Message Property DreamMessageBox00  Auto  
Message Property DreamMessageBox01  Auto  
SPELL Property AfterDreamEffect00  Auto  
SPELL Property AfterDreamEffect01  Auto  

Event OnPlayerLoadGame()
    If Game.GetPlayer().HasSpell (DreamController) == true        ;checking for Dream SpellController (this spell), if player have one - re-applying it
        Game.GetPlayer().RemoveSpell(DreamController)
        Game.GetPlayer().AddSpell(DreamController, false)
    endif
EndEvent

Event OnEffectStart(Actor akTarget, Actor akCaster)
    akTarget.RegisterForSleep()                                             ; Before we can use OnSleepStart we must register.
endEvent

Event OnSleepStop(bool abInterrupted)
    int random = Utility.RandomInt(0, 30)                       ;get random number from 0 up to 30
        if random == 0                                                
            DreamMessageBox00.Show()                            ;show 00 message box with dream description
            Game.GetPlayer().AddSpell(AfterDreamEffect00)       ;apply 00 spell with after-dream effect    
        elseif random == 1
            DreamMessageBox01.Show()                            ;show 01 message box with dream description and so on - up to 30 dreams
            Game.GetPlayer().AddSpell(AfterDreamEffect01)
        endif
endEvent

I think it should work (but i don't test it ingame).

Just attach this script to the effect that will be attached on the player.

 

And sorry about my bad english =)

 

 

 

There are a couple of problems in your script.

The events you are calling are valid just for a ReferenceAlias, but the script is for MagicEffect.

 

It should be like:

 

 

 

 
Scriptname DreamScript extends ReferenceAlias

Actor Property PlayerRef Auto  
Message[] Property DreamMessages  Auto  
SPELL[] Property AfterDreamEffects  Auto  

Event OnPlayerLoadGame()
   PlayerRef.RegisterForSleep() ; "Before we can use OnSleepStart we must register."
EndEvent

Event OnSleepStop(bool abInterrupted)
    int random = Utility.RandomInt(0, DreamMessages.length - 1) ; "get random number from 0 up to the number of messages in the array"
    DreamMessages[random].Show() ; "show one of the messages box with dream description"
    AfterDreamEffects[random].Cast(PlayerRef, PlayerRef) ; "apply one of the spells with after-dream effect to the player"
endEvent
 
Link to comment

There are a couple of problems in your script.

The events you are calling are valid just for a ReferenceAlias, but the script is for MagicEffect.

Well, seems you are right.

 

I'm not so experience in scripting after all, i'm still learning =)

Link to comment

Hey, I'm the guy making this.

 

There is no problems with the MessageBoxes, it's just the fact that they have a hard limit of (according to CPU) 180 characters.

I don't think there is a way arround that, so I'm basically just looking for another way to display the text fully, although there probably is none.

 

I thought of using Books instead, but can't get them to activate reliably. Current plan is to just stick to MessageBoxes but split them up with a page system, or just go for shorter stories.

lefttounge isn't too fond of splitting them up, as it "decreases tension", so if nobody knows of another way to display long text we'll be going with short stories instead.

 

If you do know another way, I'd appreciate input.

Link to comment

...

 

The only other way I can think of is to create an SWF widget that accepts text.

 

But will require doing some SWF creation and integration with the SkyUI widget system.

Apropos uses this way. Maybe you can contact its author and ask for help.

Link to comment

It depends on the way you will "show" your dreams.

 

MessageBoxes are limited, as Dialogues.

 

You can use the Debug.MessageBox with Papyrus, this one can accept up to 2047 characters. But it has a very bad appearance in the game.

 

Or you can try to add a widget that shows the text. In this case, ask @gooser for help.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use