Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

DSoS' Scripting Questions.


DsoS
 Share

Recommended Posts

Since I tend to ask alot, I'm going to place all my scripting questions here.... That is if Dark Rider doesn't mind me doing it :huh:

--------------


ScriptName aaaDSoSFortFNSEnterMsgScript


;Plays IfYouEnterYouCanNotLeaveSnd


Short DoOnce

Float Timer


Begin OnTrigger Player


	if DoOnce == 0

		set timer to 5

			DSoSFNSDeadGuyEnter01.Enable

			Playsound aaDSoSEnterMsgSnd


	Endif


	if ( timer > 0 )                                                

		set timer to timer + getSecondsPassed        

			else

				DSoSFNSDeadGuyEnter01.Disable

		Set DoOnce to 1

	Endif


End

This script is suppose to enable a npc, then play that sound, and after 5-seconds the npc should be disabled however, he enables and the sound plays, but the guy does NOT disable.

I'm not sure about the timer, I pulled it from the cs.elderscrolls wiki "Creating a simple timer"

EDIT:

Actually, I would like for the Ghost NPC to speak my Voice File...

Here's how:

Player trips a trigger zone.

Player Controls Disabled

Ghost Appears (Does NOT Walk towards Player, Will be in appropriate talk range)

Ghost Says my Voice File

Ghost Disappears

Player Controls Enabled

Player continues to play forward

Edited by DsoS
Link to comment
Share on other sites

  • Replies 56
  • Created
  • Last Reply

Top Posters In This Topic

rofl :huh: Well I said that since your the head commander of TESA (and also to keep the place a bit cleaner) :no:

(I've ran forums before, and its a pain when the SQL Tables get massively gigantic in size, crashes, bugs/glitches, etc, nasty stuff)

anyway, hopefully he won't mind me doing it :D

Link to comment
Share on other sites

One thread is fine.

The 'OnTrigger' block only runs once. And you need to use your DoOnce variable to better control your code. I added the GameMode block for this purpose. Notice, it goes from 0 to 1 and then 2 when its done.

The trigger is only activated when its equal to 0.

The disable will only happen when its equal to 1 (and the timer has run out)

You then set it to 2 so none of the above code is executed again.

Begin OnTrigger Player 
if DoOnce == 0
set DoOnce to 1
set timer to 5
DSoSFNSDeadGuyEnter01.Enable
Playsound aaDSoSEnterMsgSnd
Endif
end

begin GameMode
if doOnce == 1
if ( timer > 0 )
set timer to timer + getSecondsPassed
else
DSoSFNSDeadGuyEnter01.Disable
Set DoOnce to 2
;place things you want to do when the ghost is done talking here.
Endif
endif
End[/code]

Link to comment
Share on other sites

Okay so I wasn't too far off from the correct script. I got a few things mixed around.

okay I lied, I was pretty far off, but that's what this place is for, to learn the stuff you don't know :huh:

Thank you everyone :no:

Dane, I may PM you about the NPC stuff, I'm a bit lost when it comes to all that.

Link to comment
Share on other sites

Why not try the NPC Classes?, Should teach you what you want to know :)

I looked last night, but thought I seen the Under Construction :huh:

I'll check them out again, I was tired last night :D

EDIT:

Sorry that was World Building or something, I think, I can't remember XD

I'll check those classes out... Thank you :no:

Link to comment
Share on other sites

begin GameMode
if doOnce == 1
if ( timer > 0 )
set timer to timer + getSecondsPassed
else
DSoSFNSDeadGuyEnter01.Disable
Set DoOnce to 2
;place things you want to do when the ghost is done talking here.
Endif
endif
End[/code] Is it just me, or will the timer NEVER be less than zero here? It will continue to be larger than zero forever. How about changing that section to:
[code]begin GameMode
if doOnce == 1
if ( timer > 0 )
set timer to timer - getSecondsPassed
else
DSoSFNSDeadGuyEnter01.Disable
Set DoOnce to 2
;place things you want to do when the ghost is done talking here.
Endif
endif
End

Link to comment
Share on other sites

New Question:

This is setup on Load Doors.


scriptname aaaDSoSFNSDoorLock100Script


Short GetLock


Begin onActivate Player


	Activate


		if (GetLocked 0)

			Set Lock to 100

		Endif


End

It DOES NOT locks, but teleports me to the correct door

It needs work with multiple doors with the same script attached

Edit:

Added new script

Edited by DsoS
Link to comment
Share on other sites



scriptname aaaDSoSFNSHouse01FireEnablescript


short DoOnce

short FlagDead

float Timer


Begin OnTrigger Player


	if DoOnce == 0

		aaaDSoSFNSHouse01FireEnableMe.Enable

		aaaDSoSFNSHouse01FireLightEnableMe.Enable

		PlaySound aaaDSoSFNSAMBVoicesInHeadLP

		Set DoOnce to 1


			if ( aaaDSoSFNSDeadSkeletonRef.GetDead )

				set FlagDead to 1

				aaaDSoSFNSDeadSkeletonRef.SetActorValue Health 250

				aaaDSoSFNSDeadSkeletonRef.SetActorValue Fatigue 250

				aaaDSoSFNSDeadSkeletonRef.resurrect 1

				Set Timer to 0

					Elseif( FlagDead )


				if(Timer < 2)

					Set Timer to Timer + GetSecondsPassed

					Else

					Set FlagDead to 0

				Endif

		Endif

	Endif

End

Okay I'm having a weird issue with my skeleton guy.

Basically its dead at first, then the player triggers trig zone, the skeleton is resurrected with 250 health and fatigue... That works.... however, he doesn't like to attack the player back.

I'm not sure if I've got a script issue or something with the skeleton Stats or something.

any ideas?

Link to comment
Share on other sites

I'm not quite sure i follow the flow of your script. And i don't undestand what the timer is for.

Could you give a rundown of what it's supposed to do?

I have a suspission that it might be looping out of control and repeatedly resurrecting the skelly not sure though.

Link to comment
Share on other sites

I'm not quite sure i follow the flow of your script. And i don't undestand what the timer is for.

Could you give a rundown of what it's supposed to do?

I have a suspission that it might be looping out of control and repeatedly resurrecting the skelly not sure though.

I'm using a modified version of THIS HERE

Link to comment
Share on other sites

Ok, but do you need a timer if you arn't doing anything after it?

...get what i meen?

As far as i can tell that's a technique for avoiding certain specific problems.

What happens if you run a script like this with the complication taken out?

scriptname aaaDSoSFNSHouse01FireEnablescript


short DoOnce


Begin OnTrigger Player


        if DoOnce == 0

                aaaDSoSFNSHouse01FireEnableMe.Enable

                aaaDSoSFNSHouse01FireLightEnableMe.Enable

                PlaySound aaaDSoSFNSAMBVoicesInHeadLP

                Set DoOnce to 1


                 if ( aaaDSoSFNSDeadSkeletonRef.GetDead )

                      aaaDSoSFNSDeadSkeletonRef.SetActorValue Health 250

                      aaaDSoSFNSDeadSkeletonRef.SetActorValue Fatigue 250

                      aaaDSoSFNSDeadSkeletonRef.resurrect 1

                 Endif

        Endif


End
Heck, you KNOW the skely is dead right? you put him in the CS that way i assume. Go for broke, strip that thing down. :salute:
scriptname aaaDSoSFNSHouse01FireEnablescript


short DoOnce


Begin OnTrigger Player


        if DoOnce == 0

                aaaDSoSFNSHouse01FireEnableMe.Enable

                aaaDSoSFNSHouse01FireLightEnableMe.Enable

                PlaySound aaaDSoSFNSAMBVoicesInHeadLP

                Set DoOnce to 1


                aaaDSoSFNSDeadSkeletonRef.SetActorValue Health 250

                aaaDSoSFNSDeadSkeletonRef.SetActorValue Fatigue 250

                aaaDSoSFNSDeadSkeletonRef.resurrect 1


        Endif


End

Link to comment
Share on other sites

There's a weird issue with the Resurrect 1 command that I ran into with my companion critters.

They would stand up but be stuck in place only able to rotate to face me.

To check for it, you can try one of two things, alter it to Resurrect 0

or ingame, use the console to disable, then enable the critter.

Link to comment
Share on other sites

Okay so another question......

Not sure how to explain it well so I'll try my best :salute:

I have a house that the player *MUST* enter, and once they enter something happens, and they are shown a video cut-scene.

After that video finishes, I would like the player to be in another cell.

what I'm not sure about is:

I would like to keep the same out exterior, I'm using 2 different interiors, lets call them HouseInt01Clean and HouseInt01Dirty.. The Clean House is what you see before the cut-scene and after the cut-scene you see the Dirty House.

How would I setup something up like this?

I've got my cut-scene script already made, and it plays the video when triggered

Like I said, I'm not sure how to explain this. So if you don't understand or need more info, just say and I'll try my best to make explain it

Link to comment
Share on other sites

A bit late to the party and not strictly on topic, but may I make a suggestion? It concerns the matter of code indenting which I find invaluable when looking through scripts, whether it's to debug them or simply to understand how they work (this doesn't just apply to other people's but also my own if I'm revisiting them several months on - or several years in some cases!)

It's a good habit to get into and I'm inclined to think is one that helps with writing as well as reading. If you look at HeyYou's and WillieSea's (for example) they are very clear and it's easy to get an instant feel for what's going on. Try to ensure that your if/else/endif keywords are aligned and that the list of commands contained by them also line up vertically. It really does make life a lot easier!

Link to comment
Share on other sites

I know I try my best to keep indention's neat and nice. Theres a few I know that I got oddly messed up... usually once I hit a multiple tabs in :salute:

@Willie about doors:

Yeah I got it figured out not too long after I posted it. I got confused with the PlayBink stuff... I'm easily confused as you can tell :construction:

lol

------------

anyway for a little surprise:

I made a Simple Timer Script: (I know, I know there are millions of them, but this is my special one since I was able to make it myself, for the most part with help from all of you :construction: )


ScriptName MyTimerNameScript


Float Timer

Short Triggered


Begin OnTrigger Player


	if Triggered == 0

		Set Timer to x ;change x to your timer needs

		Set Triggered to 1

	Endif

End


Begin GameMode

	if Triggered == 1

		if Timer > 0

			Set Timer to Timer - GetSecondsPassed

		Else

			;Do Something

			Set Triggered to 0

		Endif

	Endif

End

Link to comment
Share on other sites

I know I try my best to keep indention's neat and nice. Theres a few I know that I got oddly messed up... usually once I hit a multiple tabs in :construction:

This happens a lot when switching between tabs and spaces: tabs are normally setup to be eight spaces wide, but some editors (such as CS's) use four-space tabbing, which causes them to go all wonky when doing a cut & paste to another medium. It's generally safest to use either spaces or tabs, but never both. (Sorry if that's a bit OT, but it's one of those lessons I learnt the hard way...)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share


×
×
  • Create New...