- Gadgets - (Mostly) Synced code, these implement your own game logic, they go in LuaRules/Gadgets directory.
- Widgets - (Mostly) Unsynced code, generally UI elements and related things (like formation move orders), they go in LuaUI/Widgets directory.
- Animations - These are unit animations, a new addition to replace the old TA BOS/COB animations, they go in Scripts directory (well, that is the de facto standard).
N.B. lua animations are actually in 'gadget space' by which I mean they have access to the same callouts as gadgets which lets you do some nifty things once you know what you're doing and is why lua anims are superior to BOS/COB - Defs - Weapon, features and unit defs, go in Weapons, Features and Units directories respectively, these are just a big table of tags which control your unit and weapon attributes.
(N.B. It is quite common to combine weapon and (corpse) feature defs into the unit def)
models then what?
Moderator: Moderators
Re: models then what?
Note that there are 4 types of lua (well, actually, there are more, but there are 4 main types for a fresh-out-the-box modder to concern themselves with)
Re: models then what?
Quick question... assuming that your unitdef and movedef's are correct, should your unit need a script to move about? (I mean, sure I know it will act as one solid lump, but should the solid lump be able to move about?)
- Pressure Line
- Posts: 2283
- Joined: 21 May 2007, 02:09
Re: models then what?
you need a script. but you dont really need a heck of a lot in there.
Re: models then what?
If its cob it just needs the Create(), though it won't self destruct properly without a Killed(). A lua anim can be totally blank, but the file needs to exist.
Re: models then what?
humm, well the blank lua file exists... so maybe I have somthing wrong in my def's... I'll post them up when I get back...
Re: models then what?
My units move around with a blank lua script. They don't shoot and they are not animated. I still can't get this stupid lua script right...
Re: models then what?
http://pastebin.com/m52a9ace6 This is what i think is my animation lua. It's called "hovertank" and it's in the scripts folder. My tank is still not behaving correctly. I'm sure my script is wrong or not complete but i don't know how to fix it. Any suggestions?
Re: models then what?
You're using a variable (piece?) 'body' in QueryWeapon, AimWeapon and Killed, but it's not declared anywhere.
Also note that in the script you can use Spring.Echo(...) statements to display debugging output on the in game console. (and in infolog.txt)
Also note that in the script you can use Spring.Echo(...) statements to display debugging output on the in game console. (and in infolog.txt)
Re: models then what?
After changing my code, i'm still not getting my unit to fire or look animated. Am I correct in my assumption that there are, at the bare minimum, two files that are supposed to animate the unit and control how it fires? The two files i'm referring to are the file in the scripts folder and the file in the units folder.
- Pressure Line
- Posts: 2283
- Joined: 21 May 2007, 02:09
Re: models then what?
yes. it needs a weapon.
example from CA
Code: Select all
weapons = {
{
def = [[LIGHTNING]],
badTargetCategory = [[FIXEDWING]],
onlyTargetCategory = [[FIXEDWING LAND SINK SHIP SWIM FLOAT GUNSHIP HOVER]],
},
},
weaponDefs = {
LIGHTNING = {
name = [[LightningGun]],
areaOfEffect = 8,
beamWeapon = true,
craterBoost = 1,
craterMult = 2,
cylinderTargetting = 0,
damage = {
default = 160,
planes = 160,
subs = 8,
},
duration = 10,
explosionGenerator = [[custom:LIGHTNINGPLOSION]],
fireStarter = 50,
impactOnly = true,
impulseBoost = 0,
impulseFactor = 0.4,
intensity = 12,
interceptedByShieldType = 1,
lineOfSight = true,
noSelfDamage = true,
range = 280,
reloadtime = 1.8,
renderType = 7,
rgbColor = [[0.5 0.5 1]],
soundHit = [[lashit]],
soundStart = [[lghthvy1]],
soundTrigger = true,
startsmoke = [[1]],
targetMoveError = 0.3,
texture1 = [[lightning]],
thickness = 10,
turret = true,
weaponType = [[LightingCannon]],
weaponVelocity = 400,
},
},Re: models then what?
I'm sorry if this seems increasingly lazy of me but i just want to show you the state of my two files. Because it's to my limited understanding that I have everything in working order. It's just not animated or firing though, it's just driving around. Here is my file that goes in the scripts folder: http://pastebin.com/m36ab3670 Here is my file that's in my units folder: http://pastebin.com/m3f5faeb5 . Both are called "hovertank".
- Pressure Line
- Posts: 2283
- Joined: 21 May 2007, 02:09
Re: models then what?
Code: Select all
function script.AimWeapon1( heading, pitch )
Signal( aim )
SetSignalMask( aim )
return true
endeg:
Code: Select all
function script.AimWeapon1( heading, pitch )
Signal( aim )
SetSignalMask( aim )
Turn(turret, y_axis, heading, math.rad(90))
Turn(barrel, x_axis, -pitch, math.rad(50))
WaitForTurn(turret, y_axis)
WaitForTurn(barrel, x_axis)
return true
end
otherwise you will have to pop back into your modeling suite, export the pieces separately and re-form them in upspring
Re: models then what?
[img=http://img193.imageshack.us/img193/5475 ... gss.th.png]
Still no luck after implementing your suggestions. Should my math.rad values be different since my tank is not exactly like yours?
Still no luck after implementing your suggestions. Should my math.rad values be different since my tank is not exactly like yours?
Re: models then what?
Those values are simply rotational speed
- Pressure Line
- Posts: 2283
- Joined: 21 May 2007, 02:09
Re: models then what?
Nothing to do with that. I couldnt get lua unit scripts to work either...
*Pressure Line wanders back off to bosland and burbles happily
*Pressure Line wanders back off to bosland and burbles happily
Re: models then what?
It works fine. Do you have the required gadget lua to activate lua unit anim scripts?
http://spring1944.svn.sourceforge.net/v ... iew=markup
Is an example of the required code. Put it in the LuaRules/Gadgets directory of your mod.
(N.B. Really all you need is a gadget that has the [code]return include("LuaGadgets/Gadgets/unit_script.lua")[/code] line in it)
http://spring1944.svn.sourceforge.net/v ... iew=markup
Is an example of the required code. Put it in the LuaRules/Gadgets directory of your mod.
(N.B. Really all you need is a gadget that has the [code]return include("LuaGadgets/Gadgets/unit_script.lua")[/code] line in it)
Re: models then what?
I added that widget but it made no difference. Are they other things i'm not aware of? Is there any part of what i have that someone would like to examine?
Re: models then what?
Check in infolog.txt that it is loaded properly.
There should be lines like this:
There should be lines like this:
[ 0] Loading gadget: Lua unit script framework <unit_script.lua>
[ 0] Loading unit script: scripts/gbr/tanks/gbrchurchillmkvii.lua
[ 0] Loading unit script: scripts/gbr/tanks/gbrcromwell.lua
[ 0] Loading unit script: scripts/gbr/tanks/gbrcromwellmkvi.lua
...snip...
[ 0] Loaded gadget: Lua unit script framework <unit_script.lua>
Re: models then what?
http://pastebin.com/m18430f7b
This is my infolog.txt A week ago my game was not loading because it could not find the laser ..something or other. So i had to drag and drop some stuff from CA into it and it started up. Folders I pulled are:
gamedata
bitmaps
luarules
Is there a file in these folders that is undermining what i'm trying to do?
This is my infolog.txt A week ago my game was not loading because it could not find the laser ..something or other. So i had to drag and drop some stuff from CA into it and it started up. Folders I pulled are:
gamedata
bitmaps
luarules
Is there a file in these folders that is undermining what i'm trying to do?
