Mod Question Repository... Questions come in, answers go out - Page 9

Mod Question Repository... Questions come in, answers go out

Resources to get you going on your new project, or to help you over some emergent problems during your development cycle.

Moderator: Moderators

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

Post by FLOZi »

Snipawolf wrote:250 times? Nope.

Is there any way to make a transport load units up at a specific part or parts?
Specific part of the transport, or specific part of the loaded unit?

Yes to the former, anyway
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

A specific part of the transport.
User avatar
Abokasee
Posts: 222
Joined: 03 Nov 2006, 21:51

Post by Abokasee »

whats something good which I can do animations (you know the .cob files) on? because, like most people I can't understand the ramdom letters and numbers which it uses.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

We use something called a "brain" for that while writing our BOSs :P.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

Yeah it requires some thinking.

Upspring has a LUA script to export the animation tween to BOS and Servo can do the same. On the other hand, servo is utter crap IMO and Upspring's exporter may have flaws. But the script is openly available to anyone so what ever.
My recommendation is to do keyframe by keyframe in upspring (or 3do builder) and write down the angles for each piece per keyframe.
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post by Peet »

Abokasee wrote:whats something good which I can do animations (you know the .cob files) on? because, like most people I can't understand the ramdom letters and numbers which it uses.
On a more useful note, Scriptor.

Though writing a compiled cob in a hex editor would give you 1259 awesomeness points.
User avatar
Abokasee
Posts: 222
Joined: 03 Nov 2006, 21:51

Post by Abokasee »

P3374H wrote:
Abokasee wrote:whats something good which I can do animations (you know the .cob files) on? because, like most people I can't understand the ramdom letters and numbers which it uses.
On a more useful note, Scriptor.

Though writing a compiled cob in a hex editor would give you 1259 awesomeness points.
Is it worth it?
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

No.
Is there any way to make a transport load units up at a specific part or parts?
Yes.
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

I need some help, making treads look like they rotate...

Script:

Code: Select all

piece base, cannon, turret, barrel, tread1, tread2;

static-var  restore_delay, moving;
#define SIG_AIM				2


Treads()
{
	While(moving);
	hide tread1;
	show tread2;
	sleep 100;
}
Create()
{
	restore_delay = rand(1980,2020);
	hide tread2;
	set moving to 0;
	start-script Treads();
}	
StartMove()
{
set moving to 1;
}

StopMove()
{
set moving to 0;
}

RestoreAfterDelay()
{
	sleep restore_delay;
	turn turret to y-axis <0> speed <70>;
}

AimPrimary(heading, pitch)
{
	signal SIG_AIM;
	set-signal-mask SIG_AIM;
	turn turret to y-axis heading speed <70>;
	turn cannon to x-axis (0-pitch) speed <50>;
	wait-for-turn turret around y-axis;
	wait-for-turn cannon around x-axis;
	return (1);
}

AimFromPrimary(piecenum)
{
	piecenum = turret;
}

QueryPrimary(piecenum)
{
	piecenum = barrel;
}

SweetSpot(piecenum)
{
	piecenum = base;
}
User avatar
Zpock
Posts: 1218
Joined: 16 Sep 2004, 23:20

Post by Zpock »

Code: Select all

Treads() 
{ 
   While(1)
{
if(moving)
{
   hide tread1; 
   show tread2; 
   sleep 100; 
   hide tread2; 
   show tread3;
   sleep 100; 
   hide tread3; 
   show tread1;
   sleep 100;   
}
sleep 100;
}
} 
I think 3 different ones should do it, you need at least 3 to make it possible to see wich way its going.

Code: Select all

StartMove() 
{ 
moving = 1; 
} 

StopMove() 
{ 
moving = 0; 
} 
I dont know if your "set to" stuff works, I'd write it like the above.
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

Hehe, I already made a gif of mine, I don't need three :P

I copied and pasted the two I had into a new file, set em up, then watched as it looked like it spun.

edit: That script crashed me O.o

Spring said at the top that 0 was an unrecognized cob constant...


edit2: My way (Set moving to 1/0) and (moving = 1/0) both crash mah ass!

Wonder what to do now...

Edit3: Well, well, moving = TRUE/moving = FALSE crash too...

.... wtf...?

BTW, someone said I don't need sweetspot anymore... Is that true?
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Post by yuritch »

Snipawolf wrote:

Code: Select all

...
Treads()
{
	While(moving);
	hide tread1;
	show tread2;
	sleep 100;
}
...
This is what crashes Spring. You have an infinite loop here without any delays in it. This is what it probably should have been:

Code: Select all

while(TRUE)
{
  if(moving)
  {
	hide tread1;
	show tread2;
	sleep 100;
	hide tread2;
	show tread1;
  }
  sleep 100;
}
And btw, this:

Code: Select all

set moving to 0; 
means "Use BOS SET/GET operator to change the value of unit variable the number of which is stored in variable moving", this command doesn't change the value of moving itself. This is usually used like that:

Code: Select all

Activate()
{
  set ACTIVATION to 1;
}
or that:

Code: Select all

static-var origSpeed;
...
Create()
{
 ...
 origSpeed = get MAX_SPEED;
 ...
}
...
AimWeapon1()
{
  var curMaxSpeed;
  curMaxSpeed = origSpeed/1000;
  set MAX_SPEED to curMaxSpeed;
  ...
  start-script RestoreWeapon1();
}
RestoreWeapon1()
{
 ...
 set MAX_SPEED to origSpeed;
 ...
}
The second example is to make unit stop when it tries to aim a weapon.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

User avatar
Zpock
Posts: 1218
Joined: 16 Sep 2004, 23:20

Post by Zpock »

animated GIFs work??????????? :shock:
User avatar
lgustavomp
Posts: 27
Joined: 18 Mar 2007, 14:13

Post by lgustavomp »

Hey pep. I want to make 2 questions..

How can i do air units to be able to fire only when it's 'activated'? Or if you prefer.. when it's not landed.

And.. is there a way to restrict the aim pitch by certain angle? Both in X and Y. I know the weaponmaindir on FBI to in X aim. But i really need to know in Y.

Ex: I have that plane... and it has turreted weapons above their wings. So i don't want those firing though the wings. That means the turret can only fire betwee 0├âÔÇÜ├é┬║ and -90├âÔÇÜ├é┬║ Y (if -90 really means 'look down')

there's the script. And thx in advance.

Code: Select all

#define TA			// This is a TA script

#include "sfxtype.h"
#include "exptype.h"

piece  base, jets, wing1, wing2, nose, vertjet1, vertjet2, turret1, barrel1, flare1, 
turret2, barrel2, flare2, turret3, barrel3, flare3;

static-var  Static_Var_1, Static_Var_2;


activatescr()
{
	if( TRUE )
	{
		turn jets to x-axis <0.> now;
		turn jets to x-axis <90.> speed <62.>;
		turn wing1 to y-axis <0.> now;
		turn wing1 to y-axis <-91.> speed <62.>;
		turn wing2 to y-axis <0.> now;
		turn wing2 to y-axis <90.> speed <62.>;
		sleep 1457;
	}
	sleep 6;
}

deactivatescr()
{
	if( TRUE )
	{
		turn jets to x-axis <90.> now;
		turn jets to x-axis <0.> speed <62.>;
		turn wing1 to y-axis <-91.> now;
		turn wing1 to y-axis <0.> speed <63.>;
		turn wing2 to y-axis <90.> now;
		turn wing2 to y-axis <0.> speed <62.>;
		sleep 1446;
	}
	sleep 4;
}

SmokeUnit(healthpercent, sleeptime, smoketype)
{
	while( get BUILD_PERCENT_LEFT )
	{
		sleep 400;
	}
	while( TRUE )
	{
		healthpercent = get HEALTH;
		if( healthpercent < 66 )
		{
			smoketype = 256 | 2;
			if( Rand( 1, 66 ) < healthpercent )
			{
				smoketype = 256 | 1;
			}
			emit-sfx smoketype from base;
		}
		sleeptime = healthpercent * 50;
		if( sleeptime < 200 )
		{
			sleeptime = 200;
		}
		sleep sleeptime;
	}
}

InitState()
{
	Static_Var_1 = 1;
	Static_Var_2 = 0;
}

RequestState(requestedstate, currentstate)
{
	if( Static_Var_2 )
	{
		Static_Var_1 = requestedstate;
		return (0);
	}
	Static_Var_2 = 1;
	currentstate = Static_Var_1;
	Static_Var_1 = requestedstate;
	while( Static_Var_1 != currentstate )
	{
		if( Static_Var_1 == 0 )
		{
			call-script activatescr();
			currentstate = 0;
		}
		if( Static_Var_1 == 1 )
		{
			call-script deactivatescr();
			currentstate = 1;
		}
	}
	Static_Var_2 = 0;
}

Create()
{
	call-script InitState();
	start-script SmokeUnit();
	hide flare1;
	hide flare2;
	hide flare3;
	turn turret1 to y-axis <-45> now;
	turn turret2 to y-axis <180> now;
	turn turret3 to y-axis <45> now;
}

Activate()
{
	start-script RequestState(0);
}

Deactivate()
{
	start-script RequestState(1);
}

RestoreAfterDelay()
{
	sleep 5000;
	turn turret1 to y-axis <-45> speed <90.>;
	turn turret1 to x-axis <0.> speed <90.>;
	turn turret2 to y-axis <180> speed <90.>;
	turn turret2 to x-axis <0.> speed <90.>;
	turn turret3 to y-axis <45> speed <90.>;
	turn turret3 to x-axis <0.> speed <90.>;
	wait-for-turn turret1 around y-axis;
	wait-for-turn turret1 around x-axis;
	wait-for-turn turret2 around y-axis;
	wait-for-turn turret2 around x-axis;
	wait-for-turn turret3 around y-axis;
	wait-for-turn turret3 around x-axis;
}

//Bombs
QueryWeapon1(piecenum)
{
	piecenum = base;
}

//NorthWest Turret
AimWeapon2(heading, pitch)
{
		signal 4;
		set-signal-mask 0;
		set-signal-mask 4;
		turn turret1 to y-axis heading speed <280.>;
		turn turret1 to x-axis <0.> - pitch speed <280.>;
		wait-for-turn turret1 around y-axis;
		wait-for-turn turret1 around x-axis;
		start-script RestoreAfterDelay();
		return (1);
}

QueryWeapon2(piecenum)
{
	piecenum = flare1;
}

AimFromWeapon2(piecenum)
{
	piecenum = turret1;
}

//South Turret
AimWeapon3(heading, pitch)
{
		signal 8;
		set-signal-mask 0;
		set-signal-mask 8;
		turn turret2 to y-axis heading speed <280.>;
		turn turret2 to x-axis <0.> - pitch speed <280.>;
		wait-for-turn turret2 around y-axis;
		wait-for-turn turret2 around x-axis;
		start-script RestoreAfterDelay();
		return (1);
}

QueryWeapon3(piecenum)
{
	piecenum = flare2;
}

AimFromWeapon3(piecenum)
{
	piecenum = turret2;
}

//NorthEast Turret
AimWeapon4(heading, pitch)
{
		signal 16;
		set-signal-mask 0;
		set-signal-mask 16;
		turn turret3 to y-axis heading speed <280.>;
		turn turret3 to x-axis <0.> - pitch speed <280.>;
		wait-for-turn turret3 around y-axis;
		wait-for-turn turret3 around x-axis;
		start-script RestoreAfterDelay();
		return (1);
}

QueryWeapon4(piecenum)
{
	piecenum = flare3;
}

AimFromWeapon4(piecenum)
{
	piecenum = turret3;
}

Killed(severity, corpsetype)
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

It should be obvious how to prevent firing while landed. If Activate() hasn't been called since the last Deactivate() call it's landed, the rest is trivial.

You cannot limit X and Y traverse separately, you have to aim the WeaponMainDir right and hope you can find an angle that gives you the desired traverse. Also WeaponMainDir applies to both axises.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

Zpock wrote:animated GIFs work??????????? :shock:
Huh?
El Idiot
Posts: 147
Joined: 01 Feb 2007, 00:58

Post by El Idiot »

Here's my noobish questions for the repository I guess:
On the spot mod idea, had to ask.

The more your 'losing' the more powerful your comm becomes.
In res production, all nanolathing speeds, max health, armor, weaponry damage etc.

How would it sense you 'losing' though? Kill count? # of working units? The size of your map 'influence'? Some combination?

Always bugged me in TA when it reaches a point when one side is definatly losing, but it still takes a lot of time to finish it. This would make the outcome more debatable, and require a quick finish while it's still in your favor to win. Though almost losing could be a legit tactic with this. Lol.

Or is this too much in game stat editing/internal communication for the engine currently?

---------

Question 2:
An air transport that can carry units upside down, allowing the combo to shoot downward like a gunship. Possible?
Woo penetrator gunships! :-)
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

I know how to make a (very complex and requiring incredibly boring to write table) script calculating the total metal worth of living units of each player, and that would be a very good indication of who has the upper hand and by how much. I'm sure trepan could do the same in three LUA lines.

I don't know exactly how to progressively make a commander more or less powerful, but I'm sure that especially in the upcoming v0.75 it'll be possible.
---------
Transports can let the unit their transport fire, by having the IsFirePlatform=1; FBI tag.

I think units transported cannot be turned upside down, as they keep their own orientation disregarding the angle of the transport and the angles of the piece they are attached to. Not totally sure here.
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post by Peet »

Currently units in a transport are angled as if they were sitting on the terrain they are currently over. Next version there is an FBI tag for the transport to lock the transported unit to the transport's rotation.
Locked

Return to “Game Development Tutorials & Resources”