Farlo Posted March 29, 2010 Share Posted March 29, 2010 My mod, the All-in-One Basement Remake, has been coming along, but I hit a snag in the scripting for how the mod recognizes that you've entered through a custom placed object and not from the vanilla houses. I wanted to add an object that you can place anywhere (say, in another custom house mod), and be able to teleport to the basement. The mods to place the door and teleport to the basement work (or should), but the code to determine where you entered from and where to put you is a bit too complex for me. Hidden for thread convenience. Scn aaBasementExitScript short buttonshort aaStagefloat fQuestDelayTime Begin GameMode if (aaStage == 0) set fQuestDelayTime to 0.01 set aaStage to 1endif if (aaStage == 1) if (aaBasementHouseConnectionEnabled == 0) if (aaBasementHomeEntered >= 1 && aaBasementHomeEntered <= 8) set button to (aaBasementHomeEntered - 1) set aaStage to 3 else MessageBox "Unabled to determine the house you entered from. Please select a destination.","Benirus Manor, Anvil","Bravil House","Bruma House","Cheydinhal House","Arborwatch, Chorrol","Imperial City Shack","Leyawiin House","Rosethorn Hall, Skingrad","Cancel" set aaStage to 2 endif endifendif if (aaStage == 2) set button to GetButtonPressed if button == -1 return else set aaStage to 3 endifendif if (aaStage == 3) if button == 0 if ( GetStage MS02 == 120 ) Playsound DRSLatchedOpen01 Player.PositionCell 736, -264, -256.0002, -90, AnvilBenirusManorBasement set aaStage to 10 else If (aaBasementHouseConnectionEnabled == 0) set aaBasementHomeEntered to 0 else Message "You haven't purchased and fixed up the Anvil house yet, therefore you can't go there." endif set aaStage to 1 endif elseif button == 1 if ( GetStage HouseBravil >= 20 ) Playsound DRSLatchedOpen01 Player.PositionCell -150, -231, -226.7034, 16, BravilHouseForSale set aaStage to 10 else If (aaBasementHouseConnectionEnabled == 0) set aaBasementHomeEntered to 0 else Message "You haven't purchased and entered the Bravil house yet, therefore you can't go there." endif set aaStage to 1 endif ..... all the other houses follow in the same way, wanted to not make post huge..... elseif button == 7 if ( GetStage HouseSkingrad >= 20 ) Playsound DRSLatchedOpen01 Player.PositionCell 17, 7, -400.0002, 170, SkingradHouseForSaleBasement set aaStage to 10 else If (aaBasementHouseConnectionEnabled == 0) set aaBasementHomeEntered to 0 else Message "You haven't purchased and entered the Skingrad house yet, therefore you can't go there." endif set aaStage to 1 endif elseif button == 8 set aaStage to 10 endif endif if (aaStage == 10) set aaStage to 0 stopquest aaBasementExitendif End As far as I can tell, the code uses the script "aaBasementHomeEntered", which is set when using the door to enter the basement, and is then referenced to to determine where to put you upon exit. An better explanation of what's going on here, along with a possible way to have it teleport you to an object as one of the ways of exiting would be greatly appreciated. Link to comment Share on other sites More sharing options...
Frznflm Posted April 1, 2010 Share Posted April 1, 2010 Have you checked out Armory Lab by Tom Supergan? He has something similar, maybe you can ask him for assistance? http://www.tesnexus.com/downloads/file.php?id=3791 Link to comment Share on other sites More sharing options...
Khet Posted April 1, 2010 Share Posted April 1, 2010 If I'm understanding you correctly.... adding as a spell for simplicity sake. scn BasementSpell Begin ScriptEffectStart If player.IsInMyOwnedCell == 1 If BasementRefItem.Inside == 0 Set BasementRefItem.Inside to 1 BasementMarkerExit.MoveTo Player Player.MoveTo BasementMarkerEntrance EndIf EndIf If BasementRefItem.Inside == 1 Set BasementrefItem.Inside to 0 Player.MoveTo BasementMarkerExit EndIf End Basically, a spell with a script effect added into the game which will require two markers (these can be in any cell at default) one with the RefID of BasementMarkerExit and another with BasementMarkerEntrance. Second, it would require a persistant reference object in the basement cell to have the RefID of BasementRefItem with a script attatched to it declaring the Short Inside. When it's cast the first time (and the player owns the cell) an Xmarker (BasementMarkerExit) is placed where the play is, and then the player is moved to the Entrance XMarker (inside the basement). When the spell is cast again, the player is then moved to the Exit marker (back in their owned cell, wherever they left from). Mind you, this would only work if the player OWNS the cell, which some housing mods might not do. I dunno, I don't use housing mods except for the ones I've made for personal use. If you'd rather an object... scn DoorCallSpell Begin ScriptEffectStart If player.IsInMyOwnedCell == 1 MovableDoorRef.MoveTo Player EndIf End Simple enough. Takes the object you've named as MovableDoorRef (hopefully it's an activator!!) and places at the player. Could offset it with X or Y... but it /might/ end up getting bugged in a wall or some other object... but then again, the player would just have to move and cast the spell again, your call. On the object itself we have this script attached: scn DoorActivate Begin OnActivate Player BasementMarkerExit.MoveTo Player Player.MoveTo BasementMarkerEntrance End Again, same general setup as before. Moves an XMarker to the player when they activate the object (to allow them to return) and moves them into the basement. An object in the basement would simply need this script attached to it. scn DoorActivate Begin OnActivate Player Player.MoveTo BasementMarkerExit End So, with either method we need TWO XMarkers, one called BasementMarkerExit ( this is placed in the players home when it is called) and BasementMarkerEntrance (this one is placed in the basement itself, it DOES NOT MOVE). If you use the SPELL we would also need an item called BasementRefItem with this script attached: scn BasementrefItemscript Short Inside In order for the spell to keep track of whether or not we're inside or outside the basement. If you use the OBJECT method, an activator object with the reference ID of MovableDoorRef would be required, with the above mentioned script attached. Mind you, I'm suffering from habitual lack of sleep so I'm probably wrong on a minor point or two, but that should do what you want if I understand your question right. Link to comment Share on other sites More sharing options...
Recommended Posts