two weapons and slave questions lua script

two weapons and slave questions lua script

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
WENEX
Posts: 7
Joined: 27 Oct 2012, 20:40

two weapons and slave questions lua script

Post by WENEX »

Hallo!

I just started modding and have no skills in script languages. I tried the last three hours to find a clue how to make two weapons running:

1) one turret, two guns. my script makes the anims perfect but: How do I make two weapons running? Where is the tutorial?

I like to have a laserbeam. But it has no burst. I like 5 fast shots and than a reload time. The LaserCanon does it, but does not look that good. It always shoots into 1,5) ground somewhere next to the explosion???

2) Is it possible to trigger the LaserBeam as slave of an other Weapon with reloadtime?

I need this also for a simple LaserAimFX. (sorry, bad english)

3) Is there a max turret arc?

4) Can I put more than one SFX on just one piece? (Is this the reason it won't work?)

Maybe I shoot 5 different LaserBeams out of one (or 4) peace to get the effect discribed above, but how could I delay them so that they don't shoot at the same time?

thx
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: two weapons and slave questions lua script

Post by FLOZi »

Sorry, I can't really follow what you're asking for / about here. :(

I think at least partly, you want a weapon which can fire 5 rounds before having to 'reload', but without using the burst mechanism. That can certainly be done through the script in a couple of ways.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: two weapons and slave questions lua script

Post by knorke »

Hi!
How do I make two weapons running?
well for weapon 1 you have these callin functions:
script.AimFromWeapon1
script.AimWeapon1
So for weapon 2 just script it the same but change the 1 to 2 ;)
See here:
http://springrts.com/wiki/Animation-LuaCallins#Weapons
there is also a second way to do it.

3) Is there a max turret arc?
So that a weapon can only shot to the front or side? yes:
http://springrts.com/wiki/Units:WeaponMainDir
4) Can I put more than one SFX on just one piece? (Is this the reason it won't work?)
You can have as many SFX on a piece as you want.
I like to have a laserbeam. But it has no burst. I like 5 fast shots and than a reload time.
With the burst the unit will always fire 5 shots even if the first one already killed the target. Is that your problem?
You can script your own delay/reload thing, it is only a few lines.

I did not understand the other questions, sorry.

Btw if you look at this: http://springrts.com/wiki/SpringTutorialGame
there are some basic scripts to get started.
WENEX
Posts: 7
Joined: 27 Oct 2012, 20:40

Re: two weapons and slave questions lua script

Post by WENEX »

I am german, sorry.

I did just number my weapons, but something went wrong. But I now found the tutorial game with double barrel weapon lua script, maybe I find there whats wrong.

The LaserBeam can not have burst and reload time. The LaserCannon can have this, but makes a graphic bug and only shoots laser bolts.

I like the LaserBeam make bam-bam-bam-bam-bam-wait-wait-wait-...-wait-wait-bam-bam-bam-bam.
As it would work with burst = 5, bustSpeed = 0,20 and reloadTime = 1.0,

As discribed in this forum, LaserBeam can't have burst, and I tried it anyway. It did not work.

The turret arc is so simple, my I wrote it to the wrong place or something. I have to go to work now and look at it tomorow.

Thank you all.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: two weapons and slave questions lua script

Post by smoth »

WENEX wrote:1) one turret, two guns. my script makes the anims perfect but: How do I make two weapons running? Where is the tutorial?
to trigger a weapon shot to be fired as part of another weapon firing you will need to use:
EmitSfx

here is an old code review thread I was doing:
http://springrts.com/phpbb/viewtopic.ph ... fx#p484571 see the emitSfx with the value 2048.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: two weapons and slave questions lua script

Post by knorke »

Actually BeamLaser can have burst: with beamBurst = true

Code: Select all

local weaponName = "beamlasertest"
local weaponDef = {
	     name                    = "beamlaser with burst",
	     weaponType              = [[BeamLaser]],
	     --damage
		 damage = {
			default = 10,
			},
	     areaOfEffect            = 8,
		 --physics
		 weaponVelocity          = 500,
		 reloadtime              = 3,
		 range                   = 350,
		 sprayAngle              = 0,
	     tolerance               = 8000,
		 lineOfSight             = true,	      
	     turret                  = true,
		 craterMult              = 0,	      
		 --apperance
		 rgbColor                = [[1 0.1 0.1]],		  	      
         thickness               = 10,
		 --effects
		 explosionGenerator      = [[custom:redsmoke]],
		 
		beamBurst = true, --this is the important part
		burst                   = 5,
		burstrate               = 0.3,		
		beamTTL = 1,		
		 }
		
return lowerkeys({[weaponName] = weaponDef})
Fires 5 short beams, then reloads. Though if the beams are visible too long (beamTTL) and the unit moves, the beam will appear from thin air:
Image
With short flashes its not noticeable.
WENEX
Posts: 7
Joined: 27 Oct 2012, 20:40

Re: two weapons and slave questions lua script

Post by WENEX »

[quote="knorke"]Actually BeamLaser can have burst: with beamBurst = true

You made my day!

With this info I made the perfect Laserbeam within seconds.

Next on my list is the "two weapons, one turret" problem. I try it with the tips from here, If I fail I will post my code.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: two weapons and slave questions lua script

Post by FLOZi »

WENEX wrote:
knorke wrote:Actually BeamLaser can have burst: with beamBurst = true

You made my day!

With this info I made the perfect Laserbeam within seconds.

Next on my list is the "two weapons, one turret" problem. I try it with the tips from here, If I fail I will post my code.
You may find these pages useful:

http://springrts.com/wiki/Units-WeaponDefs
http://springrts.com/wiki/Units-UnitDefs
Post Reply

Return to “Game Development”