| Author | Message | 
        
			| Exalion 
					Joined: Fri Mar 02, 2007 6:59 am
 Posts: 1726
 Location: NSW, Australia
   |   Interesting and Useful Coding stuff - Tell us yours!Hi all. Occasionally, fairly experienced modders will start a thread either asking for other people's knowledge of coding stuff or reporting their own. I figured it wouldn't be a bad idea to make a thread consisting of weird, wonderful or just plain useful coding tricks. Please post the build it is in though, weird coding tricks can often change as the game develops. To start:  1. B22 - InheritsVel = 1 or 0 fairly self-explanatory really, great when making explosives that aren't TDEs. the weird fact is it goes in the gib code rather than the object code. For example: Code: AddEffect = MOPixelInstanceName = Example
 InheritsVel = 1 or 0
 Mass = 0.0001
 LifeTime = 80
DOES NOT WORK!! Instead, use Code:    AddGib = GibGibParticle = MOSParticle
 CopyOf = Example
 Offset = Vector
 X = -2
 Y = -3
 Count = 50
 Spread = 10
 InheritsVel = 0   <---
 MinVelocity = 20
 MaxVelocity = 15
2. B22 - Attachables and armour piercing. Bullets have the weird habit in this build of passing through some objects with no effect on either. This can mean attachable armour does squat. To get around this, make your armour heavier: It works much better, although really really heavy bullets will still do it occasionally. 3. B21* and any builds before it that allow attachables - Emitters on Devices This is fairly well known, but it's worth putting down: If you put an emitter on a gun, and then put it in your backpack, the emitter slowly builds up: so when you take it out again, it will lag massively, sometimes crashing the game, and let loose all the particles it had saved up. Untill this is fixed, probably best not to put emitters on Devices. Have fun, and PLEASE try to stay on topic! *thanks for the update Azzuki!
 
 
    							Last edited by Exalion on Tue Dec 09, 2008 6:52 am, edited 1 time in total. 
 
 | 
		
			| Mon Dec 08, 2008 5:22 am | 
					
					   | 
	
	
		|  | 
	
			| CrazyMLC 
					Joined: Fri Dec 22, 2006 4:20 am
 Posts: 4772
 Location: Good news everyone!
   |   Re: Interesting and Useful Coding stuff - Tell us yours!This will be a useful thread.Very useful.
 
 
 | 
		
			| Mon Dec 08, 2008 5:28 am | 
					
					     | 
	
	
		|  | 
	
			| Geti 
					Joined: Sun Jul 13, 2008 9:57 am
 Posts: 4886
 Location: some compy
   |   Re: Interesting and Useful Coding stuff - Tell us yours!some tidbits: making a TDExplosive or simmilar not bounce off craft [useful for cannons that use these, and used in the darklone D7] make the material used in the explosive itself bounce = -1 Code: AtomGroup = AtomGroupAutoGenerate = 1
 Material = Material
 CopyOf = Metal
 PresetName = Bomb Metal
 Bounce = -1
 Depth = 0
more coming, cbf typing more code now..
 
 | 
		
			| Mon Dec 08, 2008 5:41 am | 
					
					     | 
	
	
		|  | 
	
			| whitty 
					Joined: Sat Jun 16, 2007 2:31 am
 Posts: 2982
 Location: Texas
   |   Re: Interesting and Useful Coding stuff - Tell us yours!Hmmmm.... Do not make a TDExplosive (or any object for that matter) explode into 2 of itself. For spread: The maximum value it needs is 3.14 (pi). The spread is calculated like a circle, so the max is 3.14 If it is higher, it won't do anything different. More to come. I need to look at some of my odd codes.
 
 | 
		
			| Mon Dec 08, 2008 5:51 am | 
					
					   | 
	
	
		|  | 
	
			| Lord Tim 
					Joined: Fri Apr 27, 2007 4:55 pm
 Posts: 1178
 Location: America!
   |   Re: Interesting and Useful Coding stuff - Tell us yours!whitty wrote: Hmmmm.... Do not make a TDExplosive (or any object for that matter) explode into 2 of itself. For spread: The maximum value it needs is 3.14 (pi). The spread is calculated like a circle, so the max is 3.14 If it is higher, it won't do anything different. More to come. I need to look at some of my odd codes.Technically, if you used 4.71, it should (I have not tested this) spread twice as much in the up direction, and still also spread in the down direction. If it works how I think it works.
 
 | 
		
			| Mon Dec 08, 2008 6:53 am | 
					
					   | 
	
	
		|  | 
	
			| Azukki 
					Joined: Sat Nov 03, 2007 9:44 pm
 Posts: 1916
 Location: Flint Hills
   |   Re: Interesting and Useful Coding stuff - Tell us yours!Exalion wrote: 3. B22 and any builds before it that allow attachables - Emitters on DevicesThis is fairly well known, but it's worth putting down: If you put an emitter on a gun, and then put it in your backpack, the emitter slowly builds up: so when you take it out again, it will lag massively, sometimes crashing the game, and let loose all the particles it had saved up. Untill this is fixed, probably best not to put emitters on Devices.
Actually I was just messing with tim's supergun and this has been fixed with B22. -- ACrabs suffer no recoil from their turret's mounted weapon. I'll be honest and tell you all that I've discovered several things that I'm keeping to myself for the time being and already have in Shadow Echelon. While I'm all for sharing information, I'd like to be the first to use some of my discoveries.
 
 
    							Last edited by Azukki on Mon Dec 08, 2008 11:47 pm, edited 1 time in total. 
 
 | 
		
			| Mon Dec 08, 2008 11:40 pm | 
					
					   | 
	
	
		|  | 
	
			| CrazyMLC 
					Joined: Fri Dec 22, 2006 4:20 am
 Posts: 4772
 Location: Good news everyone!
   |   Re: Interesting and Useful Coding stuff - Tell us yours!Azukki wrote: -- ACrabs suffer no recoil from their turret's mounted weapon.Really? Engine launcher Crab, here I come. My tip is that  in Offsets, think of a grid, then reverse the y axis. - goes up, + goes down. That is how it seems to work. Most people probably already knew that.
 
 | 
		
			| Mon Dec 08, 2008 11:46 pm | 
					
					     | 
	
	
		|  | 
	
			| Azukki 
					Joined: Sat Nov 03, 2007 9:44 pm
 Posts: 1916
 Location: Flint Hills
   |   Re: Interesting and Useful Coding stuff - Tell us yours!crazyMLC wrote: Azukki wrote: -- ACrabs suffer no recoil from their turret's mounted weapon.Really?True story. I modified the dreadnought to fire bullets with the mass of a thousand suns at maximum velocity, and it didn't even flinch, as it instagibbed crafts and raped terrain.
 
 | 
		
			| Mon Dec 08, 2008 11:50 pm | 
					
					   | 
	
	
		|  | 
	
			| No_0ne 
					Joined: Wed Feb 14, 2007 5:37 am
 Posts: 350
   |   Re: Interesting and Useful Coding stuff - Tell us yours!StartSegCount = 
 A snippet of code for walkpaths, it determines how many of the first AddSegments to skip when it doesn't need it. That way actors don't look like stomping morons but are still able to more or less climb steep hills/terrain. It not very useful unless you're devising custom walkpaths though.
 
 
 | 
		
			| Tue Dec 09, 2008 12:19 am | 
					
					     | 
	
	
		|  | 
	
			| Thoughtprocess 
					Joined: Mon Feb 11, 2008 3:42 pm
 Posts: 259
   |   Re: Interesting and Useful Coding stuff - Tell us yours!Code: CopyOf = SomenameNewVar = Somenumber
This will copy the particle or whatever with variables different from the original (for example using vanilla grenade particles but changing the sharpness/mass) You can also do Code: CopyOf = SomenameInstanceName = NewName
 <New Variables>
And then you can call this new instance later with a CopyOf: However, Code: CopyOf = SomenamePresetName
Does not  work as far as I know, it causes wierd errors. Use InstanceName. Also, when using the copy -> new variables method it is only able to replace variables that are naturally only used once in the original definition (ex. you can replace Sharpness' value and use AddGib to add new gibs, but you cannot take away gibs)
 
 | 
		
			| Tue Dec 09, 2008 2:53 am | 
					
					   | 
	
	
		|  | 
	
			| numgun 
					Joined: Sat Jan 13, 2007 11:04 pm
 Posts: 2932
   |   Re: Interesting and Useful Coding stuff - Tell us yours!Rocket's opening animation can be used to have deforming objects like doors for instance. Or large objects that shrink into small or opposite.
 Shells do not produce recoil on guns. And if you set the shell velocity to negative, you can use it as an offensive particle or anything you like. It has a drawback that it aims slightly downwards.
 
 Coalition.rte/Devices/Rifles/Sniper.ini (or what it was called again, dont remember) has a very cool piece of code. The coalition sniper fires a "launcher" aemitter that fires the actual round. You can bypass recoil, add as many particles and different particles as you wish. Study that code since it can be very useful when making advanced weapons.
 
 
 | 
		
			| Tue Dec 09, 2008 3:46 am | 
					
					   | 
	
	
		|  | 
	
			| CaveCricket48 
					Joined: Tue Jun 12, 2007 11:52 pm
 Posts: 13144
 Location: Here
   |   Re: Interesting and Useful Coding stuff - Tell us yours!For less recoil, you don't need all those complicated AEmitters or TDE's. Just make the gun's Tracer Round have the same exact FireVelocity and exact Mass but negative, with a really low LifeTime. For example: Code: AddAmmo = RoundPresetName = Round Really Heavy Bullet
 ParticleCount = 1
 Particle = MOPixel
 PresetName = Particle Really Heavy Bullet
 Mass = 1000                                                 // Note the Uber Mass
 RestThreshold = 500
 LifeTime = 1500
 Sharpness = 250
 HitsMOs = 1
 GetsHitByMOs = 0
 Color = Color
 R = 143
 G = 143
 B = 143
 Atom = Atom
 Material = Material
 CopyOf = Bullet Metal
 TrailColor = Color
 R = 155
 G = 155
 B = 155
 TrailLength = 25
 Shell = MOSParticle
 CopyOf = Casing
 FireVelocity = 1000
 ShellVelocity = 10
 Separation = 5
 
 AddAmmo = Round
 PresetName = Tracer Round Really Heavy Bullet
 ParticleCount = 1
 Particle = MOPixel
 PresetName = Tracer Particle Really Heavy Bullet
 Mass = -1000                                                      // Note the Negatively Uber Mass
 RestThreshold = 500
 LifeTime = 1500
 Sharpness = 250
 HitsMOs = 1
 GetsHitByMOs = 0
 Color = Color
 R = 143
 G = 143
 B = 143
 Atom = Atom
 Material = Material
 CopyOf = Bullet Metal
 TrailColor = Color
 R = 155
 G = 155
 B = 155
 TrailLength = 25
 Shell = MOSParticle
 CopyOf = Casing
 FireVelocity = 1000
 ShellVelocity = 10
 Separation = 5
 
 // Part of a Magazine Code
 RegularRound = Round
 CopyOf = Round Really Heavy Bullet
 TracerRound = Round
 CopyOf = Tracer Round Really Heavy Bullet
And that's it, much simpler than some other stuff.
 
 | 
		
			| Tue Dec 09, 2008 4:49 am | 
					
					   | 
	
	
		|  | 
	
			| whitty 
					Joined: Sat Jun 16, 2007 2:31 am
 Posts: 2982
 Location: Texas
   |   Re: Interesting and Useful Coding stuff - Tell us yours!...Unless the RTT ratio is not set to shoot the other round after one round is shot. 
 
 | 
		
			| Tue Dec 09, 2008 4:51 am | 
					
					   | 
	
	
		|  | 
	
			| CaveCricket48 
					Joined: Tue Jun 12, 2007 11:52 pm
 Posts: 13144
 Location: Here
   |   Re: Interesting and Useful Coding stuff - Tell us yours!whitty wrote: ...Unless the RTT ratio is not set to shoot the other round after one round is shot.Yeah, don't forget to change that to 2. Or else you get a splatered actor.Unless it's a crab.
 
 | 
		
			| Tue Dec 09, 2008 4:54 am | 
					
					   | 
	
	
		|  | 
	
			| numgun 
					Joined: Sat Jan 13, 2007 11:04 pm
 Posts: 2932
   |   Re: Interesting and Useful Coding stuff - Tell us yours!^The above method sucks because you DO get recoil. And you will use 2 shots from your gun and it works only on single shot and stream weapons. And you must have a really fast rate of fire to do it.
 Use AEmitters instead.
 
 
 Seperation on round's code can be used to make a shot wider by setting it to high values. You can also use Seperation to make a beam that phases through walls and objects. Use negative values to make it extend forth and positive to extend backwards.
 
 
 | 
		
			| Tue Dec 09, 2008 1:44 pm | 
					
					   | 
	
	
		|  | 
	
	
		|  |