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

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

User avatar
PauloMorfeo
Posts: 2004
Joined: 15 Dec 2004, 20:53

Post by PauloMorfeo »

rattle wrote:Another question: Is it possible to make a high trajectory weapon fire in a lower arc? If so, how?
...
Can you change the speed of a projectile? If not, you only have 2 possible fire arcs, the high and the low ones.

Even though what i'm telling you is so basic that i'm thinking you might be asking something else...
Archangel of Death
Posts: 854
Joined: 28 Jan 2005, 18:15

Post by Archangel of Death »

rattle wrote:Now I've got a question... it's like this:

I've got a unit with a burst weapon which fires twice each burst (dual rocket launcher). So the question is, is there any other function which gets called each time a weapon fires a burst shot? Both FireWeaponX and EndBurstX get only called at the end of a burst which is useless.

The only workaround I can think of is abusing RockUnit, because it's the only function which gets called for any shot fired. Though I don't know if it got called when the unit was hit by a weapon as well. I read somewhere that both RockUnit and HitByWeapon are called then...

All I want to do is distribute the two shots over two firepoints (AND spawning muzzle flashes and extra fancy stuff like exhaust smoke and fire 8)) without relying on scripted reload times or using two weapons and slaving the second to the first AND scripting a delay in. That's entirely possible but it's ugly. I'd rather have one manageable weapon for which I don't need to recompile the script each time I want to change the reload time.
FireWeaponX is called after the first shot of a burst. EndBurstX gets called after the last shot of a burst, but that is unimportant to what your asking. Thus FireWeaponX will switch the barrel for all shots after the first in a burst, and if you only have a two shot burst this works great, for just switching the barrel at least. To get the muzzle flash on the second shot you might try having the EndBurstX function as well.

Worth a try at least! :wink:
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

Copying

Code: Select all

#define MAX_ROUNDS 2 
#define RAND_AMMO rand(10,20) 
#define TIME_BETWEEN_ROUNDS rand(100,500) 
#define RELOAD_TIME 5000 
#define SHOW_RELOAD_SYMBOL show reload_symbol; 
#define HIDE_RELOAD_SYMBOL hide reload_symbol; 

static-var ammo, rounds; 
ammo = RAND_AMMO; 
rounds = MAX_ROUNDS; 

AimWeaponX() 
{ 
   signal SIG_AIM_X; 
   set-signal-mask SIG_AIM_X; 
   if (!ammo OR !rounds) return FALSE; 
   ... 
} 
FireWeaponX() 
{ 
   if (ammo) --ammo; 
   else 
   { 
      if (rounds) --rounds; 
      else 
      { 
         SHOW_RELOAD_SYMBOL 
         sleep RELOAD_TIME; 
         HIDE_RELOAD_SYMBOL 
         rounds = MAX_ROUNDS; 
      } 
      sleep TIME_BETWEEN_ROUNDS; 
      ammo = RAND_AMMO; 
   } 
}

Straight into the script would work? Or would I need to change some stuff....

FINALLY, I just deleted the "start Script" and voila! It compiled!
Edit: Sig_Aim is the only one I know I need to change, I'll keep messing around 'til I am finished..
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

Code: Select all

piece base, turret, mg;

static-var restore_delay;
#define	SIG_AIM1	2
#define SMOKEPIECE1 base
#define MAX_ROUNDS 2 
#define RAND_AMMO rand(25,50) 
#define TIME_BETWEEN_ROUNDS rand(1000,2500) 
#define RELOAD_TIME 7000 
#define SHOW_RELOAD_SYMBOL show reload_symbol; 
#define HIDE_RELOAD_SYMBOL hide reload_symbol; 



static-var ammo, rounds; 
ammo = RAND_AMMO; 
rounds = MAX_ROUNDS;

AimPrimary() 
{ 
   signal SIG_AIM1; 
   set-signal-mask SIG_AIM1;
   turn turret to y-axis heading speed <75>;
   turn turret to x-axis (0 - pitch) speed <50>;
   wait-for-turn turret around y-axis;
   wait-for-turn turret around x-axis;
   if (!ammo OR !rounds) return FALSE; 
} 
FirePrimary() 
{ 
   if (ammo) --ammo; 
   else 
   { 
      if (rounds) --rounds; 
      else 
      {  
         sleep RELOAD_TIME;  
         rounds = MAX_ROUNDS; 
      } 
      sleep TIME_BETWEEN_ROUNDS; 
      ammo = RAND_AMMO; 
   } 
}


Create()
	{
	restore_delay = 2000;
	hide mg;
	}

RestoreAfterDelay()
	{
	sleep 2000;
	turn turret to y-axis 0 speed <100>;
	
	wait-for-turn turret around y-axis;
	return 0;
	}

SweetSpot (piecenum)
	{
	piecenum = base;
	}

QueryPrimary (piecenum)
	{
	piecenum = mg;
	}

AimFromPrimary (piecenum)
	{
	piecenum = turret;
	}
Edit: Says I need ")" on line 1.. Wtf..?

Error =

Code: Select all

Error (1): ')' expected    [ C:\Program Files\TASpring\mods\Forgotten Chronicles\Mongoose.bos ]
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

piece base, turret, mg;

static-var restore_delay;
#define SIG_AIM1 2
#define SMOKEPIECE1 base
#define MAX_ROUNDS 2
#define RAND_AMMO rand(25,50)
#define TIME_BETWEEN_ROUNDS rand(1000,2500)
#define RELOAD_TIME 7000
#define SHOW_RELOAD_SYMBOL show reload_symbol;
#define HIDE_RELOAD_SYMBOL hide reload_symbol;



static-var ammo, rounds;
ammo = RAND_AMMO;
rounds = MAX_ROUNDS;

AimPrimary(heading, pitch)
{
signal SIG_AIM1;
set-signal-mask SIG_AIM1;
turn turret to y-axis heading speed <75>;
turn turret to x-axis (0 - pitch) speed <50>;
wait-for-turn turret around y-axis;
wait-for-turn turret around x-axis;
if (!ammo OR !rounds) return FALSE;
}
FirePrimary()
{
if (ammo) --ammo;
else
{
if (rounds) --rounds;
else
{
sleep RELOAD_TIME;
rounds = MAX_ROUNDS;
}
sleep TIME_BETWEEN_ROUNDS;
ammo = RAND_AMMO;
}
}


Create()
{
restore_delay = 2000;
hide mg;
}

RestoreAfterDelay()
{
sleep 2000;
turn turret to y-axis 0 speed <100>;

wait-for-turn turret around y-axis;
return 0;
}

SweetSpot (piecenum)
{
piecenum = base;
}

QueryPrimary (piecenum)
{
piecenum = mg;
}

AimFromPrimary (piecenum)
{
piecenum = turret;
}
Compiles fine for me except that you forgot to add the parameters to the AimWeapon function. Set scriptor to use TAK as well...
AimPrimary(heading, pitch)
I can't tell you if it works however,
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

Archangel of Death wrote:
rattle wrote:Now I've got a question... it's like this:

I've got a unit with a burst weapon which fires twice each burst (dual rocket launcher). So the question is, is there any other function which gets called each time a weapon fires a burst shot? Both FireWeaponX and EndBurstX get only called at the end of a burst which is useless.

The only workaround I can think of is abusing RockUnit, because it's the only function which gets called for any shot fired. Though I don't know if it got called when the unit was hit by a weapon as well. I read somewhere that both RockUnit and HitByWeapon are called then...

All I want to do is distribute the two shots over two firepoints (AND spawning muzzle flashes and extra fancy stuff like exhaust smoke and fire 8)) without relying on scripted reload times or using two weapons and slaving the second to the first AND scripting a delay in. That's entirely possible but it's ugly. I'd rather have one manageable weapon for which I don't need to recompile the script each time I want to change the reload time.
FireWeaponX is called after the first shot of a burst. EndBurstX gets called after the last shot of a burst, but that is unimportant to what your asking. Thus FireWeaponX will switch the barrel for all shots after the first in a burst, and if you only have a two shot burst this works great, for just switching the barrel at least. To get the muzzle flash on the second shot you might try having the EndBurstX function as well.

Worth a try at least! :wink:
I'm using two weapons now and unlock the second weapon when the first weapon calls it's FireWeapon function. Works just fine and is less complicated... :)
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

Try again, I shall, hope it works...

It compiled! Thanks! :-)

Can't wait to set my unit up, have 'em in game by tonight I bet :mrgreen:
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

Script questioning time...

1: How do I set angles that the unit can only fire on?

2: What are the required parts of a script, only the required ones, and nano stuff?

3: Is it possible to script "cutscenes?"

My idea is to have the units all be part of the background, which will also be "the unit" and then make the cutscene start with on/off. With loads of scripting, of course.

Edit: Forgot one more, do SDD's work in the current build, or do I need SVN?

Edit Again:What is the safe number of tris for something that appears in groups of 100-200?
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

How do I set angles that the unit can only fire on?
Not with the script, but with the FBI. From 0.63b1 changelog:
- Added new fbi tags WeaponMainDir<1-16> and MaxAngleDif<1-16>. WeaponMainDir is a vector and defines the center direction of a cone in which the weapon can aim while MaxAngleDif defines how broad the cone is. Default WeaponMainDir = 0 0 1; (forward) and MaxAngleDif=360; (can fire everywhere)
2: What are the required parts of a script, only the required ones, and nano stuff?
In TA there is none. However this unit crashes Spring. Well, for a cons, I'd use Create(), QueryNanoPiece(p), and probably StartBuilding() & StopBuilding(). Have I already told you to read the bos section of this outdated TA modding doc?
3: Is it possible to script "cutscenes?"
There would be so much and so difficult scripting involved that you don't want it.
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

Okay, thanks for the info...

Of all the things I needed to check, this one didn't say I had a new post when it did :?
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

Got a new question: How fast do the cursor animations play? I hope 100ms or so...


Never mind, they go as fast as frames...
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

Engine frames I assume which is unrelated to FPS.
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

As long as it is similar to 100ms, I should be fine...
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

Both in TA & Spring a tick is 33.33ms, or 1/30 of a second if you prefer.

Actually I never remember if in Spring it's 30 or 33 ms, but who cares?
User avatar
centurion-1
Posts: 169
Joined: 31 Jan 2006, 20:53

Post by centurion-1 »

I have a question:
How would I make a guided mortar type weapon?
It needs to be able to:

-Fire in a high angle like a mortar
-Fire beyond direct LOS (my current method of a missile weapon in trajectoryheight=1 fails at this)
-Track a target until splashdown
-Must be part of a diverse weaponssuit, ie unit tag trajectoryheight wont work

Ive really gone into a wall on this one, tried alot of approaches and none seem to help. MY current approach (see above) is ok but not that good as a support weapon...
User avatar
Min3mat
Posts: 3455
Joined: 17 Nov 2004, 20:19

Post by Min3mat »

Actually I never remember if in Spring it's 30 or 33 ms, but who cares?
33 and it makes a lot of difference with the resources ^^
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

Hmm..

Another question, I was about to make a new topic, but remembered this.

Let's say I got a cube. (Bah, I'm going make a quick image in paint with my pwnage paint skillz :wink: )

Image

So, imagine that the grey is transparency.

Now, imagine this hand on some unit.

Now: The question: What would it look like if it looked like that? I have had no experience with transparency, I would like to know if it displayed the fingers correctly without messing anything up.

Now: Imagine the exact same on the other side.

Would it look like a hand?
User avatar
Maelstrom
Posts: 1950
Joined: 23 Jul 2005, 14:52

Post by Maelstrom »

If the two faces where exactly on top of one another, but facing different directions, it would look like a hand, but completely flat. It would look like the hand had been cut out of paper and stuck on the end of someones arm.
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

Hmm, I got an idea, thanks for the answer.

Is there anyway to give it a 3D feel though? Like making those pieces of paper a lot fatter?
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

Model them? :lol:
Locked

Return to “Game Development Tutorials & Resources”