Page 1 of 1

So 1.2beta's laser effects.....

Posted: Sat Aug 31, 2013 3:38 pm
by Jay2Jay
I cant find them in the xml. When I look at a weapon's xml there is nothing there that tells me what the shot will look like except for the standard "beam" attribute, but there is nothing to distinguish a turbolaser from a bolide or a normal laser shot in the xml, however they are obviously different in game.

This is the code for the turbolaser's weapon attribute

Code: Select all

<Weapon
	type=				"beam"

	damage=				"laser:3d4"
	fireRate=			"12"
	lifetime=			"30"
	powerUse=			"60"

	effect=				"&efLaserBeamDefault;"
	hitEffect=			"&efGreenLaserHitEffect;" 
	sound=				"&snLaserCannon;"
	>
</Weapon>

and this is the laser cannon's

Code: Select all

<Weapon
	type=				"beam"

	damage=				"laser:1d4"
	fireRate=			"10"
	lifetime=			"30"
	powerUse=			"10"

	effect=				"&efLaserBeamDefault;"
	sound=				"&snLaserCannon;"
	>
</Weapon>
Can you see my dilemma?

Re: So 1.2beta's laser effects.....

Posted: Sat Aug 31, 2013 6:56 pm
by RPC
Each weapon damage effect has an effect that looks something like this:

Code: Select all

<EffectType UNID="&efLaserBeamDefault;"
			instance=			"owner"
			>
		<Effect>
			<Ray
					style=			"smooth"
					shape=			"tapered"
					/>
		</Effect>

		<Events>
			<GetParameters>
				;	This event allows us to initialize effect parameters based 
				;	on weapon properties. In particular, we adjust the size of 
				;	the effect based on the amount of average damage.
				;
				;	For weapon effects, gData has the following fields:
				;
				;	damageHP: The average number of hit points of damage.
				;	speed: The speed of the shot (as a percent of lightspeed).
				;
				;	The event must return a structure with each field representing
				;	a parameter for the effect. For Ray effects, valid fields are:
				;	intensity, length, width, primaryColor, and secondaryColor.

				(block (damageHP primaryColor secondaryColor)
					(setq damageHP (@ gData 'damageHP))

					;	Color depends on damage

					(switch
						(geq damageHP 15)
							(block Nil
								(setq primaryColor "#D500FF")
								(setq secondaryColor "#6A00FF")
								)

						(geq damageHP 7)
							(block Nil
								(setq primaryColor "#55FF00")
								(setq secondaryColor "#2A8000")
								)

						(geq damageHP 4)
							(block Nil
								(setq primaryColor "#FF5500")
								(setq secondaryColor "#802A00")
								)

						(block Nil
							(setq primaryColor "#FF0000")
							(setq secondaryColor "#800000")
							)
						)
					
					{
						length:
							(mathScale 
								damageHP						; average damage of weapon
								1								; min damage
								30								; max damage
								60								; min beam length
								220								; max beam length
								50								; scale gamma
								)
						width: (mathScale damageHP 1 30 12 28 50)
						intensity: 35

						primaryColor: primaryColor
						secondaryColor: secondaryColor
						}
					)
			</GetParameters>
		</Events>
	</EffectType>

Re: So 1.2beta's laser effects.....

Posted: Sun Sep 01, 2013 2:29 pm
by Jay2Jay
dafuq..... :shock:

Re: So 1.2beta's laser effects.....

Posted: Sun Sep 01, 2013 8:15 pm
by Jay2Jay
I should clarify, I meant the shot itself, not the actual hit effect.

Re: So 1.2beta's laser effects.....

Posted: Sun Sep 01, 2013 9:37 pm
by digdug
In 1.2 beta the laser and kinetic weapon effects (the actual shot) is generated dynamically by efLaserBeamDefault.

In fact, in every weapon there is an effect (the shot graphics) and a hiteffect (graphics when the weapon hits something)
effect= "&efLaserBeamDefault;"
So, you have to search for efLaserBeamDefault. RPC posted exactly that.

Re: So 1.2beta's laser effects.....

Posted: Sun Sep 01, 2013 11:50 pm
by Jay2Jay
What do you mean by "generated dynamically"?

Re: So 1.2beta's laser effects.....

Posted: Mon Sep 02, 2013 12:12 am
by digdug
read the efLaserBeamDefault code:
lasers will have different colours depending on the average damage of the weapon. Also the size length and width of the beam effect changes depending on the average damage.

Re: So 1.2beta's laser effects.....

Posted: Tue Sep 03, 2013 1:26 am
by Jay2Jay
I get it now thanks digdug-sensei.