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

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
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

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

Post by hoijui »

as time passes, spring treats errors in mods more strictly. so i guess you just have some errors in the mod that got ignored in the past.. try to fix them. (invalid wreck info seems to be a good hint, for example).
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 »

Couldnt find wreckage info dgjeagfab
Tend to be the hardest to debug as that message is usually nonsense. Any other errors in the infolog?
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 »

hoijui wrote:(invalid wreck info seems to be a good hint, for example).
It really isn't. :P I've not looked at the code recently so it may have changed, but I've gotten that error many times before for varied reasons; none of them ever to do with the units corpse.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

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

Post by CarRepairer »

FLOZi wrote:
hoijui wrote:(invalid wreck info seems to be a good hint, for example).
It really isn't. :P I've not looked at the code recently so it may have changed, but I've gotten that error many times before for varied reasons; none of them ever to do with the units corpse.
This error is often when the unitdef didn't load properly in the first place, due to syntax errors usually.
LordMuffe
Posts: 286
Joined: 13 Mar 2005, 15:39

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

Post by LordMuffe »

thanks for the input :)

I went through the .fbi files and found the cause. Seems that the new version of spring doesn┬┤t like labs without the YardMap tag nowadays.

After adding that all worked as usual.
User avatar
tyran_nick
Posts: 47
Joined: 07 Mar 2010, 12:42

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

Post by tyran_nick »

Two questions:

1st: Is there a way to make a unit immobile on creation for a given ammount of time? I have a unit that after it is build it has a deployment animation. Can I force it using cob not to move until the script is finished?

2nd: I m having trouble making the same unit leave track marks. I copied and pasted the fbi part about the tracks from a unit that works (4-5 lines). Then I tried different numbers for TrackOffset but I can't get it to work. Is there anything else I am missing? It may be help telling you that the unit has an extreme footpring of 8 by 16.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

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

Post by zwzsg »

1)
Is there a way
There always is! Not even one, but several!
force it using cob not to move

Code: Select all


// Ideally, MAX_SPEED should be defined in a .h
// These three lines make sure it is defined, whether already in a .h or not.
#ifndef MAX_SPEED
#define MAX_SPEED 75
#endif

static-var remember_max_speed;

Create()
{
	remember_max_speed=get MAX_SPEED;
	....
	while(get BUILD_PERCENT_LEFT)//while under construction
	{
		....// some build animation maybe?
		sleep ....; // But have at least a sleep, or else Spring will freeze
	}
	set MAX_SPEED to 1;// For some reason, setting it to 0 doesn't (or didn't?) work. 1 is small enough you won't see it moving.
	...
	// Your undeploy anim
	...
	set MAX_SPEED to remember_max_speed;// Let it move again
}

2) Make all kind of hybrids between the unit that work and the unit that doesn't until you find which trait cause tracks to work or not.
User avatar
tyran_nick
Posts: 47
Joined: 07 Mar 2010, 12:42

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

Post by tyran_nick »

Thanks for the really fast reply!!
It compiles without any problems but it doesn't stop the unit from moving. I ve pasted the create() part

Code: Select all

Create()
{    
    remember_max_speed=get MAX_SPEED;

    move leg1 to x-axis [13.5] now;
    move leg2 to x-axis [-13.5] now;
    move art_door1 to x-axis [7.5] now;
    move art_door2 to x-axis [-7.5] now;
    move feet1 to y-axis [-3.5] now;
    move feet2 to y-axis [-3.5] now;
    move artbase to y-axis [12.5] now;
    move art_b11 to z-axis [7.5] now;
    move art_b21 to z-axis [7.5] now;
    move art_b31 to z-axis [7.5] now;
    move art_b12 to z-axis [20] now;
    move art_b22 to z-axis [20] now;
    move art_b32 to z-axis [20] now;    
    turn arttur to x-axis <-15> now;
    move artside1 to x-axis [5] now;
    move artside2 to x-axis [-5] now;
    while(get BUILD_PERCENT_LEFT)
    {
        sleep 200;
    }   
    Static_Var_1 = 1;
    Static_Var_2 = 1;
    start-script Stop_tur2();
    start-script Stop_tur1();
    spin radar around y-axis speed <-30.000000>;     
    dont-shade tur1_doorb;
    dont-shade tur1_doorf;
    dont-shade tur2_doorb;
    dont-shade tur2_doorf;
    start-script SmokeUnit();
    call-script InitState();    

    set MAX_SPEED to 1;// For some reason, setting it to 0 doesn't (or didn't?) work. 1 is small enough you won't see it moving.

    move feet1 to y-axis [0] speed [10];
    move feet2 to y-axis [0] speed [10];
    turn arttur to x-axis <0> speed <60>;
    turn artrot to y-axis <0> speed <60>;
    wait-for-turn arttur around y-axis;
    wait-for-turn arttur around x-axis;
    move artside1 to x-axis [0] speed [10];
    move artside2 to x-axis [0] speed [10];
    move art_b11 to z-axis [0] speed [10];
    move art_b21 to z-axis [0] speed [10];
    move art_b31 to z-axis [0] speed [10];
    move art_b12 to z-axis [0] speed [10];
    move art_b22 to z-axis [0] speed [10];
    move art_b32 to z-axis [0] speed [10];    
    wait-for-move art_b32 along z-axis;
    move artbase to y-axis [0] speed [10];
    wait-for-move artbase along y-axis;
    move art_door1 to x-axis [0] speed [10];
    move art_door2 to x-axis [0] speed [10];
    move leg1 to x-axis [0] speed [10];
    move leg2 to x-axis [0] speed [10];
    wait-for-move feet2 along y-axis;
    wait-for-move art_door1 along x-axis;
    wait-for-move leg1 along z-axis;
    
set MAX_SPEED to remember_max_speed;// Let it move again

    set ARMORED to 1;
}
User avatar
tyran_nick
Posts: 47
Joined: 07 Mar 2010, 12:42

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

Post by tyran_nick »

Apparently for the tracks I was missing a rather important line...

Code: Select all

leaveTracks=1;
Having that sorted I got a new problem/question. Is there a way to overlay two different track marks? I have made a unit that has 4 tracks that are not in exact alignment (see pics).

Image
Notice that the front and back tracks are not aligned.

Image
Works fine for the back tracks, but not for the front ones.

and this is the track file i used:
Image

Though not apparent from the pic the mark looks ok for both tracks behind the unit, but I haven't found how to make it start nicely for the front tracks.
Is there a way
There always is!
I ll rephrase, what is the way to make the front tracks leave a mark correctly? :-)
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 »

you need to stretch the tracks along the z axis rrr move them forward. I forgot which particular tag it was but i think it is documented in the wiki.
User avatar
tyran_nick
Posts: 47
Joined: 07 Mar 2010, 12:42

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

Post by tyran_nick »

Is there any way to change the turn rate or the turninplace of a unit using cob? I want to make a unit with MAX_SPEED = 1 unable to turn as well.
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 »

You can't do that in cob alone. Sorry, I've tried. you will either have to make a gadget or do the script in lus, by making it immobile.
I didnt know you could set heading. good job yuri
Last edited by bobthedinosaur on 13 Sep 2010, 04:27, edited 1 time in total.
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 »

You CAN do it in cob. Not change the turn rate, but make a unit unable to turn. Like so:

Code: Select all

oldHeading = get HEADING;
while(cannot_turn)
{
   set HEADING to oldHeading;
   sleep 100;
}
This will effectively lock a unit to one direction (100 can be reduced down to 30 = 1 frame if the result doesn't look good).
User avatar
tyran_nick
Posts: 47
Joined: 07 Mar 2010, 12:42

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

Post by tyran_nick »

That worked perfectly! At sleep 100 it was doing a spastic move, but at sleep 30 it was completely still.

EDIT: Next question, is there a way to add a second button apart from activate using cob? I need activation for getting lups work ok with airjets of a flying unit and a button to make the unit deploy. Currently I m using the replace unit lua and two different units + cob scripts, but I guess it should be possible to do it with a nice script. If I have to replace my cob with lua can you provide any example units I should have a look at?
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 »

well I'll be damned. I didn't know you could Set heading. GJ yuri
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 »

Question for cob transports. if there a way to choose which unit is being unloaded? it seems like the 1st unit loaded is the first one off which doesnt help if he needs to be the last one off. maybe i could re attach other parts to take their place? this is all done on external attach points.
User avatar
FireStorm_
Posts: 666
Joined: 19 Aug 2009, 16:09

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

Post by FireStorm_ »

[ 0] LuaRules::RunCallIn: error = 2, GameStart, [string "LuaRules/Gadgets/game_start.lua"]:68: CreateUnit(): bad unitDef name: leo

The problem is probably outside my current skill-spectrum, but I thought I'd ask just in case:
Does anyone know what bad unitDef name: means?
I thought leo is fine name for any unit to have. :)
Forum search did not help.
Can InternalName and UnitName conflict if they are the same? might it be Lua related? point is, I don't know, and hope some can point in the right direction.
SirMaverick
Posts: 834
Joined: 19 May 2009, 21:10

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

Post by SirMaverick »

FireStorm_ wrote:[ 0] LuaRules::RunCallIn: error = 2, GameStart, [string "LuaRules/Gadgets/game_start.lua"]:68: CreateUnit(): bad unitDef name: leo

The problem is probably outside my current skill-spectrum, but I thought I'd ask just in case:
Does anyone know what bad unitDef name: means?
That it's bad/invalid.
I thought leo is fine name for any unit to have. :)
Only if mod maker agrees. unitDef name or unitDef id are used to specify the type of unit you want to create. They are not freely chosen tags. Those names are defined by the mod. E.g. in BA for stumpy you have to use "armstump" or the equivalent unitdef id.

If your mod has a unit named "leo", then look in infolog for other related errors. For example with syntax erros in unit definition files or missing model or textures files the unit won't be loaded and not be available in game.
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 there a way to make larger units effectively push smaller units out of the way when moving at higher speeds, without stopping the larger units or slowing them down drastically as they push. or are we stuck with this? is this the extent of the push system?

ie: 3x4 unit with a mass of 30000 runs into a 1x1 of 100 at full speed, pushes it out of the way, but has to come to a dead stop
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 »

tyran_nick wrote:That worked perfectly! At sleep 100 it was doing a spastic move, but at sleep 30 it was completely still.

EDIT: Next question, is there a way to add a second button apart from activate using cob? I need activation for getting lups work ok with airjets of a flying unit and a button to make the unit deploy. Currently I m using the replace unit lua and two different units + cob scripts, but I guess it should be possible to do it with a nice script. If I have to replace my cob with lua can you provide any example units I should have a look at?
I wrote a toggle gadget that lets you define arbitrary toggle keys for your COB but I don't remember where I used it other than THIS (the mod itself is probably broken now but the script should work).
Locked

Return to “Game Development Tutorials & Resources”