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

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
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

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

Post by bobthedinosaur »

2 questions:

1)
CobError: Unknown opcode 0 (in scripts/bluvr.cob:Killed at 210)
What is most likly causing this (btw there is no line 210 it ends before that)

2)
I have vlaunch missile that in the vertical stage its model doesnt show up but once it hits its apex the model becomes visible, anyone have a similar problem or know why this happening?
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

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

Post by yuritch »

For the 1) - try to recompile the script. Sometimes Scriptor produces strange code (or maybe the cob just got damaged in some way). If the error persists, then post the bos here.
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

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

Post by bobthedinosaur »

error:
CobError: Unknown opcode 0 (in scripts/bluvr.cob:Killed at 210)

Script:

Code: Select all

#define TA			// This is a TA script

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

piece  base, turret, fp1, w1, w2, w3, w4, wspare;
static-var  mheading, restore_delay, regview, regspeed;


#ifndef MAX_SPEED
#define MAX_SPEED 75 
#endif

#ifndef LOS_RADIUS
#define LOS_RADIUS 85
#endif

// Signal definitions
#define SIG_AIM				2
#define SIG_MOVE			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;
	}
}

turncheck()
{
	
	while( TRUE )
	{
		mheading = get 82;
		if( mheading < <-45> ) // 8910 = 45 degrees times the angular constant of 182, so you don't need the <>'s
		{
			mheading = <-45>;
			turn w1 to y-axis <-30> speed <150.000000>;
			turn w2 to y-axis <-30> speed <150.000000>;
		}
		
		if( mheading > <45> )
		{
			mheading = <45>;
			turn w1 to y-axis <30> speed <150.000000>;
			turn w2 to y-axis <30> speed <150.000000>;
		}
		
		if( mheading > <-45> AND mheading < <45> )
		{
			turn w1 to y-axis <0> speed <150.000000>;
			turn w2 to y-axis <0> speed <150.000000>;
		}		
	sleep 1000;	//check every second
	}

}

StartMoving()
{

	signal SIG_MOVE;
	set-signal-mask SIG_MOVE;
	spin w1 around x-axis speed <400.159341> accelerate <160.00000>;
	spin w2 around x-axis speed <400.159341> accelerate <160.00000>;
	spin w3 around x-axis speed <400.159341> accelerate <160.00000>;
	spin w4 around x-axis speed <400.159341> accelerate <160.00000>;
	start-script turncheck();
}

StopMoving()
{
	signal SIG_MOVE;
	spin w1 around x-axis speed <0> accelerate <-140.00000>;
	spin w2 around x-axis speed <0> accelerate <-140.00000>;
	spin w3 around x-axis speed <0> accelerate <-140.00000>;
	spin w4 around x-axis speed <0> accelerate <-140.00000>;
	turn w1 to y-axis <0> speed <150.000000>;
	turn w2 to y-axis <0> speed <150.000000>;
}

undeploy()
{
	sleep 2000;	
	set MAX_SPEED to regspeed;
	set LOS_RADIUS to regview;
}

deploy()
{
	set MAX_SPEED to 1;
	sleep 2000;
	set LOS_RADIUS to (regview * 2);
}

Toggle(t,value) 
{

if(t==1)
	{
if(value==1)
{
call-script deploy();
}

if(value==0)
{
call-script undeploy();	
}
	}

}

Create()
{
	regspeed = get MAX_SPEED;
	regview = get LOS_RADIUS;
	start-script SmokeUnit();
}

SetMaxReloadTime(Func_Var_1)
{
	restore_delay = Func_Var_1 * 2;
}

RestoreAfterDelay()
{
	sleep restore_delay;	
	set-signal-mask 0;
	turn w1 to y-axis <0.000000> speed <100.000000>;
	turn w2 to y-axis <0.000000> speed <100.000000>;
	turn turret to y-axis <0> speed <100.071429>;
	turn turret to x-axis <0> speed <100.071429>;
}

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

FirePrimary()
{
}

AimFromPrimary(piecenum)
{
	piecenum = turret;
}

QueryPrimary(piecenum)
{
	piecenum = fp1;
}

SweetSpot(piecenum)
{
	piecenum = base;
}

Killed(severity, corpsetype)
{
	if( severity <= 99 )
	{
		corpsetype = 3;
		explode w1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1;
		explode base type BITMAPONLY | BITMAP2;
		explode w2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
		explode turret type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP5;
		return (0);
	}
}
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

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

Post by KDR_11k »

Add a return at the end of Killed or something?
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

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

Post by yuritch »

Hmm, probably yes. Make the Killed() function be like this:

Code: Select all

Killed(severity, corpsetype)
{
   if( severity <= 99 )
   {
      corpsetype = 3;
      explode w1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1;
      explode base type BITMAPONLY | BITMAP2;
      explode w2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
      explode turret type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP5;
   }
   return (0);
}
The return in moved out of if, so it's called even if severity>99.
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

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

Post by bobthedinosaur »

yah, i got. now why are my vertical missiles invisible the 1st stage?

edit:
ooh even better, now they hover in invisible mode right above the pad, and then come out of no where side ways 10 feet above the ground and explode. this is fucking sweet.
I need to make more weapons like this.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

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

Post by FLOZi »

bobthedinosaur wrote:yah, i got. now why are my vertical missiles invisible the 1st stage?

edit:
ooh even better, now they hover in invisible mode right above the pad, and then come out of no where side ways 10 feet above the ground and explode. this is fucking sweet.
I need to make more weapons like this.
Missing starting velocity?
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

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

Post by bobthedinosaur »

that helped the floating missiles, but i can not figure out the missing weapon model.

EDIT: if any one is experiencing this problem, its an engine bug and was fixed in version 80.4.2
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

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

Post by bobthedinosaur »

is it possible to find the mass of a unit a transport is carrying?
User avatar
Erik
Posts: 283
Joined: 20 Aug 2009, 20:49

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

Post by Erik »

Whats wrong with my particles system? No matter what i do, it always only shows up as a yellow dot following my missile.
Can anyone help?

Code: Select all

[Trail1] {
useDefaultExplosions = 0;

[SMALLFLASH]
 {
class=CSimpleParticleSystem;
		[properties]
		{
		alwaysVisible=0;
		Texture=smoke01;
		sizeGrowth=1.2;
		sizeMod=1.0;

        pos 		= 0,0,0; //r-3 r3, 1.5, r-3 r3;
       	emitVector	= 0, 0, 0;
		gravity		= 0, 0.05, 0;

		colorMap	= 0.6 0.6 0.6 0.03  0 0 0 0.0; //1.0 0.5 0.0 0.01	0.5 0.4 0.3 1.0
		airdrag		= 0.7;

		particleLife=50;
		particleLifeSpread=18;

		numParticles=6;

		particleSpeed=0.05;
		particleSpeedSpread=0.01;
		particleSize=2.4;
		particleSizeSpread=0.6;

		emitRot=90;
		emitRotSpread=0;

		directional=1;
		useAirLos=0;
		}
	ground=1;
	air=1;
	count=1;
	}


[Grey]
 {
class=CSimpleParticleSystem;

		[properties]
		{
		alwaysVisible=0;
		Texture=smoke01;
		sizeGrowth=1.2;
		sizeMod=1.0;

        pos 		= 0,0,0; //r-3 r3, 1.5, r-3 r3;
       	emitVector	= 0, 0, 0;
		gravity		= 0, 0.05, 0;

		colorMap	= 0.6 0.6 0.6 0.2  0 0 0 0.0; //1.0 0.5 0.0 0.01	0.5 0.4 0.3 1.0
		airdrag		= 0.7;

		particleLife=400;
		particleLifeSpread=80;

		numParticles=6;

		particleSpeed=0.05;
		particleSpeedSpread=0.01;
		particleSize=2.4;
		particleSizeSpread=0.6;

		emitRot=90;
		emitRotSpread=0;

		directional=1;
		useAirLos=0;
		}
	ground=1;
	air=1;
	count=1;
	}
} //DEF-system
User avatar
Erik
Posts: 283
Joined: 20 Aug 2009, 20:49

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

Post by Erik »

Whats wrong with my particles system? No matter what i do, it always only shows up as a yellow dot following my missile.
Can anyone help?

Code: Select all

[Trail1] {
useDefaultExplosions = 0;

[SMALLFLASH]
 {
class=CSimpleParticleSystem;
		[properties]
		{
		alwaysVisible=0;
		Texture=smoke01;
		sizeGrowth=1.2;
		sizeMod=1.0;

        pos 		= 0,0,0; //r-3 r3, 1.5, r-3 r3;
       	emitVector	= 0, 0, 0;
		gravity		= 0, 0.05, 0;

		colorMap	= 0.6 0.6 0.6 0.03  0 0 0 0.0; //1.0 0.5 0.0 0.01	0.5 0.4 0.3 1.0
		airdrag		= 0.7;

		particleLife=50;
		particleLifeSpread=18;

		numParticles=6;

		particleSpeed=0.05;
		particleSpeedSpread=0.01;
		particleSize=2.4;
		particleSizeSpread=0.6;

		emitRot=90;
		emitRotSpread=0;

		directional=1;
		useAirLos=0;
		}
	ground=1;
	air=1;
	count=1;
	}


[Grey]
 {
class=CSimpleParticleSystem;

		[properties]
		{
		alwaysVisible=0;
		Texture=smoke01;
		sizeGrowth=1.2;
		sizeMod=1.0;

        pos 		= 0,0,0; //r-3 r3, 1.5, r-3 r3;
       	emitVector	= 0, 0, 0;
		gravity		= 0, 0.05, 0;

		colorMap	= 0.6 0.6 0.6 0.2  0 0 0 0.0; //1.0 0.5 0.0 0.01	0.5 0.4 0.3 1.0
		airdrag		= 0.7;

		particleLife=400;
		particleLifeSpread=80;

		numParticles=6;

		particleSpeed=0.05;
		particleSpeedSpread=0.01;
		particleSize=2.4;
		particleSizeSpread=0.6;

		emitRot=90;
		emitRotSpread=0;

		directional=1;
		useAirLos=0;
		}
	ground=1;
	air=1;
	count=1;
	}
} //DEF-system
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

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

Post by Argh »

Use an AirDrag much closer to 1.0, and higher initial velocities- say, 0.5.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

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

Post by KDR_11k »

EmitVector should not be zero, all speeds are relative to the vector and a vector of size 0 means all velocities are 0.
User avatar
Erik
Posts: 283
Joined: 20 Aug 2009, 20:49

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

Post by Erik »

Code: Select all

 cegtag                  = "Trail1",  
is that call right? Im just curious because no matter what i change i always get the same yellow dot D:
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

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

Post by smoth »

ceg tag is used for missile trails. Is that what you are trying for?
User avatar
Erik
Posts: 283
Joined: 20 Aug 2009, 20:49

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

Post by Erik »

A missile trail. Well it isn't quite trail-ish, its just a yellow dot :|
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

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

Post by bobthedinosaur »

I was wondering if any one has measured all the units of scale thrown around in the game, to see what they relate to each other? such as weapon range vs speed, vs map size, vs building XZ, vs upspring script scale, vs hitsphere size

one i noticed is shield weapon size and hit sphere are the same but other weapon ranges are kind of funky when compare to shield size.
Saktoth
Zero-K Developer
Posts: 2665
Joined: 28 Nov 2006, 13:22

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

Post by Saktoth »

There is a page on the CA wiki with a lot of the conversion ratios for distances etc in Spring that zerg made up, dunno if it includes everything.
http://trac.caspring.org/wiki/UnitsOfMeasurement
CA site is being a spaz atm though so forgive it if it borks.
User avatar
PTSnoop
Posts: 97
Joined: 09 Sep 2009, 19:05

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

Post by PTSnoop »

Are there any simple examples of the Lua unit scripting system? So far, all I've found is the spring1944 GerTiger example, which is better than nothing but is still a bit complicated and intimidating, especially when I've not really done any Lua coding before.

What I could really do with is an example brick (no animation, just drives around), a brick with a rotating firing turret, an brick builder with a rotating building turret, and a building that can build other units. Basically 1, 3, 12, and 6 from http://springrts.com/wiki/Animation-CobExamples .

Or if someone could point me to any mods around that actually use Lua instead of BOS/COB (I've not found any), that'd be great either.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

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

Post by FLOZi »

Here is the Arm stumpy script converted to lua:

http://pastebin.com/f7fc0a0dc

Which should equate to 3 on that list.
AFAIK there are no mods that use lua unit scripts yet, it was only released in the latest engine version afterall.
Locked

Return to “Game Development Tutorials & Resources”