Page 2 of 5

Re: models then what?

Posted: 21 Dec 2009, 02:55
by oksnoop2
Success, I finally got my first unit to appear in game. I feel pretty good right now. So what's next? Movement?

Re: models then what?

Posted: 21 Dec 2009, 04:25
by FLOZi
Setting up a proper moveclass would indeed be a good start.

Examples of gamedata/movedefs.lua here:

CA
http://trac.caspring.org/browser/trunk/ ... vedefs.lua

S44
http://spring1944.svn.sourceforge.net/v ... iew=markup

Re: models then what?

Posted: 21 Dec 2009, 05:12
by oksnoop2
So put one of those in the lua file in the scripts folder?

Re: models then what?

Posted: 21 Dec 2009, 06:34
by FLOZi
oksnoop2 wrote:So put one of those in the lua file in the scripts folder?
No, gamedata folder, as I said.

Re: models then what?

Posted: 21 Dec 2009, 07:04
by oksnoop2
Sorry, I get rather anxious and don't read everything as closely as should sometimes. After pasting the one from CA into the movedef lua and starting up the mod. I still can't get my unit to move. Is there something aditional I have to do to tie my unit "static_saucer" to the movedef lua (hope that makes some kind of sense, i really don't know of a good way to phrase it)

Re: models then what?

Posted: 21 Dec 2009, 21:02
by FLOZi
Yes, movementclass tag i.e.

Code: Select all

movementClass       = [[TANK2]],
Worth looking at a full unitdef from CA, I suggest the jeffy:

http://trac.caspring.org/browser/trunk/ ... armfav.lua

Re: models then what?

Posted: 22 Dec 2009, 04:23
by oksnoop2
"Couldn't find unittype static_saucer" This is the message spring gives me. Here is the file i have in my units folder: http://pastebin.com/m61ef60c0

The file is named "static_saucer".


UPDATE: After tinkering with the unittype file i got it to work again. When I go in game my unit now has a "move" command. It still does not move. Is it because I did not "put object on ground" in wings3d? It is supposed to be a flying unit.

Re: models then what?

Posted: 24 Dec 2009, 02:08
by Warrior
this thread makes it sound easy to make a mod :P I might try myself

Re: models then what?

Posted: 24 Dec 2009, 02:28
by Argh
UPDATE: After tinkering with the unittype file i got it to work again. When I go in game my unit now has a "move" command. It still does not move. Is it because I did not "put object on ground" in wings3d? It is supposed to be a flying unit.
If you want it to fly, set these values:

canMove=true,
canFly = true,
maxVelocity=5,
cruiseAlt = 500,
maxAcc = 0.5,

You do not need a movement class, for flying stuff; they have their own special class.

Re: models then what?

Posted: 24 Dec 2009, 05:10
by oksnoop2
cool beans! My saucer, it fly's! So next step is, making it shoot perhaps? or is it something else?

Re: models then what?

Posted: 24 Dec 2009, 06:08
by SinbadEV
you might want to try some animation scripting and shooting, yes.

Re: models then what?

Posted: 24 Dec 2009, 06:37
by oksnoop2
Can some one direct me to a link on next step?

Re: models then what?

Posted: 26 Dec 2009, 15:59
by Argh
OK... animation.

Simplest way to learn: read the stuff in the Wiki... then study existing code. IDK what's currently best to read, in terms of good "newbie code". NanoBlobs was OK, but it would be teaching people to do a few things wrongly / inefficiently now, compared to P.U.R.E., and P.U.R.E.'s animation code is pretty complex and not terribly well commented. I honestly think we (the experienced animators) need to write some simpler, well-commented examples out to feed the Wiki with.

I will post some animation code here, but there is still no real guide for the basics that covers things very well (I've been thinking about writing one, this issue bothers me, because it's such a big newbie trap). There are various guides that cover parts here and there, but none of them end up being all that coherent (imo).

This assumes that you have three named Pieces (which may be nulls, if your model permits it): firepoint, turret, barrel.

Code: Select all


RestoreAfterDelay()
{
//wait approximately 5 seconds
 	sleep 5000;
//turn the barrel and the turret back to the home position
 	turn turret to y-axis <0> speed <100.0>;
 	turn barrel to x-axis <0> speed <100.0>;
	return(0);
}

AimFromWeapon1 (piecenum)
{
//What piecenum do we use to check and see if we're aiming the right way?
	piecenum = firepoint;
}

AimWeapon1(heading, pitch)
{
//Locks up that turret, so that nothing else can interfere with it until it's done
	signal SIG_AIM1;
 	set-signal-mask SIG_AIM1;

//turn the turret towards the target
	turn turret to y-axis heading speed <100.0>;
//we turn the barrel up / down while the turret turns around
	turn barrel to x-axis 0 - pitch speed <100.0>;

//Wait for the turret to finish turning around
 	wait-for-turn turret around y-axis;
//Wait for that barrel to aim upwards / downwards
 	wait-for-turn barrel around x-axis;
 //If we're ready to fire, start the timer on recovery.
 	start-script RestoreAfterDelay(); 
//FIRE!
 	return(TRUE);  
}


QueryWeapon1(piecenum)
{
//Where is our shot coming from?
	piecenum = firepoint;
	return(0);
}

Shot1()
{
//do cool FX or whatever here
}

FireWeapon1()
{
//you can also do cool FX or whatever here, but I prefer Shot()
}

Re: models then what?

Posted: 26 Dec 2009, 21:13
by FLOZi
N.B. as Argh neglected to mention, that is BOS animation code

Re: models then what?

Posted: 26 Dec 2009, 23:34
by oksnoop2
thanks for telling me it was BOS

Re: models then what?

Posted: 27 Dec 2009, 08:00
by oksnoop2
..are there any lua examples?

Re: models then what?

Posted: 27 Dec 2009, 14:45
by SinbadEV
you might need to post in the Lua forum

Re: models then what?

Posted: 27 Dec 2009, 17:35
by Argh
I don't have any Lua examples written yet. Was kinda thinking FLOZi would, they (the S'44 team) has been in the forefront of using this new technology, I haven't had time to catch up yet.

Re: models then what?

Posted: 28 Dec 2009, 21:02
by oksnoop2
What directory of the mod would this animation code go in? And is it the same place for both lua and cob?

Re: models then what?

Posted: 28 Dec 2009, 21:30
by Argh
Both Lua and COB go into the scripts directory.