GPL Code Repository - Page 2

GPL Code Repository

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

SpikedHelmet
MC: Legacy & Spring 1944 Developer
Posts: 1948
Joined: 21 Sep 2004, 08:25

Post by SpikedHelmet »

Sheesh, yes of course I tried it by making him kill enemy units... I'm not that much of an idiot. I set it to < 10 (and had him gain 10 exp).
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

Experience < 10 or Experience < 0.1? The latter is 10 XP (at least I think so).
You could take a look at OP's War Evo, it's full for XP based weaponry.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

I've had infantry in GINTA gain additional firepower and infinite ammo if their experience was > 1.00 and that worked perfectly.
SpikedHelmet
MC: Legacy & Spring 1944 Developer
Posts: 1948
Joined: 21 Sep 2004, 08:25

Post by SpikedHelmet »

We got it working. 10 is very hard to get (for these infantry atleast) but we'll try to work something out..!
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Code?
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Post by Guessmyname »

SpikedHelmet wrote:infantry having limbs torn in showers of blood
I have, actually, already managed this.
User avatar
Zoombie
Posts: 6149
Joined: 15 Mar 2005, 07:08

Post by Zoombie »

I demand a demonstration!
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

Red CDirt for the win, eh? :)
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

SpikedHelmet wrote:We got it working. 10 is very hard to get (for these infantry atleast) but we'll try to work something out..!
When get VETERAN_LEVEL returns 10 the unit has 0.10 experience.
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

lol...
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

Simple script calculating the angle a unit turned

Code: Select all

// Add GPL header here, I'm lazy I know
#define ANIM_SPEED 37.5

TurnControl()
{
	var RefreshRate, UnitHeading, TurnAngle;
	RefreshRate = ANIM_SPEED;

	UnitHeading = get XZ_ATAN(7); // XZ_ATAN(0) or any other small value do all return the angle from the current heading to the north. If the unit is facing to the north the angle is 0, if it is facing to the south it's 32768 (or 180° or <180>).

	
	while (TRUE)
	{
		sleep RefreshRate;

		UnitHeading = get XZ_ATAN(7) - UnitHeading; // This is the distance the unit turned after time RefreshRate. The value of UnitHeading can vary. The lower RefreshRate the smaller the value; the higher the TurnRate (in the FBI), the larger the value. edit: Changed this so that left is in the negatives and right is positive.

		if (UnitHeading != 0) // UnitHeading is 0 when the unit stands still
		{
			// Reset if the directions change
			if ((UnitHeading < 0 AND TurnAngle > 0) OR (UnitHeading > 0 AND TurnAngle < 0)) TurnAngle = 0;
			
			// Adding to the angle over time
			TurnAngle = TurnAngle + UnitHeading;
			
			// Do stuff if TurnAngle >= 45° to the left
			else if (TurnAngle <= -8192)
			{

			}
			// Do stuff if TurnAngle >= 45° to the right
			else if (TurnAngle >= 8192)
			{

			}
			else
			{
				// Do stuff other stuff, like resetting something.
			}
		}
		else
		{
			TurnAngle = 0;
			// Do other stuff, like resetting something.
		}
		UnitHeading = get XZ_ATAN(7); // New last heading of the next iteration
	}
}
Create()
{
	...
	start-script TurnControl();
}
It's not a complete unit script but a small function get the real TurnAngle of a unit when it's turning, even when it's rotating in place. It doesn't need any other pieces on the model nor does it depend on a fixed refresh rate.

Can have various uses, I'm using it to reverse the tracks on a tank when it's turning and it works just fine (finally).

Also some thanks fly out to zwzsg, probably wouldn't be a bit further if he didn't explain some stuff to me (concerning XZ_ATAN) and KDR as well, that counter rawks 8)
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

Could FloZi or someone put how to make tank treads look like they roll?
User avatar
PauloMorfeo
Posts: 2004
Joined: 15 Dec 2004, 20:53

Post by PauloMorfeo »

This stuff will get lost whenever people stop posting in it and, eventually, gets out of 1st page...

Stick it or add all that code samples to the wiki?
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

I don't think so, It will get stickied most likely, if not I'll bump it to life... A lot.. I don't wanna see these peoples time and effort wasted..
SpikedHelmet
MC: Legacy & Spring 1944 Developer
Posts: 1948
Joined: 21 Sep 2004, 08:25

Post by SpikedHelmet »

Snipawolf wrote:Could FloZi or someone put how to make tank treads look like they roll?
I second that :S
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

I thought you knew how to do that. o.0
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

SpikedHelmet wrote:
Snipawolf wrote:Could FloZi or someone put how to make tank treads look like they roll?
I second that :S
It's really Argh's tread script implemented in a slightly different manner.

Where he changes geometry, I keep geometry and offset the texture.
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

Well then could Argh post it? Either way doesn't matter, but I would rather the most efficient one..
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

It really depends on the model which method is likely to be better.

i.e. simple treads lend themselves more to mine, but complex modelling of the treads lends itslef to Arghs. Also I imagine thingymajigs script with the reversing treads won't work with mine.
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

Both of ya can post em up then, I guess.
Post Reply

Return to “Game Development”