Jump to content

timed energy blast script


feltrockni

Recommended Posts

Hi, I'm trying to create a script for a weapon that leaves an energy charge at a target location (trying to use a modified plasma projectile right now), then after 5 seconds it detonates with an energy blast (plasma grenade explosion).

 

scn 1MODReactiveLaserExplosion
;this script places a timed explosion at the reticle

float timer
float fQuestDelayTime
short aTarget

begin OnFire
    set fQuestDelayTime to 0.001
    set aTarget to PlaceAtReticle
    aTarget.placeatme 1MODReactivelaserpulse

    if ( timer < 5 )
        set timer to timer + getSecondsPassed
    else                                                                
        aTarget.placeatme GrenadePlasmaExplosion 1
    endif
end

 

notes:

{1MODReactivelaserpulse} is my custom projectile with a speed of 0 and a fade of 5.0

{GrenadePlasmaExplosion} is the default explosion for plasma grenades

 

The problems I have come across so far is:

a. the test script for timers on the bethesda walkthrough doesn't work in the first place.

b. the placeAtReticle command places the detonation in your face, not at the target location.

c. none of my code works anyway because I have no idea what I'm doing.

Edited by feltrockni
Link to comment
Share on other sites

Hi, I'm trying to create a script for a weapon that leaves an energy charge at a target location (trying to use a modified plasma projectile right now), then after 5 seconds it detonates with an energy blast (plasma grenade explosion).

 

scn 1MODReactiveLaserExplosion
;this script places a timed explosion at the reticle

float timer
float fQuestDelayTime
short aTarget

begin OnFire
    set fQuestDelayTime to 0.001
    set aTarget to PlaceAtReticle
    aTarget.placeatme 1MODReactivelaserpulse

    if ( timer < 5 )
        set timer to timer + getSecondsPassed
    else                                                                
        aTarget.placeatme GrenadePlasmaExplosion 1
    endif
end

 

notes:

{1MODReactivelaserpulse} is my custom projectile with a speed of 0 and a fade of 5.0

{GrenadePlasmaExplosion} is the default explosion for plasma grenades

 

The problems I have come across so far is:

a. the test script for timers on the bethesda walkthrough doesn't work in the first place.

b. the placeAtReticle command places the detonation in your face, not at the target location.

c. none of my code works anyway because I have no idea what I'm doing.

 

 

I dont think begin on fire run every frame, so your timer isn't being continuallly counted down, run maybe twice, probably once.

 

normally a timer script have the timer evaluations in a gamemode block, because gamemode blocks run every frame.

 


float timer
begin onactivate
set timer to 10

if timer > 0
  set timer to timer - getsecondspassed
endif
if timer <= 0
   do something
endif
end

 

that wont work, but is written fairly correctly.

 

float timer
short triggerd

begin onactivate
set timer to 10
set triggerd to 1
end

begin Gamemode
if timer > 0 && triggerd == 1
  set timer to timer - getsecondspassed
endif
if timer <= 0 && triggered == 1
   do something
endif
end

 

that why the activate (or onhit in your case) starts the gamemode block.

 

 

I've done this with target bottles (so after they spawn you can shoot them and they time out, and then "teleport" to a garbage collection cell/container.)

the onhit block only set everything in motion. the magic is done in gamemode blocks (in order words add a gamemode block to your script and just put the timer in there)

 

hopefully that helps

Edited by xab666
Link to comment
Share on other sites

 

that why the activate (or onhit in your case) starts the gamemode block.

 

 

I've done this with target bottles (so after they spawn you can shoot them and they time out, and then "teleport" to a garbage collection cell/container.)

the onhit block only set everything in motion. the magic is done in gamemode blocks (in order words add a gamemode block to your script and just put the timer in there)

 

hopefully that helps

 

Thanks. But that still won't save for some reason. Why can't there be a damn override save button in the geck...

 

Also - I'm using onFire. I don't want it to activate only after it hits. Though... making people explode after they get hit with it would be cool. But the idea is to modify the Laser RCW so that everywhere it hits has a 5 second buildup of energy then explodes.

 

Also if someone could help me with the code for placing an object at the reticle location and then placing a second object at the previous location. I would like to apply a pointer to the target location the add items to that location in the script, thus every time the script advances a second the detonation charge pulse gets bigger (via different objects placed) and then it detonates.

Edited by feltrockni
Link to comment
Share on other sites

 

that why the activate (or onhit in your case) starts the gamemode block.

 

 

I've done this with target bottles (so after they spawn you can shoot them and they time out, and then "teleport" to a garbage collection cell/container.)

the onhit block only set everything in motion. the magic is done in gamemode blocks (in order words add a gamemode block to your script and just put the timer in there)

 

hopefully that helps

 

Thanks. But that still won't save for some reason. Why can't there be a damn override save button in the geck...

 

Also - I'm using onFire. I don't want it to activate only after it hits. Though... making people explode after they get hit with it would be cool. But the idea is to modify the Laser RCW so that everywhere it hits has a 5 second buildup of energy then explodes.

 

Also if someone could help me with the code for placing an object at the reticle location and then placing a second object at the previous location. I would like to apply a pointer to the target location the add items to that location in the script, thus every time the script advances a second the detonation charge pulse gets bigger (via different objects placed) and then it detonates.

 

 

you need to download GECK powerup. it will show you the compiler errors instead of it silently failing 100% of the time... heres a link

http://www.newvegasnexus.com/downloads/file.php?id=36290

 

I highly recommend that, and FNVEdit http://www.newvegasnexus.com/downloads/file.php?id=34703

 

OnFire was added with new vegas, and to be 100% honest, i've never tried using it..

all I was originally stating is that timers HAVE to be in blocks that run everyframe (can be done in triggers, but gamemode is more applicable to this situation)

otherwise it gets evaluated once, isn't true (as the time doesn't change) and nothing happens.

 

I saw a script to get the x/y/z position of the reticle. http://cs.elderscrolls.com/constwiki/index.php/How_to_make_a_ground_area_mark_that_follows_the_crosshair

 

goodluck

Link to comment
Share on other sites

That's the wrong powerup - you need the new one for the 1.3 Geck

 

http://www.newvegasnexus.com/downloads/file.php?id=41642

 

ONFIRE is not a valid block type.

 

If you get in the habit of naming objects that begin with numbers, you are asking for trouble if you want to script them. 1MODReactivelaserpulse

 

 

Link to comment
Share on other sites

That's the wrong powerup - you need the new one for the 1.3 Geck

 

http://www.newvegasnexus.com/downloads/file.php?id=41642

 

ONFIRE is not a valid block type.

 

If you get in the habit of naming objects that begin with numbers, you are asking for trouble if you want to script them. 1MODReactivelaserpulse

 

I have no problems changing the names. I only did it to bring it to the top of the list anyway.

And onFire is valid. The archemedes targeter gun uses it. (See euclidcfinderscript, not sure I spelled it right but it's there)

 

I did get a script put together that should have worked but it didn't activate. I will post it as soon as I get home(on cell now).

Link to comment
Share on other sites

I was originally basing the code on on the euclidcftargeter script but because that weapon fires using like 5 separate scipts I can't make heads or tails of how it's target pointer works. However I can tell you it looks a lot simpler than the sample code you pointed me to. You may want to take a look at that in the GECK. Edited by feltrockni
Link to comment
Share on other sites

That's the wrong powerup - you need the new one for the 1.3 Geck

 

http://www.newvegasnexus.com/downloads/file.php?id=41642

 

ONFIRE is not a valid block type.

 

If you get in the habit of naming objects that begin with numbers, you are asking for trouble if you want to script them. 1MODReactivelaserpulse

my bad on the link, but onFire is actually a valid block type? i've never tried it in use but, it compiles. its on the GECK page as added in NV: http://geck.bethsoft.com/index.php/Begin

or are you saying you've used it and it doesn't work? (in which case nvm)

Link to comment
Share on other sites

That's the wrong powerup - you need the new one for the 1.3 Geck

 

http://www.newvegasn...le.php?id=41642

 

ONFIRE is not a valid block type.

 

If you get in the habit of naming objects that begin with numbers, you are asking for trouble if you want to script them. 1MODReactivelaserpulse

my bad on the link, but onFire is actually a valid block type? i've never tried it in use but, it compiles. its on the GECK page as added in NV: http://geck.bethsoft...index.php/Begin

or are you saying you've used it and it doesn't work? (in which case nvm)

Actually I looked here and didn't see it: http://geck.bethsoft...gory:Blocktypes

I did try a simple test and the powerup error said it was invalid:

scn MYtestScript

Begin OnFire

END

 

But now if I fire up the Geck without the PU, it does compile, like you said.

 

Edit - My bad. I had the FO3 Geck open.:teehee:

Link to comment
Share on other sites

This is my current code and I can't get it to compile. I think I have the wrong message display code. This is only a test code so I can make sure the script activates properly.

 

scn aMODReactiveLaserExplosion
;this script places a timed explosion at the reticle

Float Timer
Short DoOnce

Begin OnFire
Set Timer to 5
Set DoOnce to 0
showmessage "target designated" ;set a reference point to spawn pulses and detonation
End

Begin GameMode
If DoOnce == 0
	
	If Timer <= 0 

		Set DoOnce to 1
	EndIf
	Set Timer to (Timer - GetSecondsPassed)
	If Timer > 4 && Timer < 5
		showmessage "charge 1" ;pulse 1
	EndIf
	If Timer > 3 && Timer < 4
		showmessage "charge 2" ;pulse 2
	EndIf
	If Timer > 2 && Timer < 3
		showmessage "charge 3" ;pulse 3
	EndIf
	If Timer > 1 && Timer < 2
		showmessage "charge 4" ;pulse 4
	EndIf
	If Timer <= 1
		showmessage "Boom" ;detonate
	EndIf
	
EndIf
End

Edited by feltrockni
Link to comment
Share on other sites

  • Recently Browsing   0 members

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