Trigger my missile!

Freeform discussion about anything related to modding Transcendence.
Post Reply
User avatar
Song
Fleet Admiral
Fleet Admiral
Posts: 2831
Joined: Mon Aug 17, 2009 4:27 am

...Here's the code for the latest missile I've been working on...the Model 1 (Mod. 1) lamprey. It attaches to a target, and detonates after X seconds.

However:

I changed the timer system from the one in the framework Prophet worked up for me, to one that suited the purpose better....and it does.

I just do not know what goes next to actually trigger OFF the timer. I can do a syscreateweaponfire...but not the bit that fires THAT. I've done a little poking around the wiki looking for it, but I'm not good at understanding code.

So...where I've left a note in the following code, what do I need to insert to fire off a sysCreateWeaponFire on itLampreyBlast?

(So far as I know, the rest of the code is *reasonably* ok. No assurances, though..so I'm including EVERYTHING)

Code: Select all

<?xml version="1.0" ?>

<!DOCTYPE TranscendenceExtension

[

<!ENTITY itLampreyLauncher                                     "0xDC4E7040">

<!ENTITY ovLampreyStrike1									"0xDC4E7041">

<!ENTITY itLampreyBlast1								"0xDC4E7042"> 

<!ENTITY itMod1Lamprey								"0xDC4E7043">  

]>



<TranscendenceExtension UNID="0xDC4E7040" version="1.0"> 



<ItemType UNID="&itLampreyLauncher;"

			name=				"Lamprey launcher"

			level=				"7"

			value=				"50000"

			mass=				"3500"

			frequency=			"uncommon"

			modifiers=			"MajorItem; Lamprey Launcher"



			description=		"Lamprey missiles attach to a target, rather than detonating on proximity."

			>



		<Image imageID="&rsItems1;" imageX="0" imageY="480" imageWidth="96" imageHeight="96"/>



		<Weapon

				fireRate=			"50"

				powerUse=			"1000"

				launcher=			"true"

				>



			<Missiles>

			



				<Missile ammoID="&itMod1Lamprey;"

						type=			"missile"

						lifetime=		"120"

						damage=		"kinetic:1d10; momentum4; WMD5"

						missileSpeed=		"60"

						hitPoints=		"10"

						stealth=		"5"

						maneuverability=                "4"

						directional=	"true"

						sound=			"&snMissileLauncher;"

						vaporTrailLength="16"

						vaporTrailWidth="110"

						vaporTrailWidthInc="5"

						vaporTrailColor="0xd0, 0xd0, 0xd0"

						>

						

					<Effect>

						<Image imageID="&rsStdMissile1;" imageX="0" imageY="0" imageWidth="32" imageHeight="32" rotationCount="40"/>

					</Effect>



					<HitEffect

							sound="&snArmorHit1;"

							>

					</HitEffect>



				</Missile>

</Missiles>

</Weapon>

<Events>

			<OnDamageArmor>

				(block Nil

                    ;; change the overlay type here

						(objAddOverlay 

							gSource 

							&ovLampreyStrike1; 

							aHitPos 

							(modulo (add aHitDir 180) 360)

							)



					; Return full damage

					aDamageHP

					)

			</OnDamageArmor>

			</Events>

	</ItemType>

    

    

    

    ;; Overlay

    <OverlayType UNID="&ovLampreyStrike1;"

			>

		<Effect>



			<Image imageID="&rsPteravoreClawOverlay;" imageWidth="32" imageHeight="32" rotationCount="40"/>

		</Effect>



        ;; placeholder damage graphic

		<HitEffect 

				sound=	"&snArmorHit1;"

				>

			<ParticleExplosion

					particleCount=		"2d4"

					particleSpeed=		"25"

					particleLifetime=	"20"

					>

				<Image imageID="&rsPteravoreDebris;" imageWidth="12" imageHeight="12" imageFrameCount="8" imageTicksPerFrame="3"/>

			</ParticleExplosion>

		</HitEffect>



		<Events>

			<OnCreate>

(sysAddObjTimerEvent 5 gplayership "Detonate")

			</OnCreate>



			<!--Break

				Insert Functional Timer here, there, or anywhere that works.

				End of break--->

		</Events>

	</OverlayType>

	

	<ItemType UNID="&itLampreyBlast1;"

			name=				"Mod.1 Lamprey Explosion"

			virtual=			"true"

			level=				"5"

			>

<Weapon

							type=			"radius"

							firerate=        "1000"

							damage=			"blast:2d21+23; momentum6; WMD7"

							canhitsource=	"true"

							minRadius=		"1"

							maxRadius=		"7"

							missileSpeed=	"0"

							>



						<Effect>

							<Flare

									style=			"fadingBlast"

									radius=			"170"

									primaryColor=	"0xff, 0xff, 0xf0"

									lifetime=		"8"

									/>

						</Effect>





		</Weapon>



</Itemtype>



<ItemType UNID="&itMod1Lamprey;"

			name=				"Mod.1 Lamprey missile"

			level=				"5"

			value=				"200"

			mass=				"100"

			frequency=			"uncommon"

			numberAppearing=	"3d10"

			modifiers=			"Consumable; Missile; Lamprey"



			description=		"The Mod.1 Lamprey detonates 10 seconds after impact, allowing for easier hit-and-run attacks."

			sortName=			"Messenger.30"

			>



		<Image imageID="&rsItems1;" imageX="0" imageY="96" imageWidth="96" imageHeight="96"/>

	</ItemType>

</TranscendenceExtension>
Mischievous local moderator. She/Her pronouns.
sdw195
Militia Captain
Militia Captain
Posts: 779
Joined: Wed Nov 18, 2009 1:01 am
Location: Still looking for the csc Antarctica
Contact:

Code: Select all

<Events>
         <OnCreate>
(sysAddObjTimerEvent 5 gsource "Detonate")
         </OnCreate>
      
<Detonate>
(block nil 
(make heaps of explosions here)
)
<!-- syscreateweaponfire blah blah blah ;) -->
</Detonate>
      </Events>
should work i think
Image
Image
Image
Image
"Dash_Merc - George is a genius, in that he created this game engine that is infinitely extendable"
"<@sheepluva>Good night everybody, may the source be with you." <-- FOSG dev
"You only need THREE tools in life - WD-40 to make things go, Duct Tape to make things stop And C-4 to make things go away"
User avatar
Song
Fleet Admiral
Fleet Admiral
Posts: 2831
Joined: Mon Aug 17, 2009 4:27 am

I love the "blah blah blah"...if I ever get baack to SJ&M, that's going in somewhere...:P
Mischievous local moderator. She/Her pronouns.
sdw195
Militia Captain
Militia Captain
Posts: 779
Joined: Wed Nov 18, 2009 1:01 am
Location: Still looking for the csc Antarctica
Contact:

but did it work??
Image
Image
Image
Image
"Dash_Merc - George is a genius, in that he created this game engine that is infinitely extendable"
"<@sheepluva>Good night everybody, may the source be with you." <-- FOSG dev
"You only need THREE tools in life - WD-40 to make things go, Duct Tape to make things stop And C-4 to make things go away"
shanejfilomena
Fleet Officer
Fleet Officer
Posts: 1533
Joined: Tue Mar 22, 2011 8:43 pm
Location: Alaska
Contact:

5 is kind of short?
I thought the standard was 100 because I found it that way: <Events>
<OnDestroy>
(block Nil
(plyMessage gPlayer "You haven't seen the last of me!!!! BOOM!")
(sysAddObjTimerEvent 100 gSource "Kaboom")
)
</OnDestroy>
( deleted the Kaboom: it did not work anyway )
</Events>
I tried that code once: system did not understand Kaboom...killed it but then my spawn failed...back to not getting things to work......
Flying Irresponsibly In Eridani......

I don't like to kill pirates in cold blood ..I do it.. but I don't like it..
Drako Slyith
Fleet Officer
Fleet Officer
Posts: 1036
Joined: Wed Feb 03, 2010 4:28 am
Location: Researching how to make St. Kats star go supernova.
Contact:

You can't put in timers on overlays. What you can do is this:

Code: Select all

<OnUpdate>
(sysCreateWeaponFire ___________________)
</OnUpdate>
OnUpdate is called every few seconds. It is all that works with overlays. I made a ticket to fix that.
Image
Image
Play in over 100 systems in a network. Play the 2011 Mod Of the Year
and the highest rated mod on Xelerus, The Network.
Play the July Mod of the Month, Fellow Pilgrims!
Play My other mods as well
(Drako Slyith)* I am a person
(Eliza chatbot)> Do you believe it is normal to be a person?
User avatar
Song
Fleet Admiral
Fleet Admiral
Posts: 2831
Joined: Mon Aug 17, 2009 4:27 am

Drako Slyith wrote:You can't put in timers on overlays. What you can do is this:

Code: Select all

<OnUpdate>
(sysCreateWeaponFire ___________________)
</OnUpdate>
OnUpdate is called every few seconds. It is all that works with overlays. I made a ticket to fix that.
Onupdate created a lot of problems when i tried using it before trying this system...so I guess I'll wait until it's patched....once I've tried SDW's code to see if it works well enough.
EDIT: I've borked my syscreateweaponfire code, and I'm tired tonight, so I'll have to wait and see.
Mischievous local moderator. She/Her pronouns.
User avatar
Ttech
Fleet Admiral
Fleet Admiral
Posts: 2767
Joined: Tue Nov 06, 2007 12:03 am
Location: Traveling in the TARDIS
Contact:

I don't know if anyone's suggested it but there are pastebins for this - paste.neurohack.com (For example)
Image
Image
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

Shrike wrote: I just do not know what goes next to actually trigger OFF the timer. I can do a syscreateweaponfire...but not the bit that fires THAT. I've done a little poking around the wiki looking for it, but I'm not good at understanding code.
What you need to do is add an EventHandler in the OnDamageArmor event, not an overlay (well, you will need an overlay anyways if you want a visual effect, but there is nothing stopping you from adding both an overlay and an event handler).

The event handler can have any kind of events and should be added to the target ship. You can then start a timer event on that ship that does what you need. Search vanilla for eventHandler to see its use. You also have these functions:

(objGetEventHandler obj) -> unid or Nil
(objSetEventHandler obj unid) -> True/Nil

Let me know if this makes sense to you... if not I might be able to come up with something you can build on.
Post Reply