Jump to content

Recommended Posts

Okay, since I've gotten my previous issues cleared, I've got another question. What I'm working on is a custom spell that summons a door, to the player's position, which leads to a custom player house. Currently, I've got it set-up that there's a spell to summon the door and a script to dismiss the door. Is there a way to set it so once the player exits the summoned door, it disappears of its own accord, or would that not be possible since going into the abode would trigger the exit?

Link to comment
Share on other sites

If you have the door ready in a dummy cell or something like that and then summon it to player, you could try adding a small quest that only handles the door's position and moves it away after it is no longer needed. I am not sure what will happen if the door is somewhere where it was not originally when a savegame is loaded. Perhaps it will stay there without any issues. If the change in position remains saved somewhere. Doors usually do. I think. Just thinking. OBSE also has some kind of a non-permanent position change, but I have never tried it.

 

You could try making it so that when player enters the home, it sets a variable to something, like one. When player no longer is in the home cell and the variable still is one, it could set the variable to null and move the door away. And also it might be nice to make it so that the door will disappear in a few days even if the player did not use it. That could be set as an optional feature with an added configuration file. The quest would probably not need to be upated too often, so fQuestDelayTime could be set to something larger than the default five seconds. It could also be added to the configuration file for the user to decide.

 

This device I am currently browsing the internet with is unbelieveable when it comes to editing text, so I cannot write you an example right now (I do not have the patience for it). But this is an interesting idea you have. Should you need help with scripting or something else, I would be more than happy to help. I could even try doing the scripting things for you, although it would not help you learn Oblivion scripting. :)

Link to comment
Share on other sites

Yes, I've the door in a dummy cell. Currently, there's a spell to summon and a spell to dismiss. I'd *like* to have it all-in-one. I'd start the script with a check, at game start, to find the location of the player, then the location of the door. Does that sound about right? From there, I'd need to run a check every "X" times per "X", yes?

Link to comment
Share on other sites

This is the script I have, so far. It works.

 

ScN gGoHomeSpellScript

Float Pos
Float Ang
Float Ang2
Float Ang4
Float Sign
Float Sin
Float Cos

Begin ScriptEffectStart
gOutsideDoorRef.disable
End

Begin ScriptEffectFinish
Set Sign to 1
Set Ang to Player.GetAngle Z
If Ang > 270
Set Ang to Ang -360
ElseIf Ang > 90
Set Ang to Ang -180
Set Sign to -1
EndIf
Set Ang to 0.017453*Ang
Set Ang2 to Ang * Ang
Set Ang4 to Ang2 * Ang2
Set Sin to Sign*Ang*(1 – 0.16605*Ang2 + 0.00761*Ang4)
Set Cos to Sign*(1 – 0.4967*Ang2 + 0.03705*Ang4)

gOutsideDoorRef.MoveTo Player
gRefRat02.MoveTo Player

Set Pos to Player.GetPos X + 150*Sin
gOutsideDoorRef.SetPos X Pos

Set Pos to Player.GetPos Y + 150*Cos
gOutsideDoorRef.SetPos Y Pos

Set pos to player.getPos z + 150
gOutsideDoorRef.setPos z pos

Set ang to player.getAngle z + 90
gOutsideDoorRef.setAngle x 0
gRefRat02.setAngle x 0
gOutsideDoorRef.setAngle y 0
gRefRat02.setAngle y 0
gOutsideDoorRef.setAngle z ang

Set Ang to Player.GetAngle Z + 180
gRefRat02.SetAngle Z Ang

gOutsideDoorRef.Enable
End

Link to comment
Share on other sites

Oh... having an all-in-one system would definitely be challenging to make (at least for me). Especially since the player could stay in the house for an unknown amount of time. Or wait a few minutes before he/she enters the summoned door. I would personally do it with both a spell and a quest, as it might be a bit easier that way and would also make it possible to create a small configuration file so that people would have the option to change some small things if they did not think the default settings are good enough. Like the interval at which the quest would check if the door has to be moved or the number of days that would need to pass before the door is moved away if it is not used. Or something like that. Not necessarily needed, but at least no one would be able to say the door vanishes too soon or too late, or that the quest eats all their game's resources. And I like configuration files. :smile:

 

I suppose a door's position, even if modified by scripts, remains saved somewhere, so there will hopefully not be any need to check for its position when game is loaded. But if does not, it will need to be checked. I have never done something like that before, so I do not know. At least normal doors stubbornly stay where they were the first time they were encountered.

 

The quest could be named something (like gDoorQuest in the example), and have a script that only controls the door's position attached to it. It should not take up too much resources, and it would not need to be too complicated. So even with it things could stay simple. I think. This how I would probably do it:

 

A configuration file, an .ini file, for example, with the following in it:

; The update interval of the quest in seconds
set gDoorQuest.fQuestDelayTime to 10

; Automatically move the door away if not used?
set gDoorQuest.MoveAwayIfUnused to 1

; Days unused before the door is move away (integer)
set gDoorQuest.DaysToMoveAway to 1

And the quest script (the .ini is in the Data folder with the .esp, if not, it will let the player know):

ScriptName gDoorQuestScript

float fQuestDelayTime         ; Quest update interval
short DoorState               ; 0 = not currently in use
                              ; 1 = summoned, not entered
                              ; 2 = summoned and entered

short MoveAwayIfUnused        ; 1 = move, 0 = do not
int DaysWhenSummoned          ; GameDaysPassed when last summoned
int DaysToMoveAway            ; Days to pass before moving the door away if unused

Begin GameMode

    If ( GetGameLoaded )
        If FileExists "Data\NameOfTheINI.ini"
            RunBatchScript "Data\NameOfTheINI.ini"
            PrintToConsole, "Successfully read config file"
        Else
            MessageBox "Configuration file for mod named something not found"
        EndIf
    EndIf

    If ( DoorState == 1 && MoveAwayIfUnused == 1 && GameDaysPassed >= DaysWhenSummoned + DaysToMoveAway )
        set DoorState to 0
        gOutsideDoorRef.Disable    ; Or move it somewhere
    EndIf

    If ( DoorState == 2 && Player.GetInCell HomeCellID == 0 )
        set DoorState to 0
        gOutsideDoorRef.Disable    ; Or move it somewhere
    EndIf

End

The spell could be that one you have there, but with two lines added to the ScriptEffectFinish block to both set the DoorState in the quest to 1 so that the quest knows to do something to the outside door when needed and to get the day the door was last summoned. Like that:

set gDoorQuest.DoorState to 1
set gDoorQuest.DaysWhenSummoned to GameDaysPassed

Also, the spell could have a condition on it that player must not be in the house cell for the door to appear. It would not make any sense to summon it there. If someone decides to do it for some reason. But I suppose it should not do any harm to use it in the house, either. :D

 

A trigger zone could be added to where the player appears in the house after using the outside door, to register the player's visit to the house. It could have a script a bit like that:

ScriptName gHouseTriggerZoneScript

Begin OnTrigger Player

    If ( gDoorQuest.DoorState < 2 || gDoorQuest.DoorState > 2 )
        set gDoorQuest.DoorState to 2
    EndIf

End

If it was OnTrigger for trigger zones... I do not remember right now.

 

That is how I would probably do it. It may surely not be the most simple way to achieve it, but it should work. And it should not kill anyone's computer or game, either.

 

And what is the rat used for in the spell? To store the rotation of the door? Or something else? I have heard of people using rats as markers, but I am not sure I understand the idea behind it.

Edited by PhilippePetain
Link to comment
Share on other sites

I use the rat as a marker, as X-Markers cannot have scripts attatched.

 

The idea on timing that I'd had was:

1) door appears

2) door gets used (to go inside)

3) door gets used (to go outside)

4) door disappears (little to no time passes between #3 & #4)

 

So, what I could do, then, is set a quest for the door, like you suggested, to where if the door is not in use, it's "back home". If it's in use, it's disabled. Once it's been fully utilized, it can go "back home", for later use.

Link to comment
Share on other sites

Yes, the quest can work the way you thought. The reason I suggested a configuration file was so that the user can choose how often the quest should update and therefore how quickly the door should disappear. And the trigger zone was to register player's visit to the house, as I think placing an OnActivate block on scripts on activatable objects prevents their own 'activation things' from working, like having an NPC with a script that contains an OnActivate block prevent initiating dialogue with it.

 

That example of mine should worka bit like the way you described (except for the fact that the part where it disables the door should be substituted by a MoveTo command and such so that you can move the door to wherever you want to move it), but if you want something different, you can do it the way you thought about it. But the main idea seems good.

 

My example, too, does the following:

  1. The spell you have created summons the door (and sets the two variables by the added lines)
  2. The quest handles the door the following way:
  • If player enters, the trigger zone in the house is activated and the visit is registered, so the door will be removed once the quest activates when the player is no longer in the house cell.
  • If player does not enter, the quest removes the door after the desired amount of days has passed. It is rather slow, though, so another way to do it would probably be better. Like seconds, using GetSecondsPassed, perhaps?

But you can do it in whatever way you want. You have a good idea there. Now just make it happen and enjoy. :smile:

Edited by PhilippePetain
Link to comment
Share on other sites

You are welcome. That is how I manage to make my mods work. Spend a few hours trying dozens of different things until it somehow magically works. And I am still willing to give you some assistance if you need. It would just seem to be a bit difficult to help someone like this... posting on the forums. Rather slow. But when you have finished the mod, I can take a look at your scripts and see if I can think of something else. Not that it would be any better, just different. :smile:

 

That last post is a bit odd. Sorry for it. I am not good at posting in the middle of the night and I should really avoid it. My brains stop working immediately when I am even just a bit tired...

Edited by PhilippePetain
Link to comment
Share on other sites

  • Recently Browsing   0 members

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