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

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
Noruas
XTA Developer
Posts: 1269
Joined: 24 Feb 2005, 02:58

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

Post by Noruas »

Need halp, hovers in xta used to turn their whole body relative to how much they are turning and recently since spring release they do barrel roles now, I don't know if its a spring bug but i could use help.

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

piece base, beam, nanogun, door1, door2, plate, post, wake1,
wake2, wake3, wake4, wake5, wake6, wake7, wake8, turret;

static-var Static_Var_1, Static_Var_2, statechg_DesiredState, statechg_StateChanging, Static_Var_5,
Static_Var_6, Static_Var_7;

// Signal definitions
#define SIG_MOVE 2


BankClerck(Func_Var_1, Func_Var_2, Func_Var_3)
{
while( TRUE )
{
Func_Var_1 = get PIECE_XZ(base);
Func_Var_3 = 0;
if( get XZ_HYPOT(Func_Var_1 - Func_Var_2) >= 163840 )
{
Func_Var_3 = 0 - get XZ_ATAN(Func_Var_2 - Func_Var_1) * 60 / 30;
}
turn base to z-axis Func_Var_3 speed <45.0>;
Func_Var_2 = Func_Var_1;
sleep 300;
}
return (0);
}

WobbleUnit()
{
while( get BUILD_PERCENT_LEFT )
{
sleep 400;
}
while( TRUE )
{
if( Static_Var_7 == 1 )
{
move base to y-axis [1.8] speed [1.0];
}
if( Static_Var_7 == 0 )
{
move base to y-axis [0.8] speed [1.0];
}
Static_Var_7 = !Static_Var_7;
sleep 750;
}
return (0);
}

Create()
{
Static_Var_5 = 1;
Static_Var_2 = 0;
start-script WobbleUnit();
start-script BankClerck();
return (0);
}
I could post the whole script if you want more information but what would you add to restrict the hovers banking to a certain degree to keep it from fully flipping over....
SeanHeron
Engines Of War Developer
Posts: 614
Joined: 09 Jun 2005, 23:39

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

Post by SeanHeron »

Hey - why the straight line smily Tobi ? One bug fixed, good job for KingRaptor to have indirectly reported it :). So well done!
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

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

Post by Tobi »

That was from before I fixed it ;-)
User avatar
KingRaptor
Zero-K Developer
Posts: 838
Joined: 14 Mar 2007, 03:44

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

Post by KingRaptor »

Much thanks, Tobi!
User avatar
azaremoth
Cursed Developer
Posts: 549
Joined: 17 Feb 2005, 22:05

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

Post by azaremoth »

I have a probleme with map features not showing up in "The Cursed". I have noticed that County_Crossing-v06. It works with other games, thus something in the cursed seams to block the map features... :(
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 »

No missing feature error messages in the infolog?
User avatar
azaremoth
Cursed Developer
Posts: 549
Joined: 17 Feb 2005, 22:05

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

Post by azaremoth »

KDR_11k wrote:No missing feature error messages in the infolog?
Well - yes - sure. But why can't the features be loaded from the map archive when I start the cursed?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

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

Post by Argh »

Maybe the map is calling for Features that aren't physically present- no model meshes or textures.
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 »

azaremoth wrote:
KDR_11k wrote:No missing feature error messages in the infolog?
Well - yes - sure. But why can't the features be loaded from the map archive when I start the cursed?
Are they actually part of the map or does the map just try to load BA corpses or something?
User avatar
azaremoth
Cursed Developer
Posts: 549
Joined: 17 Feb 2005, 22:05

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

Post by azaremoth »

They are included in the map as far as I see... And I tried it with Evolution RTS - features work there - I can't imagine that this game has dependencies for BA.
Master-Athmos
Posts: 916
Joined: 27 Jun 2009, 01:32

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

Post by Master-Athmos »

Can anyone give info on the way resurrection is handled:
What determines the time needed for the resurrection and what defines the amount of energy needed while doing so?
User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

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

Post by SanadaUjiosan »

I have a quick question. I'm screwing around with very simple Lua animations for some of my buildings, like mex's and power plants, and I want to know if there is a way to make an action repeat in an endless loop (that's not the Spin animation). What I'm wanting is for a part of my mex to move up and down in a slow-mo jackhammer type motion. I looked through what little the wiki had to say on Lua animation, and if it was in there, I didn't see it.
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 »

SanadaUjiosan wrote:I have a quick question. I'm screwing around with very simple Lua animations for some of my buildings, like mex's and power plants, and I want to know if there is a way to make an action repeat in an endless loop (that's not the Spin animation). What I'm wanting is for a part of my mex to move up and down in a slow-mo jackhammer type motion. I looked through what little the wiki had to say on Lua animation, and if it was in there, I didn't see it.
DO A BARREL ROLL!

Or, more usefully, a while loop:

Code: Select all

local function Piston()
  while true do
    -- Move up command
    -- WaitForMove
    -- Move down
    -- WaitForMove
  end
end

function script.Create()
  StartThread(Piston)
end
User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

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

Post by SanadaUjiosan »

While that's totally doing what I'd like it to do, there's a problem.

For whatever reason, the animation quickly begins speeding up, and in a few seconds it's going so fast that my frames hit 1 and the program freezes up. I tested it again, lowering the gamespeed to 0.3, and watched it speed up. It escalates very quickly.

If this is important, I had to take out the --'s you included in the script. When I plugged my own info into what you posted (like the piece name, and the distance and speed and all that), Spring would crash when I tried building one. It'd be fine right up till the moment just before the mex was completed, and then the game would freeze and I had to force quit it.
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 »

SanadaUjiosan wrote:While that's totally doing what I'd like it to do, there's a problem.

For whatever reason, the animation quickly begins speeding up, and in a few seconds it's going so fast that my frames hit 1 and the program freezes up. I tested it again, lowering the gamespeed to 0.3, and watched it speed up. It escalates very quickly.

If this is important, I had to take out the --'s you included in the script. When I plugged my own info into what you posted (like the piece name, and the distance and speed and all that), Spring would crash when I tried building one. It'd be fine right up till the moment just before the mex was completed, and then the game would freeze and I had to force quit it.
Sounds like you didn't fill in the WaitForMoves correctly, they are all that prevents it from freezing up.
User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

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

Post by SanadaUjiosan »

I checked and my WaitForMoves are correct, as far as I can tell. Here is what the whole script looks like, when it breaks and freezes the game.

Code: Select all

local building = piece "building"
local digger = piece "digger"


local function digger_animation()
  while true do
    Move (digger, y_axis, -20, 200)
    WaitForMove (digger, y_axis)
    Move (digger, y_axis, 0, 10)
    WaitForMove (digger, y_axis)
  end
end

function script.Create()
   StartThread(digger_animation)
end

function script.Killed(recentDamage, maxHealth)
   return 0
end
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 »

I guess they aren't sufficient then, stick some Sleeps in too
User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

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

Post by SanadaUjiosan »

Sleeps fixed it. Thanks a lot.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

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

Post by Tobi »

Hmm another bug (instance gets added to UnitScriptEngine multiple times => it ticks more and more times per frame)

Thanks for implicitly reporting it :-)
User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

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

Post by SanadaUjiosan »

lol, awesome! I'm helping the engine!
Locked

Return to “Game Development Tutorials & Resources”