Jump to content

Need script assistance


eldiabs

Recommended Posts

I'm trying to put a 5 second delay on a weapon fx, but no such luck....

 

scn ElDOrbitalNukeScript01

float timer

begin gamemode

placeatme <lightsource>
playsound3d <soundeffect>
	
	if timer  > 0
		set timer to timer - getsecondspassed
	elseif timer
		set timer to 5
		placeatme ElDFXOrbitalNuke01 1
	else 
		set timer to 5
	endif

MarkForDelete

end

 

Again, no real idea what I'm doing here. I'm trying to learn, but it's going slow...any help is appreciated.

 

Thank you.

Link to comment
Share on other sites

I'm trying to put a 5 second delay on a weapon fx, but no such luck....

 

scn ElDOrbitalNukeScript01

; * EDITED *

float timer
short doOnce

begin gamemode

if doOnce == 0

			set doOnce to 1
placeatme <lightsource>
playsound3d <soundeffect>
			set timer to 5
	
	if timer  > 0
		set timer to timer - getsecondspassed
	elseif timer <= 0
		placeatme ElDFXOrbitalNuke01 1
	endif

;MarkForDelete

end

 

Again, no real idea what I'm doing here. I'm trying to learn, but it's going slow...any help is appreciated.

 

Thank you.

 

Your script would never count down. This might work. The semicolons at the start of lines prevent that line from affecting the script, btw. The doOnce is to make it happen just once, instead of continuously placing things at you. Don't understand what the Mark for Delete is for. If this works, I expect that your character will die? Or is it just a light show?

Link to comment
Share on other sites

Thanks for the input. I had to do a bit more searching on the beth forums, but I found exactly what I needed.

 

scn ElDOrbitalNukeScript01

float timer
float done

begin gamemode

		
	if (done)
		return			
	elseif(timer > 5)
		set done to 1
		placeatme ElDFXOrbitalNuke01 1
	else
		set timer to timer + getsecondspassed
	endif


end

 

The markfordelete was to remove the light source and sound effect after the script worked, but it would not allow the placeatme to work. I ended up just removed the lightsource and sound effect.

 

It's actually just a quick script I tagged to a weapon to test out an orbital strike fx from broken steel. Looks very sweet.

Link to comment
Share on other sites

I do have another question though.

 

Say I wanted to add a smoke effect on hit, before the fx sequence, but needed it to be deleted after the fx sequence. I would need a markfordelete correct? How would I add that without deleting the fx sequence before it even happened?

Link to comment
Share on other sites

Answered my own question again. Dug through some scripts a guy that made an artillery strike marker made. Hacked this out...seems to work though as long as there is a script on the light source with a timer. The sound is set to not loop, so it goes out quick enough.

 

scn ElDOrbitalNukeScript01

float timer
float done
short counter
short doOnce

begin gamemode

set counter to 1

	if counter == 1
		if doOnce == 0
			set doOnce to 1
		placeatme ElDOrbitalNukeLight01 5
		playsound3d ElDOrbitalNukeSoundFX
		endif
	endif

	if (done)
		return			
	elseif(timer > 10)
		set done to 1
		placeatme ElDFXOrbitalNuke01 1
		set counter to counter + 1
	else
		set timer to timer + getsecondspassed
	endif

if counter == 2
markfordelete
endif

end

 

If anyone has a cleaner, or more effective way of doing this, I'd love to know. Thank you.

Link to comment
Share on other sites

The end result....

 

About 10 seconds after targeting...

http://www.fallout3nexus.com/imageshare/images/916280-1247852805.jpg

 

http://www.fallout3nexus.com/imageshare/images/916280-1247852896.jpg

 

http://www.fallout3nexus.com/imageshare/images/916280-1247852991.jpg

 

http://www.fallout3nexus.com/imageshare/images/916280-1247853057.jpg

Link to comment
Share on other sites

Me? While functionality is, of course, the most important thing in a script, it's also nice to keep it short, simple and clean. Since you've asked, there is a cleaner way of doing this using a type of script that I like to refer to as a "staged timer". Here is how I would write your script as a staged timer:

int iStage
float fTimer

; In this example, some event is required to initialise the event by setting iStage to 1
; However, it is possible to have an event start when iStage == 0, i.e. when the script first starts running

Begin GameMode

if fTimer > 0
	set fTimer to fTimer - GetSecondsPassed
elseif iStage == 1
	set iStage to 2
	set fTimer to 1.2
elseif iStage == 2
	set iStage to 3
	set fTimer to 0.3
elseif ...
endif

End

As you can see, the timer can be reinitalised between different stages by setting the "fTimer" variable to a value greater than 0, and once it runs out the code for the next stage will be run. As you can see when looking at the script for the plane crash, you can also impose extra conditions that must be satisfied before the next stage begins instead of immediately setting "iStage" to the next value. You can also cause some pretty complicated scenes by setting the stage depending on some input, or even including some randomly determined events via GetRandomPercent.

Please don't hesitate to ask if you have any questions about what I've said.

 

Cipscis

Link to comment
Share on other sites

Cipscis - Once again, worked like a charm. I'm curious though. When I used the markfordelete in the same if statement after the orbitalnukefx in the old script, it would never allow the fx to play, nothing would happen. But here, it's working fine. Any idea why that is?

 

Thank you yet again for the awesome script and lesson.

 

More screens with the retextured Mesmetron/Now Orbital Nuke Marker thingy...

 

http://www.fallout3nexus.com/imageshare/images/916280-1247898114.jpg

 

http://www.fallout3nexus.com/imageshare/images/916280-1247898193.jpg

 

http://www.fallout3nexus.com/imageshare/images/916280-1247898269.jpg

 

http://www.fallout3nexus.com/imageshare/images/916280-1247898343.jpg

 

By the way, this is one of the (joke/super crazy) weapons in my upcoming 'Last of the Super Heroes' Story/House/Location Mod. Can't give too much away just yet, but I promise it's going to have more funny, crazy, esoteric randomness like my other locations. ;]

 

I figure enough talented modders make awesome semi-realistic stuff for the game. It's fun to make some good old fashioned fallout dark humour to fill in the gaps between all the super gooey goodness.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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