Jump to content

Photo

timed energy blast script


  • Please log in to reply
16 replies to this topic

#11
tunaisafish

tunaisafish

    Old hand

  • Supporter
  • PipPipPip
  • 641 posts
Yep, ShowMessage would be causing that not to save.

You need to create message objects and pass those as a parameter in place of the strings.

ShowMessage "Boom"
...becomes...
ShowMessage EditorIDofYourBoomMessage

As this is only test code though, either...
Create a single debug message and pass it a different numeric parameter.
Or...
Use NVSE in your code to take advantage of the PrintToConsole command.
Discussed in this forum recently

#12
xab666

xab666

    Regular

  • Members
  • PipPip
  • 63 posts

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.


you need to make messages (they're an object type), not use strings, because the GECK doesn't work with strings EXCEPT with error messages. so, you could make warnings instead. or add the messages and call them like this

showmessage aModLaserBoom

or

showWarning "This Message will work"
and then change it after you get it to work


EDIT: Didn't realize until now somebody else (Tunaisafish) already answer this... nvm

Edited by xab666, 04 June 2011 - 06:37 PM.


#13
feltrockni

feltrockni

    Newbie

  • Members
  • Pip
  • 10 posts

Yep, ShowMessage would be causing that not to save.

You need to create message objects and pass those as a parameter in place of the strings.

ShowMessage "Boom"
...becomes...
ShowMessage EditorIDofYourBoomMessage

As this is only test code though, either...
Create a single debug message and pass it a different numeric parameter.
Or...
Use NVSE in your code to take advantage of the PrintToConsole command.
Discussed in this forum recently


I like the PrintToConsole idea since I have nvse for the nevada project already. Thanks.
Now I just need to sort out the proper pointer code. Then I will be able to sweep a room, duck behind a table, then everyone dies. (Insert evil grin here) Also if anyone has a good lasergun design they could recommend to use for the gun that would be great. Also if I can sort out the options, later I may add the option to change the detonation timer each time you equip the weapon. But let's just worry about it functioning at all first.

#14
feltrockni

feltrockni

    Newbie

  • Members
  • Pip
  • 10 posts
I got the script working. So it fires up when I shoot the Reactive Laser Weapon. Now I still need help understanding the Euclid scripts to use it's targeting meathod. First, here is what I believe to be the target pointer script:
ScriptName EuclidTargetPointerSCRIPT

; Spawns the targeting visual effect and animates it. Moves the effect to the last TargetPointer object, which is usually where the reticle is.

ref rPointer;
ref rSelf;

BEGIN OnLoad
	set rSelf to GetSelf;
	if(VEuclidQuest.bPointerInitialized == 0 && GetQuestRunning VEuclidQuest == 1) ;prevents firing indoors as far as I can tell.
		set VEuclidQuest.bPointerInitialized to 1;
		set rPointer to PlaceAtMe EuclidPointerStatic;
		set VEuclidQuest.rPointer to rPointer;
	else
		set rPointer to VEuclidQuest.rPointer;
	endif
	set VEuclidQuest.nPointerTargets to VEuclidQuest.nPointerTargets + 1;
	if(VEuclidQuest.nPointerTargets == 5)
		rPointer.PlayGroup Idle 1
	endif

	if (GetQuestRunning VEuclidQuest)	; if this check isn't in here the explosion often gets fired at the spot of the first target pointer rather than the last.
		rPointer.MoveTo rSelf;
	endif

	Disable;
	MarkForDelete;
END

Now here is the main script. This is the one I modified so it would bypass the limitation of only firing once per day.

ScriptName EuclidsCFinderSCRIPT Modded

; checks preconditions for firing. Spawns a stream of target pointers at the reticle, which the targeting visual effect will align to.

short bTargeted;

BEGIN OnFire
		if (Player.IsInInterior == 0 && Player.GetInWorldspace Lucky38World == 0)
			set bTargeted to PlaceAtReticle EuclidTargetPointer 1 0 EuclidPointerRange
			if (bTargeted)
				set VEuclidQuest.fTimer to 5;
				StartQuest VEuclidQuest;			
				set VEuclidQuest.bEnablePointer to 1;
			endif
		else
			
		endif
END

BEGIN GameMode
	if(VEuclidQuest.bEnablePointer)
		set bTargeted to PlaceAtReticle EuclidTargetPointer 1 0 EuclidPointerRange;
	endif
END


I'm not sure if this one is important. But it looks like it may be a primary code for the targeting.

ScriptName EuclidTargetSCRIPT

ref rSelf;
float fTimer;
short nEvent;
ref rPointer;
float fStartTime;


BEGIN OnLoad
	set rSelf to GetSelf
	set fTimer to 1.0;
	set fStartTime to GetCurrentTime;
	if (GetDistance player < EuclidRange && Player.IsInInterior == 0 && GetCurrentTime < fStartTime + 0.5)
		ApplyImageSpaceModifier EuclidCFinderISFX;
	endif
	SetAngle X 0
	SetAngle Y 0
	SetAngle Z 0
END

BEGIN GameMode
	if (VEuclidQuest.bHasTarget)
		set rPointer to VEuclidQuest.rPointer;
		if (fTimer > 0)
			set fTimer to fTimer - GetSecondsPassed;
			if(GetCurrentTime > fStartTime + 0.5 || IsPlayerMovingIntoNewSpace || Player.IsInInterior || rPointer.GetDistance player > EuclidRange || Player.GetInWorldspace Lucky38World)	; abort if player transitions.
				rPointer.Disable;
				rPointer.MarkForDelete;
				Disable;
				MarkForDelete;
				Set VEuclidQuest.nExit to 3;
			endif
		else
			if (nEvent == 0)
				set nEvent to 1;
				set fTimer to 1;
				PreloadMagicEffect FlamerFireDamage;
				MoveTo rPointer;
			elseif (nEvent == 1)
				if (rPointer.GetDistance player < EuclidRange && Player.IsInInterior == 0 && IsPlayerMovingIntoNewSpace == 0 && Player.GetInWorldspace Lucky38World == 0)
					PlaceAtMe EuclidExplosion ;
					set VMS03.nLastFiredDay to GameDaysPassed
					if (VMS49.bDoneArchimedesReaction == 0 && Player.GetDistance VeronicaREF < 1024 && GetObjectiveCompleted VMS49 70)
						VeronicaREF.Say VDialogueVeronicaARCHIMEDESIITestReact;
						set VMS49.bDoneArchimedesReaction to 1;
					endif
				endif
				set VMS03.nLastFiredDay to GameDaysPassed;
				rPointer.Disable;
				rPointer.MarkForDelete;
				Disable;
				MarkForDelete;
				set VEuclidQuest.nExit to 4;
			endif
		endif
	endif
END

Edited by feltrockni, 06 June 2011 - 01:02 AM.


#15
feltrockni

feltrockni

    Newbie

  • Members
  • Pip
  • 10 posts

I saw a script to get the x/y/z position of the reticle. http://cs.elderscrol...s_the_crosshair

goodluck


I think I've sorted out the targeting script and the one you recommended seems to be the correct meathod but I can't get it to save. Could someone look this over for me and tell me what I'm doing wrong? This script validator basically says it's correct (minus the fact that it doesn't register onFire).


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

Float Timer
Short DoOnce

Begin OnFire
	Set Timer to 5
	Set DoOnce to 0
	
End
float xang
float zang
float x
float y
float z
float playerheight
float lont

begin gamemode

set xang to player.getangle x
set zang to player.getangle z * -1 + 90

if xang <= 5
	set lont to 1300;  you can change this value if you need to
else
	if player.issneaking == 0
		set playerheight to 322
	else
		set playerheight to 252
	endif
	set lont to (playerheight*cos xang/sin xang * 0.34118010537042257764)
endif

set xang to player.getangle x * -1

set x to lont * cos xang * cos zang
set y to lont * cos xang * sin zang

Activator.moveto player x y 0

end

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

			Set DoOnce to 1
		EndIf
		Set Timer to (Timer - GetSecondsPassed)
		If Timer > 4 && Timer < 5
			Activator.placeatme EnclaveLightPulse01
		EndIf
		If Timer > 3 && Timer < 4
			Activator.placeatme EnclaveLightPulse01
		EndIf
		If Timer > 2 && Timer < 3
			Activator.placeatme EnclaveLightPulse01
		EndIf
		If Timer > 1 && Timer < 2
			Activator.placeatme EnclaveLightPulse01
		EndIf
		If Timer < 1
			Activator.placeatme GrenadePlasmaExplosion
		EndIf
		
	EndIf
End


#16
xab666

xab666

    Regular

  • Members
  • PipPip
  • 63 posts
... Double Post, Sorry (hit reply instead of edit..)

Edited by xab666, 06 June 2011 - 06:59 PM.


#17
xab666

xab666

    Regular

  • Members
  • PipPip
  • 63 posts
maybe "Activator" should be a xmarker that you move using either SetPos, or Moveto.

I havn't figured out what this does yet:
                if (Player.IsInInterior == 0 && Player.GetInWorldspace Lucky38World == 0) 
                        set bTargeted to PlaceAtReticle EuclidTargetPointer 1 0 EuclidPointerRange 
                        if (bTargeted) 
                                set VEuclidQuest.fTimer to 5; 
                                StartQuest VEuclidQuest;                         
                                set VEuclidQuest.bEnablePointer to 1; 
                        endif 
obviously the first part checks if the player is indoors, and in the Lucky38 WorldSpace.
bTargeted is a 'Short' according to its define statement.

PlaceAtReticle is new with FNV, and I can't find a functional definition for it.
EuclidTargetPointer is a Object (a trigger/activator to be exact)
PointerRange is a Global Variable (probably static)
VEuclidQuest is this:
ScriptName VEuclidQuestSCRIPT

; Countdown to the blast. Places a EuclidTarget object, which is the explosion spawner, when time expires. Also aborts early if precondiitons for firing aren't met.


float fTimer;
short bHasTarget;
short nEvent
short bInitialized;
short bEnablePointer;
short bPointerInitialized;
ref rPointer;
long nPointerTargets;
float fStartTime;

short nExit;		For debugging.

long nFailures;

BEGIN GameMode
	if (bInitialized == 0)
		set nEvent to 0;
		set fTimer to 3.0;
		set bHasTarget to 0;
		set nPointerTargets to 0;
		set fStartTime to GetCurrentTime;
		set bInitialized to 1;
		set nExit to 0;
	endif

	if (fTimer > 0)
		; rPointer is initialized in EuclidTargetPointer script.
		if (nPointerTargets > 0 && rPointer.GetDistance Player > EuclidRange)
			rPointer.Disable;
			rPointer.MarkForDelete;
			set bInitialized to 0;
			set bEnablePointer to 0;
			set bPointerInitialized to 0;
			set nExit to 1;
			StopQuest VEuclidQuest;
		endif
	endif

	set fTimer to fTimer - GetSecondsPassed;
	if (nEvent == 0 && fTimer < 9)
			set nEvent to 1
			HeliosLaserTopREF.Playgroup Forward 1
	elseif (fTimer <= 0)
		; Need to abort if: player waits, transitions, aims too far away, or fast travels.
		if (GetCurrentTime > fStartTime + 0.5 || Player.IsInInterior || Player.GetInWorldspace Lucky38World || IsPlayerMovingIntoNewSpace || rPointer.GetDistance player > EuclidRange)
			rPointer.Disable;
			rPointer.MarkForDelete;
			set nExit to 2;
		else
			set bHasTarget to player.PlaceAtReticle EuclidTarget 1 0 20000
			if (bHasTarget == 0)
				rPointer.Disable;
				rPointer.MarkForDelete;
				set nFailures to nFailures + 1;
			endif
			
			set nExit to 5;
		endif

		set bInitialized to 0;
		set bEnablePointer to 0;
		set bPointerInitialized to 0;

		StopQuest VEuclidQuest;
	endif
END
you should also check out the VEuclidQuest

keep trying, you'r getting there :D

Edited by xab666, 06 June 2011 - 08:44 PM.





Page loaded in: 1.360 seconds