Jump to content

Trigger teleport on death


DarkKRaziel

Recommended Posts

Hello! I want to make a mod that triggers a teleport to doc's mitchell house on death INSTEAD OF loading the last saved game.

 

Researching by myself I went to this

begin ScriptEffectUpdate
	if player.getHealthPercentage == 0
		player.forceav health 1
		player.forceav PerceptionCondition 0
		player.forceav EnduranceCondition 0
		player.forceav LeftAttackCondition 0
		player.forceav RightAttackCondition 0
		player.forceav LeftMobilityCondition 0
		player.forceav RightMobilityCondition 0
		player.moveto GSDocMitchellHouse
	endif
end

I don't know if the forceav's will work in G.E.C.K, and moveto doesn't allow me to save (compile problems), also "coc" doesn't work here... And... is "scriptEffectUpdate" good? How do I make this to trigger after HP reaches zero WITHOUT triggering the load game? Triggering after finishing the death animation would be so nice

TIP: I want to get all my parts crippled and teleport to doc's house after death

Edited by DarkKRaziel
Link to comment
Share on other sites

You need to use "PlayerRef" in all those cases instead of "Player"

Also I would use "ModAV" instead of "ForceAV"

And the moveto , needs to be an xmarker , not the cell if that's what you are using.

 

But maybe you just want to use a "Begin GameMode" block running on a quest script instead. although an effect script may be just fine.

Unless you can figure a way for an "OnDeath" block to trigger for the player .

Not sure but maybe just slapping a script on the NPC "Player" ???

 

Anyways , an Event Handler is probably the way to go with this , but I'm not very well versed with those , sorry :/

Link to comment
Share on other sites

Thanks! Well, I recently discovered that the way to go is "damageav" to cripple my limbs, what triggers the sounds, animations, even achievements. Forceav made it impossible to restore them back even with commands again xDD

 

Well... how do I make an "xmarker" in doc's clinic so I can moveto?

 

Hum... Treat me like I don't get the things, this system is so confusing xD i tried scripts and perks but... didn't make it... I'll try that but I think I'll need some help xD Where to put the code so it executes constantly to check stuff... and how do you make the "onDeath" so it doesn't load the game...

Link to comment
Share on other sites

Okay. I went to "Data", loaded "FalloutNV.esm". I created this script.

 

fa79e9832d2bf0cded62871a56215958.png

 

It compiles so I suppose it's okay. I read that onDeath is a valid event. 00104C0D is the "id" of doc's mitchell (it did not compilate with the cell id, but now it does with this).

 

I went to NPC -> Playerfemale (also Player just in case), under Script I chose the previous script. The script was added to the Script tab.

Went to Save. I saved the project as an "esp" file, the same files I download from other mods. Put it in Data folder. Added to launcher as usual.

 

In-game, this happens:

 

84309eba802b9c13c44a481821d52c71.png

 

Any idea how to continue? Thanks for the attention!

Edited by DarkKRaziel
Link to comment
Share on other sites

Hmmm not sure what that game side error is about. But could be from using the Female player npc , which shows there is no users for it , I tested with only the Player.

And it might have been the formID your using with the Moveto. ??? Cuz my testing which I mention later did not yield that error.

 

Ahh ya nice thinking with "DamageAV" I wasn't thinking it through enough with "ModAv"

 

To make an Xmarker , you go to the cell where you want to drop one in , and just find "XMarker" or "XMarkerHeading"

in the object tree. Typing Xmarker in the filter then selecting all will bring up both those quickly for you.

Then you just drag and drop which one you want in the render window and position it. And give it a Ref-ID on its Reference Window. Then that is what you use with the Moveto command.

For this you probably want to use an XMarkerHeading so the player will show up facing the way you want , instead of the direction you were facing when you died.

If you want though , could use one of the XMarkerHeadings already in doc mitchells house , like this one for example that is positioned in front of the bed you wake up in. "VCG01PlayerStartMarkerREF"

 

Anyways I did some testing ... could not get it to work with an OnDeath block in an object script for the NPC , nor an effect script.

So I ended up trying a Quest script that looks like this , and set the script process delay to .1

 

 

SCN zzzDeathQuestScript

Short MSG50
Short MSG20
Int iDeathTrig ; reset this to 0 in the arrival script
Float fEffectTimer ; reset this to 0 in the arrival script


Begin GameMode



If PlayerRef.GetHealthPercentage <= .55 && MSG50 == 0
ShowMessage zzzDeathMessage50
Set MSG50 to 1
endif

If PlayerRef.GetHealthPercentage <= .2 && MSG20 == 0
ShowMessage zzzDeathMessage20
Set MSG20 to 1
endif

If PlayerRef.GetHealthPercentage <= .08 && iDeathTrig == 0
PlayerRef.StopCombatAlarmOnActor
DisablePlayerControls
Set iDeathTrig to 1


elseIf iDeathTrig ==1 && fEffectTimer < 3
Set fEffectTimer to fEffectTimer + GetSecondsPassed
ShowMessage zzzDeathMessage01
;PlayIdle MyDeathIdle
;PlaySound MyDeathSound
;Imod MyDeathSFX
;MyTrigBoxRef.Enable ; to run an arrival script with OnTriggerEnter Player


elseIf iDeathTrig == 1 && fEffectTimer > 3
PlayerRef.ModAv Health 10
PlayerRef.MoveTo VCG01PlayerStartMarkerREF ; puts player inside MyTrigBoxRef to run arrival script
Set iDeathTrig to 2
endif

End

 

 

And with this you make a trigger box , initially disabled , and attatch an object script to it to run upon the player arrival doing the rest of the player stat changes / enable the player controls / anything else you want , then disable it again once that is done so it won't trigger just from walking around Doc Mitchells.

 

I was however getting quirky behavior , and those messages I put in were just for testing purposes.

 

A question about this also ... Is this just a mod for yourself , or is it something you plan to publish for community download.

Because since you are trying to negate the auto save. You could simply turn it off , then in game have an item to run a script for you that would ...

 

1 - Do a SystemSave

2 - Move player to Doc Mitchells

3 - Change player stats and anything else

4 - Create an AutoSave

5 - Load the SystemSave to put you back where you were with previous stats.

 

Then when you die the Auto Save will load ...

The down side is you have to create these spots manually via an inventory scripted item, and deal with 2 loading screens every time.

But I guess even as a mod for publishing , that would still be acceptable in my view :turned:

Link to comment
Share on other sites

Lot of thanks for the effort! I'm trying to make it work.

 

Well, the mod is for myself, but I planned to make it public so other people can enjoy it. Putting your name in it (?????)

I don't want it to mess with the save stuff. I already have a mod that disables quicksave/load, and better not mess with the save system without player's consent. The important thing is that the game won't load after death, so you can play without saving the game as you want, without dying and losing progress. Then just manually save regularly and GG. Sometimes you die when it's not your fault (people comes to distract you, or a game's bug or not fair behaviour) so it's nice that it doesn't auto save.

 

Well... created the quest with the 0.1 delay, put the quest script on it, compiled nice... entered the game. Search death. It found the QST (quest) with the name I gave it, and showed some random ID. I did setstage ID 0 (and setstage ID 1 just in case). The quest doesn't appear in pip body... and I died without it working.

 

What can I be doing wrong? Maybe it's because the quest doesn't properly triggers? I don't want to get complicated ways to get the quest, just a command and GG.

Link to comment
Share on other sites

You have to flag the quest as "Start Game Enabled" which is a check box just below "Priority" on the left side of "Quest Data" tab.

And while you are there , put 95 in the priority. Wiki says priority is just for dialogue , but it might clear up the glitches I experienced , and it won't hurt if it doesn't.

But forget about the stages on quests for now. Don't need them , but not that they may come in handy for this problem before it's solved.

 

A quick mention of what a quest object is in this case. It is simply an object to hold the script , unlike an object script , that you place a reference of it. And the script runs when the object is loaded.

Therefore the quest is like a global object for running scripts not limited by its location.

Hence why we tried to put an object script on the player NPC , cuz in theory , they would always be loaded. But of course that didn't work.

 

Also when you load the game with your mod manager , after your load order is checked. Toggle archive invalidation by clicking on tools / remove archiveinvalidation/ Then reapply it ... before you launch the game.

In my experience this is good to do anytime you make a change in your mod file you are testing , not just for texture problems.

 

 

By the way , manipulating the saves to accomplish this , won't be a problem .... auto save and system save are their own slots which always get overwritten , like quick save I guess , that I forgot about. But I guess would need some testing to see if auto save is the only slot that death will load from. Can't remember ... does it do it from the quick save also ... and I guess possibly always from the last save no matter what slot , even a basic save ?

 

Cuz with the method I did above , it is still possible to get killed before the scripting can catch the health% thresh hold.

And once the vanilla death scene starts , you can't stop it.

But that doesn't mean there is not a way to get it done ... which I'll think on it some more if you Really want to avoid the save slot swapping.

Link to comment
Share on other sites

Lot of thanks, really (Q_Q) I thought about "start game enabled" but I thought it only worked for new game, right after starting naked in doc's house before doign the Vit'o'matic stat thing, and I couldn't for a game already started xD I have to stop assuming things.

 

Sometimes I really think I'm idiot with these things. Why can't I make it work? I can't do the "archive invalidation" part. I don't load with mod manager, I manually put the .esp in the Data folder. I changed the quest name and quest id. I closed and changed the .esp name. Still doesn't work... sorry (Q_Q)

Edited by DarkKRaziel
Link to comment
Share on other sites

Okies I changed a couple things that helped out the Quest script method to be more stable.

 

First I did change the priority to 95 , not sure if it helped ?

 

Then changed the script to this ...

 

 

SCN zzzDeathQuestScript

Short MSG20
Int iDeathTrig ; reset this to 0 in the arrival script
Float fEffectTimer ; reset this to 0 in the arrival script


Begin GameMode

If Player.HasPerk zzzDeathPrevent != 1
Player.AddPerk zzzDeathPrevent
endif

If PlayerRef.GetHealthPercentage <= .2 && MSG20 == 0
ShowMessage zzzDeathMessage20
Set MSG20 to 1
endif

If PlayerRef.GetHealthPercentage <= .08 && iDeathTrig == 0
PlayerRef.StopCombatAlarmOnActor
DisablePlayerControls
Set iDeathTrig to 1


elseIf iDeathTrig ==1 && fEffectTimer < 3
Set fEffectTimer to fEffectTimer + GetSecondsPassed
ShowMessage zzzDeathMessage01
;PlayIdle MyDeathIdle
;PlaySound MyDeathSound
;Imod MyDeathSFX
;MyTrigBoxRef.Enable ; to run an arrival script with OnTriggerEnter Player


elseIf iDeathTrig == 1 && fEffectTimer > 3
PlayerRef.ModAv Health 10
PlayerRef.MoveTo VCG01PlayerStartMarkerREF ; puts player inside MyTrigBoxRef to run arrival script
Set iDeathTrig to 2
endif

End

 

 

Of which you will notice I give the player a perk.

Which this perk is an : EntryPoint / Modify Damage Threshold (defender) / Add Value = 50

And on the condition field / Perk Owner tab add this.

 

GetHealthPercentage : parameter none : <= .12

 

~~~~~~~~~

Next you'll notice I got rid of the 50% health message . Which I believe was screwing things up since the game has it's own default message at 50%

 

Anyways it appears stable now , but of course those Idle ,Sound & Imod lines are not being used yet.

And could introduce instability once they are , but only one way to find out ;)

Let me know if you need help with those.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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