Jump to content

Making a 'Chaos Mod' with ConsoleUtilSSE


Cridow

Recommended Posts

Thanks you guys! Moved folders, declared the arrays properly, and the script compiled :D and I'm going to test it in the game now and see if the chaos ensues :D

 

edit: GREATS NEWS! It works! Now to expand the list, and maybe figure out how I can add a message to display on the corner each time a command is activated

if i were to create a different and unique notification for each console command, should i create a different array where the index of the command is the same as the index of the message's stirng, and then have it play? is that how it would work?

Edited by Cridow
Link to comment
Share on other sites

Use Debug.Notification("text") to display a message in the upper left corner.

 

And, yes, you can have a string array index matched to your console command array. You'd do something like (shamelessly taking from dylbill's example):

Int R = Utility.RandomInt(0, ConsoleCommands.Length - 1) ;get random index for available entries in the ConsoleCommands array.
ConsoleUtil.ExecuteCommand(ConsoleCommands[R]) ;execute random console command
Debug.Notification(myStringArray[R]) ;displays index matching text string

You can define the array completely in the script or as a property.

Link to comment
Share on other sites

Use Debug.Notification("text") to display a message in the upper left corner.

 

And, yes, you can have a string array index matched to your console command array. You'd do something like (shamelessly taking from dylbill's example):

Int R = Utility.RandomInt(0, ConsoleCommands.Length - 1) ;get random index for available entries in the ConsoleCommands array.
ConsoleUtil.ExecuteCommand(ConsoleCommands[R]) ;execute random console command
Debug.Notification(myStringArray[R]) ;displays index matching text string

You can define the array completely in the script or as a property.

Woop, that's what I'm trying :^D This gives me hope

 

There is just one more thing that I'm worried about.

If I were to add a new item or npc to spawn (like, for instance, a friendly werewolf npc that uses a clown texture or something silly of that sort), how am I going to get the item or NPC code? Won't its start depend on the load order? Or is there any alternative?

Link to comment
Share on other sites

Yes IsharaMeradin is correct, that will work. For my own mods though, I started using the message form to display notifications, instead of the debug.notification() function. This is because it's easier for translators to translate your mod. You can put your messages, (that are created in the creation kit) in an array to achieve a similar effect.

Message[] Property MyConsoleMessages Auto 

Int R = Utility.RandomInt(0, ConsoleCommands.Length - 1) ;get random index for available entries in the ConsoleCommands array.
ConsoleUtil.ExecuteCommand(ConsoleCommands[R]) ;execute random console command 
ConsoleMessages[R].Show() ;display notification index for the console command exexuted
Link to comment
Share on other sites

 

Yes IsharaMeradin is correct, that will work. For my own mods though, I started using the message form to display notifications, instead of the debug.notification() function. This is because it's easier for translators to translate your mod. You can put your messages, (that are created in the creation kit) in an array to achieve a similar effect.

Message[] Property MyConsoleMessages Auto 

Int R = Utility.RandomInt(0, ConsoleCommands.Length - 1) ;get random index for available entries in the ConsoleCommands array.
ConsoleUtil.ExecuteCommand(ConsoleCommands[R]) ;execute random console command 
ConsoleMessages[R].Show() ;display notification index for the console command exexuted

For now I'll stick with the function just for the sake of testing the mod, but I might use this after I have a sizeable pool of commands! Thanks so much

Link to comment
Share on other sites

No problem. So actually, you can do what you're trying to do without using console commands, and instead papyrus functions by using states. The only reason I would use ConsoleUtil is if there's a console command you need to run that doesn't have a papyrus equivalent function. Here's how the script would look using states and papyrus functions instead:

 

Actor Property PlayerRef Auto 
ActorBase Property ActorA Auto
ActorBase Property ActorB Auto

Message[] Property FunctionMessages Auto 

Event OnInit() ;runs when the script is first loaded.
    Int RealTimeWait = Utility.RandomInt(30,60) ;picks a number between and including 30 seconds and 60 seconds
    RegisterForSingleUpdate(RealTimeWait)
EndEvent

Event OnUpdate()
    Int R = Utility.RandomInt(0, 2)
    String StateString = ("State" + R)
    GoToState(StateString) ;go to a random state defined below.
    FunctionMessages[R].Show() ;display notification index for the random function executed
    GoToState("") ;go back to the empty state so this event will fire again.
    Int RealTimeWait = Utility.RandomInt(30,60) ;picks a number between and including 30 seconds and 60 seconds
    RegisterForSingleUpdate(RealTimeWait) 
EndEvent

State State0
    Event OnBeginState() 
        PlayerRef.PlaceActorAtMe(ActorA, 30)
    EndEvent
EndState


State State1
    Event OnBeginState() 
        PlayerRef.PlaceActorAtMe(ActorB, 30)
    EndEvent
EndState 

State State2
    Event OnBeginState() 
        PlayerRef.SetScale(20.0)
    EndEvent
EndState

 

To add more functions, add more states like that that are named in the same way, and increase the 2 from Int R = Utility.RandomInt(0, 2) to reflect how many states you have. EDIT, also doing it this way you won't need to use skse as a dependency. EDIT 2, and this way you can reference your new actors directly as a property in the script.

Link to comment
Share on other sites

No problem. So actually, you can do what you're trying to do without using console commands, and instead papyrus functions by using states. The only reason I would use ConsoleUtil is if there's a console command you need to run that doesn't have a papyrus equivalent function. Here's how the script would look using states and papyrus functions instead:

 

Actor Property PlayerRef Auto 
ActorBase Property ActorA Auto
ActorBase Property ActorB Auto

Message[] Property FunctionMessages Auto 

Event OnInit() ;runs when the script is first loaded.
    Int RealTimeWait = Utility.RandomInt(30,60) ;picks a number between and including 30 seconds and 60 seconds
    RegisterForSingleUpdate(RealTimeWait)
EndEvent

Event OnUpdate()
    Int R = Utility.RandomInt(0, 2)
    String StateString = ("State" + R)
    GoToState(StateString) ;go to a random state defined below.
    FunctionMessages[R].Show() ;display notification index for the random function executed
    GoToState("") ;go back to the empty state so this event will fire again.
    Int RealTimeWait = Utility.RandomInt(30,60) ;picks a number between and including 30 seconds and 60 seconds
    RegisterForSingleUpdate(RealTimeWait) 
EndEvent

State State0
    Event OnBeginState() 
        PlayerRef.PlaceActorAtMe(ActorA, 30)
    EndEvent
EndState


State State1
    Event OnBeginState() 
        PlayerRef.PlaceActorAtMe(ActorB, 30)
    EndEvent
EndState 

State State2
    Event OnBeginState() 
        PlayerRef.SetScale(20.0)
    EndEvent
EndState

 

To add more functions, add more states like that that are named in the same way, and increase the 2 from Int R = Utility.RandomInt(0, 2) to reflect how many states you have. EDIT, also doing it this way you won't need to use skse as a dependency. EDIT 2, and this way you can reference your new actors directly as a property in the script.

Oh damn I didnt even know that was a possibility LOL. Would teleporting to cells or coordinates in the world be possible with functions too, as well as changing the timescale?

Edit: god this seems actually easier than what I was trying to do LOL

 

EDIT2: OH MAN. I could use BOTH. That way I can execute multiple console commands per state and it'd allow me to do stuff with custom actos and items as well. Holy s#*!! Thank you so much for suggesting that! :D

Edited by Cridow
Link to comment
Share on other sites

Okayy I've tested out a new script, and some things aren't working. Here is the script so far:

 

 

 

Scriptname chaostest3 extends Quest  

Actor Property PlayerRef Auto
ActorBase Property EncTrollFrost Auto
ActorBase Property EncDragonTundra Auto

Event OnInit()
    Int RealTimeWait = Utility.RandomInt(10,20) ;time in seconds
    RegisterForSingleUpdate(RealTimeWait)
EndEvent

Event OnUpdate()
    Int R = Utility.RandomInt(0, 9)
    String StateString = ("State" + R)
    GoToState(StateString) ;go to a random state defined below.
    GoToState("") ;go back to the empty state so this event will fire again.
    Int RealTimeWait = Utility.RandomInt(10,20);time in seconds
    RegisterForSingleUpdate(RealTimeWait)
EndEvent

State State0
    Event OnBeginState()
        PlayerRef.PlaceActorAtMe(EncDragonTundra , 30)
        Debug.Notification("state0")
    EndEvent
EndState


State State1
    Event OnBeginState()
        PlayerRef.PlaceActorAtMe(EncTrollFrost, 30)
        Debug.Notification("state1")
    EndEvent
EndState

State State2
    Event OnBeginState()
        PlayerRef.SetScale(15.0)
        Debug.Notification("state2")
    EndEvent
EndState

State State3
    Event OnBeginState()
         ConsoleUtil.ExecuteCommand("coc Riverwood")
         Debug.Notification("state3")
    EndEvent
EndState

State State4
    Event OnBeginState()
         ConsoleUtil.ExecuteCommand("coc ThroatoftheWorldExterior")
         Debug.Notification("state4")
    EndEvent
EndState

State State5
    Event OnBeginState()
         ConsoleUtil.ExecuteCommand("player.placeatme 00064B33 150")
         Debug.Notification("state5")
    EndEvent
EndState

 

 

 

State2 gives off the notification, but doesn't change the player's scale. States 0 and 1give the notification but dont spawn the dragons or trolls :sad:

 

EDIT: Im stupid and forgot to assign values to the properties LOL

Edited by Cridow
Link to comment
Share on other sites

  • Recently Browsing   0 members

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