Talk:Portal:Scripting

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search

Script Saving Bug[edit source]

Okay, I'm new to this whole modding business, so if this is the wrong place to say this please forgive me. Anyway, i've been working on a script for a certain quest I am making. I typed the script up, got a few save errors but fixed them. So now my problem is that when I go to save it nothing happens. When I try to exit out of the window it asks if I want to save the script. If I choose yes nothing happens. If I choose no it exits out the script editing window and the script reverts back to the previous state. Here is the script if it helps.

ScriptName MazonMalkorDialogBox

Short Button
Short ButtonPressed
Short Button2
Short ButtonPressed2
Short Button3
Short ButtonPressed3
Short DoOnce

Begin OnActivate
 If ( GetStage BCIExploringBeastClawIsland <= 5 )
  MessageBox "A pleasure to meet with you, i'm Mazon Malkor. I'm a sailor from Beast Claw Island, a beautiful island off the shore of Anvil. But I, a sailor at heart yearned to explore the world, and found the town of Anvil during my adventures. But, the sea calls to me, and I must leave soon. I'll be heading back to Beast Claw Island soon, and I would be willing to take you with me when I leave. Take some time to think about my offer and come back when you've decided."
  Set DoOnce to 1
  SetStage BCIExploringBeastClawIsland 5
 EndIf
 If ( GetStage BCIExploringBeastClawIsland == 6 )
  MessageBox "Have you made a decision, will you be joining me?", "Yes", "No"
  Set ButtonPressed to 1
 EndIf
End

Begin GameMode
 If ( DoOnce == 1 )
  SetStage BCIExploringBeastClawIsland 6
 EndIf
End

Begin GameMode
 If ( ButtonPressed == 0 )
  Return
 EndIf
  Set Button to GetButtonPressed
   If ( Button > -1 )
    If ( Button == 1 )
     Return
     Set ButtonPressed to 0
    ElseIf ( Button == 0 )
     Player.MoveTo BeastClawDockMazonMalkor
     Set ButtonPressed to 0
     MessageBox "If you ever want to go back to Anvil come see me, i'll be glad to be out to sea again."
     SetStage BCIExploringBeastClawIsland 10
    EndIf
   EndIf
 EndIf
End

Begin OnActivate
 If ( GetStage BCIExploringBeastClawIsland >= 10 )
  If ( Player.GetInWorldSpace BeastClawIsland !=1 )
   Return
  Else
   MessageBox "Do you want to go back to Anvil?", "Yes", "No"
   Set ButtonPressed2 to 1
  EndIf
End

Begin GameMode
 If ( ButtonPressed2 == 0 )
  Return
 EndIf
  Set Button2 to GetButtonPressed
   If ( Button > -1 )
    If ( Button == 1 )
     Return
     Set ButtonPressed to 0
    ElseIf ( Button == 0 )
     Player.MoveTo AnvilDockMazonMalkor
     Set ButtonPressed2 to 0
    EndIf
   EndIf
 EndIf
End

Begin OnActivate
 If ( GetStage BCIExploringBeastClawIsland >= 10 )
  If ( Player.GetInWorldSpace BeastClawIsland == 1 )
   Return
  ElseIf
   MessageBox "Do you want to go to Beast Claw Island?", "Yes", "No"
   Set ButtonPressed3 to 1
  EndIf
End

Begin GameMode
 If ( ButtonPressed3 == 0 )
  Return
 EndIf
  Set Button3 to GetButtonPressed
   If ( Button > -1 )
    If ( Button == 1 )
     Return
     Set ButtonPressed3 to 0
    ElseIf ( Button == 0 )
     Player.MoveTo AnvilDockMazonMalkor
     Set ButtonPressed to 0
    EndIf
   EndIf
 EndIf
End

--Jordanrooben 21:34, 2 February 2011 (EST)

It's not entirely the wrong place (about as good a place as any on the Wiki), but usually requests for people to go over issues specific to your mod (read your quest, troubleshoot your process, etc etc) should go on the Forums. You're more likely to get a more accurate answer there more quickly than you are anywhere on the Wiki for that sort of thing. Questions on the Wiki really ought to be about the Wiki - stuff like "what does this section mean?" or "I think this paragraph is wrong, how can we test it?"
Anyway, I hope you find help on the forums, and I hope the Wiki may continue to help you learn how to mod.
Dragoon Wraith TALK 09:35, 4 February 2011 (EST)

Scripting Portal[edit source]

This is awesome. Just sayin'.
Dragoon Wraith TALK 20:05, 14 January 2008 (EST)

Trying a few things, that's it for tonight, feel free to make your own changes (anyone).
--Qazaaq 20:08, 14 January 2008 (EST)
A few thoughts: I kind-of preferred the editable boxes to the templates. Should the 'What you can do?' list be on the portal, or should it be on a separate page (and a link on the portal)? It would be great if we could have a 'Scripting Dump' category where every page believed to contain scripting information can be placed. This would help immensely when reorganizing the Scripting category.--Haama 17:34, 16 January 2008 (EST)
With the templates I tried to remove the information from the page that wouldn't need frequent updating. I guess I wasn't really thinking, because the to do list is exactly the opposite. I moved it back.
--Qazaaq 18:40, 16 January 2008 (EST)

No Fluff Scripting Portal[edit source]

Moved from the Community Portal. --Wrye 21:30, 29 June 2008 (EDT)

I'm creating a no fluff scripting portal. This is sort of public sandbox. If it's well received, this could take the place of the current portal. --Wrye

Done. Check it out. --Wrye 02:18, 1 June 2008 (EDT)
Personally, I think the scripting Portal needs something like this. The Portal design used for other things doesn't seem to work well with Scripting (or maybe at all) - Seems that too often, there's not really places for things.
That said, the Portal design does do well in visual flair (not insignificant; it does draw a users attention to the fact that it is a special page) and in compactness (perhaps not a good thing however). I also think that there some things which would make sense to have on the side, perhaps... I will look into the page more in-depth, and I may try some changes.
Dragoon Wraith TALK 11:38, 1 June 2008 (EDT)
Scripting needs to be re-done in general, no face lifts are going to fix that. Both ways are good, and have their own advantages (Portal probably better for those just getting into scripting, NF for vets). Hmm... two suggestions
  1. Make a NF page that is automatically created from the portal information. Essentially this would be a list form of the portal instead of boxes. Maybe we could find a way to include the description somewhere on the page in a "No include" section.
  2. Make a navigation map as DW did for Functions.--Haama 17:12, 2 June 2008 (EDT)
Re Visual Flair: Portals (e.g. Portal:Arts are graphically designed to be eye candy - they're meant to draw in casual browsers, i.e. people who are just poking around. But the eclectic design ends up being vary counter to people who are more focussed, and are looking for particular information (i.e. the vast majority of CS Wiki users).
In contrast, see a typical information hierarchy at UESP:
  • Main Page (Main Page. Portalish, except for simple index on left side of screen.)
  • Oblivion (Index page. Oblivion users likely bookmark this instead of main page.)
  • Oblivion Quests (Index page)
  • DB Quests (Content page)
So assuming that user starts at oblivion page, then they've got just two index pages before they hit conten page (Dark Brotherhood). This sort of hierarchy makes it very easy to find info. Note that UESP also provide the bread crumb trails (links at top right of page) that serve the dual purpose of letting you know where you are in the hierarchy and allowing you to go back up the hierarchy easily.
Note in particular that UESP doesn't have a site map (i.e. nothing like Functions Navigation Map). The information hierarchy is clear and simple enough that it doesn't need one. (I should mention, that this sort of simplicity and easy navigation did not just happen accidentally. :)) If you're having to do a site map like that, then you know that the information hierarchy is out of control.
IMO, CSWiki does not have enough casual users to cater to. Unlike browsing an encyclopedia, modding is a complicated dedicated process. Users of this wiki arent' casual browsers, they're people looking to find specific information. The site should make that as easy as possible.
And while you might say "support both", there are two costs for doing that: 1) doing both means doubling the amount of maintenance work in order to maintain both pages, and 2) doing both adds more index pages -- which leads to users getting lost in the thicket of index pages.
Re automatic generation of ScriptingNF: The whole point of such pages (as opposed to Category pages), is that you can't generate them automatically. To get a really useful index page, someone has to go through, figure out: how to divide up the page, what pages to put where, which pages to ignore or downplay, what sort of list to use, what to indent and where, when to add some descriptive text and what. The process of doing typically also leads to some article cleanup (proding, renaming, deprecating, etc.). Doing something like this is like organizing a room. Once in a while you make a grand effort. After that you do incremental additions/changes, and then maybe after a year or so, another grand cleanup. The grand cleanup is a bit of work, but it pays off by providing very easy access to information.
Re Function categorization: Bash will be able to generate categorized pages once more category info has been entered. I think that these will be able to take the place of the most of the pages like CS 1.0 Actor functions, and therefore, those categories can be eliminated. (Here the reason for elimination is to get cut down on the bewildering thicket of index/category pages.)
Summary: My recommendations.
  • Replace current scripting portal with ScriptingNF.
  • Decategorize pages. In particular, discard most of the function categories.
  • Introduce bread crumb/topic trails to clarify the information hieararchy.
--Wrye 19:59, 2 June 2008 (EDT)

Update: I've gone ahead and done the replacement as suggested above. If this sticks as worth keeping, then the old ScriptingNF page can be deleted. --Wrye 21:30, 29 June 2008 (EDT)

Script Question[edit source]

I hope this is in the right place... but long story short, I want to make a Necromancer companion that can resurrect himself if he dies. The thing is, I want for him to wait until after all combat ends for him to resurrect. Is there any way I can do this? Thanks!

Rethinking it, I think it would be best for some kind person to fill in the blanks, so I can copy and paste. It looks right now,

"scn NecromancerCScript

begin OnDeath

Necromancer.Resurrect

Message "Necromancer has died. Due to being immortal, he will resurrect shortly."

end" --Arch-Mage Matt 21:54, 4 August 2010 (EDT)

To post code on the Wiki, either encase it in <pre></pre> tags, or start each line with a space (including blanks), like I've done here with yours:
scn NecromancerCScript

begin OnDeath

  Necromancer.Resurrect

  Message "Necromancer has died. Due to being immortal, he will resurrect shortly."

end
Also, indenting is always a good idea. Anyway, to give you a very general answer to this, my approach would be to use an invisible, persistent activator to cast a silent, invisible scripted spell when he dies, and to continue to do so every few seconds until everything hit by the spell returns false on a GetCombatTarget == player check (i.e. there are no actors in range that are considered to be in combat with the player). Once that happens, you can freely resurrect the guy. If you need more specific instruction than that, I suggest that you start a thread on the Forums - while we're happy to help here with general scripting questions, walking you through an entire script would be a little much for this page. Feel free to link to any thread you start, though, and I'll take a look at it. I think this is a really cool idea and I don't think I've heard of any companion with this feature.
Oh, also, you don't need to use Necromancer.Resurrect (and in any case I'd recommend a more unique EditorID, but that's probably just my history modding Morrowind talking) - assuming this script is attached to the Necromancer (which it must be for OnDeath to work correctly), you can just use Resurrect 1 (you need the 1 to have him play the animation of sitting up; not doing so causes a crash IIRC), without the Necromancer. part. This is because functions always assume the reference they're attached to if none is given.
Dragoon Wraith TALK 00:17, 5 August 2010 (EDT)
Late reply, but thanks. I was just using Necromancer as an example because I wasn't sure of a name for him yet.
But I have another question: Is there anywhere on the site where I can find a good, simple, inventory share on a specific NPC? Thanks again. --Arch-Mage Matt
I haven't read it, but there is the Simple Companion Tutorial... which a quick Find reveals does not get into how to do that, but links to a Easy Companion mod that has the requisite scripts for use. I have no idea how well done that mod is or if there are any better things to use. Again, I'll have to recommend asking on the mod forums for suggestions on what to use for that. Companions scripts get rather complicated; re-using a pre-made script is almost certainly the best answer here (obviously, you'll want to tweak it).
Dragoon Wraith TALK 00:54, 19 August 2010 (EDT)

Help please[edit source]

I would like to do a spell that causes the player to turn into a Xivilai and turn back again to normal if the spell is used again, Ive been searching to do this kind of spell but no luck, could somebody explain me here the steps please? I would appreciate it, thank you :)

That is going to be very hard; Oblivion doesn't handle shapechanging well at all (at least not for humanoids). There are a couple of ways to attempt it, but none is simple enough to just give you a few steps to follow.
The first is to create 'armor' that looks like a Xivilai, and force the player to equip that while the spell is active — by definition, this is going to remove the other armor that they have equipped, though. You could use still more code to apply the statistics of the player's actual armor to the fake Xivilai armor, though. This is the "easier" of the two options, but it has limitations both in appearance and in function. You also will probably have to make the Xivilai armor yourself, which will not be easy.
The other thought would be to use a Xivilai race mod (I believe AlienSlof did one), and then use Wrye Morph and/or Breeze582000's Succubi/Seducers mod to change the player's race to that Xivilai race. This is the "better" solution because it actually changes the player's race and doesn't fiddle with fake equipment. However, the problems here are huge — you're relying on material from other authors who are going to (all three) be difficult to contact, and may not give you permission to use their material (and yes, you absolutely must get explicit permission to use any modder's material in any mod you plan to release — if you can't find someone, and they didn't specify that you were allowed to use it in their readme, then you're SOL, I'm afraid — you can't use it). Even if you do get permission, Wrye Morph is notoriously strictly beta-only. Using those features in an actual mod is risky, as they are very complicated, difficult to set up for the user, and are far from fool-proof.
Sorry that this is so complicated, but there's really very little support for this in Oblivion, so you're pretty much on your own to try to make this happen.
Dragoon Wraith TALK 15:52, 27 April 2011 (EDT)


Thanks for your help Dragoon, and yes it does seem very complicated, I would scr*w up my Oblivion in two minutes trying to do that, but thanks a lot that you took your time to explain :) Actually, I did try a beta mod that shapechanges you, it worked horrible, you couldnt change back to normal, camera is horrible, functions and controls too, you dont feel like you are the creature, simply a disaster, its a real shame, but you are right, in morrowind shapechanging worked better, anyway, thanks again Dragoon :)