Jump to content

Elevator Script Help


MykhailKozak

Recommended Posts

On a related note in case having an actual moving lift was your first intention.

 

Here is a mod that shows you how to do that.

 

https://www.nexusmods.com/newvegas/mods/61807/?

 

Check their video's and here is the script template they made

 

 

Scn DDDLiftScriptTEMPLATE

ref PlayerPosZ
ref LiftPosZ
ref LiftSoundPosZ
ref LiftSoundPos-Z
ref LiftPos
ref PlayerPos-Z
ref LiftPos-Z
float Start
float Timer
float Time

begin onactivate

set LiftPos to DDDLiftREF.getpos z

if start ==0
set Start to 1
playsound DDDLiftSound2 1
set Time to .001
if player.hasperk DDDIsOnLiftPerkTEMPLATE ==1
disableplayercontrols 1 0 0 0 0 0 0
else
if player.hasperk DDDIsOnLiftPerkTEMPLATE ==0
DDDTriggerDisableREF.disable 0

endif
endif
endif

if start ==500
set Start to 501
playsound DDDLiftSound2 1
set Time to .001
if player.getpos z >= LiftPos
if player.hasperk DDDIsOnLiftPerkTEMPLATE ==1
disableplayercontrols 1 0 0 0 0 0 0
else
if player.hasperk DDDIsOnLiftPerkTEMPLATE ==0
DDDTriggerDisableREF.disable 0

endif
endif
endif
endif
end

begin gamemode

if start >0
if start <500
set PlayerPosZ to player.getpos z + 2
set LiftPosZ to DDDLiftREF.getpos z + 2
set LiftSoundPosZ to DDDLiftSoundREF2.getpos z + 2

if Timer < Time
set timer to timer + GetSecondsPassed
else

if Start >0
if Start <500
DDDLiftREF.setpos z LiftPosZ
DDDLiftSoundREF2.setpos z LiftSoundPosZ
Set Time to Time + .001
set Start to Start + 1
if player.getpos z > LiftPos
if player.hasperk DDDIsOnLiftPerkTEMPLATE ==1
playerref.setpos z PlayerPosZ


endif
endif
endif
endif
endif
endif
end

begin gamemode

if Start == 151
set Start to 500
enableplayercontrols
DDDLiftMarkerREF.enable 0
DDDTriggerDisableREF.enable 0

endif
end

begin gamemode

if Start >500
DDDLiftMarkerREF.disable 0
set PlayerPos-Z to player.getpos z - 2
set LiftPos-Z to DDDLiftREF.getpos z - 2
set LiftSoundPosZ to DDDLiftSoundREF2.getpos z - 2


if Timer < Time
set timer to timer + GetSecondsPassed
else

if Start >500
DDDLiftREF.setpos z LiftPos-Z
DDDLiftSoundREF2.setpos z LiftSoundPos-Z
Set Time to Time + .001
set Start to Start + 1
if player.getpos z > 8373 ;The height (z) of the original placement of the lift.
if player.hasperk DDDIsOnLiftPerkTEMPLATE ==1
playerref.setpos z PlayerPos-Z

endif
endif
endif
endif
endif
endif
end

begin gamemode

if Start == 651
set Start to 0
enableplayercontrols
DDDTriggerDisableREF.enable 0

endif
end

 

 

I can trim it down to simplify it , and add in some lines to explain whats going on better.

If you're interested ?

I also adapted a version of it to move water up/down.

Edited by Mktavish
Link to comment
Share on other sites

@Mktavish

I know that script as we were comparing the script approach with the animated object approach.

I wouldn't mind to have a few explicative lines to better understand it. :smile:

 

Ahh bummer I just noticed that author's videos are removed. But no matter I can still make up a concept explanation and I guess what I think is a stream lined script with ;explanations per line.

Just give me a little time , as I better test it for actually working in game.

 

On a related note ... your animated lift has some definite advantages. With the player not needing to have movement disabled , nor npc's. ;)

Link to comment
Share on other sites

I forgot about the hidden safe script in their mod ... which is a bit more simple , and has explanation lines.

It's what I used to understand the lift script , and then blended the 2. So here it is if it helps to get a quick understanding till I get back with a different version.

 

 

Scn DDDHiddenSafeTEMPLATE

ref PaintingPosZ ;this ref is for editing the position of the painting
float start
float timer
float Time ;this gets the timer for the if timer line

begin onactivate

if Start ==0
set Start to 1
playsound GAMECaravanNavigate ;plays sliding painting noice


endif
end

begin gamemode

set PaintingPosZ to getpos z + 1 ;since this is applied to the painting no ref is needed
set Time to .001 ;this is one value for the speed the object moves

if timer set timer to timer + GetSecondsPassed
else
if start >0 ;this runs everytime after activated
if start<71 ;this will end on the specific step. since PaintPosZ moves up by 1 everytime the script is played set this ending number to the amount you want it to move up +1. for example want it to move up 50 times make the ending number 51.
setpos z PaintingPosZ ;when this runs the painting moves
set Time to Time + .001
set start to start + 1 ;repeats steps

endif
endif
endif
end

begin gamemode

if start ==71 ;set this number to the end number you changed acouple lines up
PaintingDisableREF.enable 0 ;since theres a glitch with the geck when you constantly move and object with a script like this the collision for the object stays put but not the textures. This will enable a static painting where your painting will end
if timer <.05
set timer to timer + GetSecondsPassed
else
disable 0 ;this disables the moving painting so you can access the safe behind it.
set start to 0 ;this ends the cycle until you activate the object again.

endif
endif
end


Link to comment
Share on other sites

  • 2 weeks later...

@Mktavish

I know that script as we were comparing the script approach with the animated object approach.

I wouldn't mind to have a few explicative lines to better understand it. :smile:

 

Did my posts and links to posts help ? If not enough plz explain ... will make better attempt with some direction.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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