Chargen Scripting

Post » Sun May 01, 2011 4:10 pm

Hi all.

I'm making a chargen script and it's refusing to work. I have all the menus and correct 'state' coding in there, and when the script starts the name window pops up like it's meant to. Just like the name menu in actual Morrowind. You can't move around (which is good). HOWEVER, you can still look around, resulting in their being a crosshair, no cursor. Which means you're unable to input your name, so the script never resolves.

Does anyone know what I've done wrong?
User avatar
Farrah Lee
 
Posts: 3488
Joined: Fri Aug 17, 2007 10:32 pm

Post » Sun May 01, 2011 9:42 pm

you'll probably need to post your script so people can see what you done.
User avatar
Cash n Class
 
Posts: 3430
Joined: Wed Jun 28, 2006 10:01 am

Post » Sun May 01, 2011 4:16 pm

Are you using the EnableNameMenu command? Also, posting your script will help in debugging it.
User avatar
trisha punch
 
Posts: 3410
Joined: Thu Jul 13, 2006 5:38 am

Post » Sun May 01, 2011 4:00 pm

Sure, sorry. I'm new here and didn't want to clutter it up. Script is:

begin CharGen

short state


DisablePlayerControls
DisablePlayerJumping
DisablePlayerViewSwitch
DisableVanityMode
DisablePlayerFighting
DisablePlayerMagic



Player->PositionCell 4100, 4100, -27, 24, "Castle-town"

Set CharGenState to 1

if ( State == 1 )
EnableNameMenu
set State to 12
endif

if ( State == 12 )
if (SayDone == 1)
EnableRaceMenu
set State to 14
endif

endif

if ( State == 14 )
if (SayDone == 1)
EnableClassMenu
set State to 16
endif

endif

if ( State == 16 )
if (SayDone == 1)
EnableBirthMenu
set State to 18
endif

endif

if ( State == 18 )
if (SayDone == 1)
EnableStatReviewMenu
set State to 20
endif

endif

set CharGenState to -1

stopscript CharGen

end CharGen
User avatar
KRistina Karlsson
 
Posts: 3383
Joined: Tue Jun 20, 2006 9:22 pm

Post » Mon May 02, 2011 4:43 am

You're hammering the menus, which causes them all to pop at once and lose focus. Add this to your script, just before the if ( state == 1 ) line:
If ( MenuMode )    ReturnEndif

User avatar
Trevi
 
Posts: 3404
Joined: Fri Apr 06, 2007 8:26 pm

Post » Sun May 01, 2011 8:35 pm

Do you mean directly put it in as ( MenuMode ) or do I replace it with the name of the next Menu in line? Cos my menu's haven't ever popped up all at once since I put in the State checks
User avatar
Andrew Lang
 
Posts: 3489
Joined: Thu Oct 11, 2007 8:50 pm

Post » Sun May 01, 2011 4:03 pm

Do just as it's said: put MenuMode bugout block just before Player->PositionCell

You don't see all the menus, because they conflict with each other, loosing focus - that's why You are unable to do anything at all...

Better yet, check if ( MenuMode == 1 ) - that's better and less buggy practice.
User avatar
Javaun Thompson
 
Posts: 3397
Joined: Fri Sep 21, 2007 10:28 am

Post » Sun May 01, 2011 2:37 pm

That did nothing, except that now even the Name menu doesn't appear. Also, since i've been working on the world lately, I've now noticed that the pc starts at Wilderness 0,0, ignoring the line in my scrip which places him elsewhere. here's the slightly revamped script


begin CharGen

short state


DisablePlayerControls
DisablePlayerJumping
DisablePlayerViewSwitch
DisableVanityMode
DisablePlayerFighting
DisablePlayerMagic



Player->PositionCell 4100, 4100, -28, 24, "Castle-town"

If ( MenuMode == 1 )
Return
Endif

Set CharGenState to 1




if ( State == 1 )
EnableNameMenu
set State to 2
endif

if ( State == 2 )
if (SayDone == 1)
EnableRaceMenu
set State to 4
endif

endif

if ( State == 4 )
if (SayDone == 1)
EnableClassMenu
set State to 6
endif

endif

if ( State == 6 )
if (SayDone == 1)
EnableBirthMenu
set State to 8
endif

endif

if ( State == 8 )
if (SayDone == 1)
EnableStatReviewMenu
endif

endif

set CharGenState to -1

stopscript CharGen

end CharGen
User avatar
teeny
 
Posts: 3423
Joined: Sun Feb 25, 2007 1:51 am

Post » Mon May 02, 2011 12:06 am

What's with the SayDone?? Is there another script for voices or what? How does it tie in with this?

Also - just checking menumode isn't enough, you need a delay to make sure menumode registers properly, at least for some of the menus.
User avatar
Adam Porter
 
Posts: 3532
Joined: Sat Jun 02, 2007 10:47 am

Post » Mon May 02, 2011 3:17 am

Oh blast, I'd forgotten to take SayDone out when I deleted the sound files I'd made. I'll delete them now lol

And how do i ensure there's a delay?
User avatar
kristy dunn
 
Posts: 3410
Joined: Thu Mar 01, 2007 2:08 am

Post » Sun May 01, 2011 3:20 pm

Well here's my quick char gen for mod testing:
begin CharGen;chargenstate 1 start -1 finishedfloat timerif ( CharGenState == 1 )	DisablePlayerControls	DisablePlayerJumping	DisablePlayerViewSwitch	DisableVanityMode	DisablePlayerFighting	DisablePlayerMagic	Player->PositionCell -10608, -71301, 189, 0 "Seyda Neen (-2, -9)"	ChangeWeather "Bitter Coast Region" 1 ;sets beginning weather to cloudy, looks nicer	set CharGenState to 10	returnendifif ( MenuMode == 1 )	returnendifif ( CharGenState == 10 )	EnableNameMenu	set CharGenState to 20	returnelseif ( CharGenState == 50 )	EnablePlayerControls	enablestatsmenu	enableinventorymenu	enablemagicmenu	enablemapmenu	enableplayerfighting	enableplayermagic	EnablePlayerJumping	set CharGenState to 60	returnelseif ( CharGenState == 60 )	enablestatsmenu	enableinventorymenu	enablemagicmenu	enablemapmenu	enableplayerfighting	enableplayermagic	AddTopic "background"	AddTopic "Balmora"	AddTopic "Caius Cosades"	AddTopic "duties"	AddTopic "my trade"	AddTopic "the Empire"	AddTopic "Uriel Septim"	ShowMap "Balmora"	ShowMap "Pelagiad"	ShowMap "Moonmoth Legion Fort"	journal "A1_1_FindSpymaster" 1	player->AddItem "bk_a1_1_caiuspackage" 1	player->AddItem "bk_a1_1_directionscaiuscosades" 1	"chargen door hall"->unlock	set CharGenState to -1	stopscript CharGen	returnendifif ( timer < 1 )	set timer to ( timer + GetSecondsPassed )	returnendifset timer to 0if ( CharGenState == 20 )	Enableracemenu	set CharGenState to 25	returnelseif ( CharGenState == 25 )	EnableClassMenu	"CharGen Boat"->Disable	"CharGen Boat Guard 1"->disable	"CharGen Boat Guard 2"->disable	"CharGen Dock Guard"->disable	"CharGen_cabindoor"->disable	"CharGen_chest_02_empty"->disable	"CharGen_crate_01"->disable	"CharGen_crate_01_empty"->disable	"CharGen_crate_01_misc01"->disable	"CharGen_crate_02"->disable	"CharGen_lantern_03_sway"->disable	"CharGen_ship_trapdoor"->disable	"CharGen_barrel_01"->disable	"CharGen_barrel_02"->disable	"CharGenbarrel_01_drinks"->disable	"CharGen_plank"->disable	set CharGenState to 30	returnelseif ( CharGenState == 30 )	EnableBirthMenu	set CharGenState to 40	returnelseif ( CharGenState == 40 )	EnableStatReviewMenu	set CharGenState to 45	returnelseif ( CharGenState == 45 )	StartScript RaceCheck	EnableStatsMenu	EnablePlayerViewSwitch	EnableVanityMode	EnableMagicMenu	EnableRest	set CharGenState to 50	returnendifend


This could definitely be tweaked with the timing - just for appearances, it works as it is. I just didn't care how it looked when I wrote it, since it's only for testing stuff.
User avatar
Anthony Diaz
 
Posts: 3474
Joined: Thu Aug 09, 2007 11:24 pm

Post » Sun May 01, 2011 9:04 pm

See, most of that didn't quite make sense to me. i understood pretty much all the commands, but not really the meaning. I'm new to scripting for MW, see.
User avatar
Ezekiel Macallister
 
Posts: 3493
Joined: Fri Jun 22, 2007 12:08 pm

Post » Sun May 01, 2011 6:56 pm

Same script with comments - hopefully that will make it clearer - and also changed the state var values so it's clearer (look at what happens in the order that it happens - the blocks are executed in order 1,2,3,4 etc, even though they're not in that order in the script).
begin CharGen;chargenstate 1 start -1 finishedfloat timerif ( CharGenState == 1 )  ;CharGenState is set by the engine when you start a new game	DisablePlayerControls  ;disable everything until chargen is done	DisablePlayerJumping  ;not sure if all this is necessary but you at least	DisablePlayerViewSwitch  ;   need to stop the player looking at themselves	DisableVanityMode  ;    (inventory, vanity mode, fighting, spellcasting)	DisablePlayerFighting  ;    - since they'll have default appearance	DisablePlayerMagic	Player->PositionCell -10608, -71301, 189, 0 "Seyda Neen (-2, -9)" ;puts player in the world	ChangeWeather "Bitter Coast Region" 1 ;sets beginning weather to cloudy, looks nicer	set CharGenState to 2	return  ;wait until next frame to do next bitendifif ( MenuMode == 1 )  ;nothing from here on gets done in menumode	returnendifif ( CharGenState == 2 )	EnableNameMenu  ;one menu at a time	set CharGenState to 3	return  ;wait until next frame, this makes it go through the menumode check	;state 3 is after the timer (lower down!)elseif ( CharGenState == 8 )	EnablePlayerControls	enablestatsmenu	enableinventorymenu	enablemagicmenu	enablemapmenu	enableplayerfighting	enableplayermagic	EnablePlayerJumping	set CharGenState to 9	returnelseif ( CharGenState == 9 )	enablestatsmenu  ;a number of enable commands are repeated a few times - Bethesda did this	enableinventorymenu  ;just to make sure, I figured it was a good idea to imitate them	enablemagicmenu	enablemapmenu	enableplayerfighting	enableplayermagic	AddTopic "background"  ;this part just adds things you'd get if you went through	AddTopic "Balmora"  ;   chargen the normal (slow) way	AddTopic "Caius Cosades"	AddTopic "duties"	AddTopic "my trade"	AddTopic "the Empire"	AddTopic "Uriel Septim"	ShowMap "Balmora"	ShowMap "Pelagiad"	ShowMap "Moonmoth Legion Fort"	journal "A1_1_FindSpymaster" 1	player->AddItem "bk_a1_1_caiuspackage" 1	player->AddItem "bk_a1_1_directionscaiuscosades" 1	"chargen door hall"->unlock	set CharGenState to -1  ;chargen is finished	stopscript CharGen	returnendifif ( timer < 1 )  ;wait 1 second in addition to menumode check	set timer to ( timer + GetSecondsPassed )	returnendifset timer to 0  ;reset timer for next timeif ( CharGenState == 3 )	Enableracemenu	set CharGenState to 4	returnelseif ( CharGenState == 4 )	EnableClassMenu	"CharGen Boat"->Disable  ;this part just gets rid of the prison ship etc	"CharGen Boat Guard 1"->disable	"CharGen Boat Guard 2"->disable	"CharGen Dock Guard"->disable	"CharGen_cabindoor"->disable	"CharGen_chest_02_empty"->disable	"CharGen_crate_01"->disable	"CharGen_crate_01_empty"->disable	"CharGen_crate_01_misc01"->disable	"CharGen_crate_02"->disable	"CharGen_lantern_03_sway"->disable	"CharGen_ship_trapdoor"->disable	"CharGen_barrel_01"->disable	"CharGen_barrel_02"->disable	"CharGenbarrel_01_drinks"->disable	"CharGen_plank"->disable	set CharGenState to 5	returnelseif ( CharGenState == 5 )	EnableBirthMenu  ;note that since all of these are below the timer, they all wait 1 second	set CharGenState to 6	returnelseif ( CharGenState == 6 )	EnableStatReviewMenu	set CharGenState to 7	returnelseif ( CharGenState == 7 )	StartScript RaceCheck  ;RaceCheck script sets global used in dialgoue to check PC race	EnableStatsMenu  ;need to re-enable everything that was disabled at start	EnablePlayerViewSwitch	EnableVanityMode	EnableMagicMenu	EnableRest	set CharGenState to 8	returnendifend

User avatar
Margarita Diaz
 
Posts: 3511
Joined: Sun Aug 12, 2007 2:01 pm

Post » Mon May 02, 2011 1:07 am

Ah! So, essentially, if I place the Menumode check at the top and put a return function into each block, and get the timer working just after it, my problems should be solved?

I also can't figure out why my placement isn't working
User avatar
Carlos Vazquez
 
Posts: 3407
Joined: Sat Aug 25, 2007 10:19 am

Post » Sun May 01, 2011 2:05 pm

Yep, that sounds right.

Placement - you mean putting the player in the world? A couple of things, most important is the format is inconsistently fussy - sometimes this will work:
Player->PositionCell -10608 -71301 189 0 "Seyda Neen (-2, -9)"

but sometimes it needs this instead:
Player->PositionCell -10608 -71301 189 0 "Seyda Neen"

If it just silently fails, it's usually the format.

Other thing is that some people have reported that you need to add the starting cell to the ini preload cells. Other people have been fine without doing this, but it's possible for it to be system-dependent, so I guess it's worth a try.
User avatar
Tessa Mullins
 
Posts: 3354
Joined: Mon Oct 22, 2007 5:17 am

Post » Sun May 01, 2011 6:39 pm

Yep, that sounds right.

Placement - you mean putting the player in the world? A couple of things, most important is the format is inconsistently fussy - sometimes this will work:
Player->PositionCell -10608 -71301 189 0 "Seyda Neen (-2, -9)"

but sometimes it needs this instead:
Player->PositionCell -10608 -71301 189 0 "Seyda Neen"

If it just silently fails, it's usually the format.

Other thing is that some people have reported that you need to add the starting cell to the ini preload cells. Other people have been fine without doing this, but it's possible for it to be system-dependent, so I guess it's worth a try.


Excellent, I'll give it a try. And by the ini preload cells, do you mean in the .ini file in the MW folder?
User avatar
Yvonne Gruening
 
Posts: 3503
Joined: Mon Apr 23, 2007 7:31 pm

Post » Sun May 01, 2011 1:16 pm

Yep, it's in Morrowind.ini. The default is this:
[PreLoad]Cell 0=Imperial Prison ShipCell 1=Seyda Neen

I assume you can add a Cell 2 and put your starting cell there.
User avatar
Prue
 
Posts: 3425
Joined: Sun Feb 11, 2007 4:27 am

Post » Sun May 01, 2011 2:07 pm

Ah thank you, you're brilliant lol. i'll try it tomorrow (it's midnight lol) and let you know how it works. thanks again
User avatar
Luis Longoria
 
Posts: 3323
Joined: Fri Sep 07, 2007 1:21 am

Post » Mon May 02, 2011 4:59 am

Excellent! all worked,, thatnks a millio. even got the positioning to work. You are a hero lol
User avatar
Georgia Fullalove
 
Posts: 3390
Joined: Mon Nov 06, 2006 11:48 pm

Post » Mon May 02, 2011 12:02 am

If you're planning on releasing this, instead of asking the end user to modify their Morrowind.ini file- start the player off in Seyda Neen or the Imperial Prison Ship, then teleport them out of there to your desired destination immediately. Just a quick fix that makes your mod plug-and-play.
User avatar
Amie Mccubbing
 
Posts: 3497
Joined: Thu Aug 31, 2006 11:33 pm

Post » Sun May 01, 2011 11:45 pm

Thanks, but I didn't need to fix the ini file, thank god lol
User avatar
Keeley Stevens
 
Posts: 3398
Joined: Wed Sep 06, 2006 6:04 pm


Return to III - Morrowind