Noone ever listens when I ask :'(FLOZi wrote:Well, for that you need, indeed, a proper unit script.
If you post up your mod as an sdz or sd7 I'm sure we can get you sorted.
Weapon Problems.
Moderator: Moderators
Re: Weapon Problems.
- Machinesrocks
- Posts: 37
- Joined: 10 Aug 2011, 20:35
Re: Weapon Problems.
Here is a link: http://www.filedropper.com/openmachines_1
I did upload one for you, smoth, if that's what you were talking about.
I did upload one for you, smoth, if that's what you were talking about.
Re: Weapon Problems.
forgott to say you have to define the piece also.
like in your .s3o file, the model pieces have names (strings) but the script uses piece numbers.
So you could do something like this:
and just guess if you need to put 0, 1,2 or 3 to make it shot from the correct piece.
But that would be stupid of course.
Instead there is a way to convert piece names to numbers and store them in a variable, works like this:ie
also needs some other stuff to make the unit fire correctly, see here:
http://tvo.github.com/spring/2010/04/19/lus-stumpy.html
http://springrts.com/wiki/Animation-LuaScripting
http://springrts.com/wiki/SpringTutorialGame -> scripts\ folder for examples
like in your .s3o file, the model pieces have names (strings) but the script uses piece numbers.
So you could do something like this:
Code: Select all
function script.QueryWeapon1()
return 0
end
But that would be stupid of course.
Instead there is a way to convert piece names to numbers and store them in a variable, works like this:
Code: Select all
piecer_number = piece "piece_name"
Code: Select all
popper = piece "popper"
function script.QueryWeapon1()
return popper
end
also needs some other stuff to make the unit fire correctly, see here:
http://tvo.github.com/spring/2010/04/19/lus-stumpy.html
http://springrts.com/wiki/Animation-LuaScripting
http://springrts.com/wiki/SpringTutorialGame -> scripts\ folder for examples
Re: Weapon Problems.
weaponType=[[Rifle]],
just see this now.
I found the rifle weapon type to be pretty fail.
use "Cannon" or something.
just see this now.
I found the rifle weapon type to be pretty fail.
use "Cannon" or something.
Re: Weapon Problems.
Isn't rifle a hit cast? What's bad aboot it eh?
Re: Weapon Problems.
cast to what?smoth wrote:Isn't rifle a hit cast? What's bad aboot it eh?
ie the appearently hardcoded default effects are bad imo
https://github.com/spring/spring/blob/m ... /Rifle.cpp
--------
-scaled up scout.s3o by factor 6 so you can actually see it
-added a alpha channel to scout.tga so you get black wheels but a colored body (teamcolor_tempfile.bmp is just a temp file i used but maybe helpful to look at.)
-fixed origins of ie wheels so they rotate around their center
-made a scoutscript.lua that shouts, spins wheels, explodes
-tried to made a scout2 that only shoots forward but did not manage right now. it is def. possible though.
-made unit/target categories so, that untis can shot each other
the effects from the weapon are strange rectangles instead of looking nice. iirc it is because you need to include or link to some textures.
you still need a armordefs.lua to make weapons deal correct damage


good luck

last try to make a Machines game did not get very far sadly.
http://springrts.com/phpbb/viewtopic.ph ... t=machines
Re: Weapon Problems.
It wouldn't surprise me if some of the issues regarding correct 'turn to face target for non turret weapons' behaviour went away with a more regularly used weapontype.smoth wrote:Isn't rifle a hit cast? What's bad aboot it eh?
Re: Weapon Problems.
to get correct effects:
http://springrts.com/phpbb/viewtopic.php?f=14&t=25843
http://springrts.com/phpbb/viewtopic.php?f=14&t=25843
- Machinesrocks
- Posts: 37
- Joined: 10 Aug 2011, 20:35
Re: Weapon Problems.
Thanks a lot, knorke. The reason I had rifle on is because it is an instant hit. I read that it's bad, but the original scout had an instant hit. Wasn't quite sure on changing this part or not.
Anyway, I'm going to be adding in the factory next. With building units from factories, do you pick a piece of the model for it to spawn at in the script? Just like choosing which model part shoots?
And one more thing, the cannon archs. I change that by switching the trajectory, I take it?
Anyway, I'm going to be adding in the factory next. With building units from factories, do you pick a piece of the model for it to spawn at in the script? Just like choosing which model part shoots?
And one more thing, the cannon archs. I change that by switching the trajectory, I take it?
Re: Weapon Problems.
yes.With building units from factories, do you pick a piece of the model for it to spawn at in the script? Just like choosing which model part shoots?
for factories there is one function that returns the piece at which at the unit will be build. (can also move/spin that piece and the unit will follow, spinning only seems to work around y axis unless you use some tricks)
and a second funcion returns a piece where a nano particle is created.
dont know if that is needed actually.
see the wiki links or example game for more info.
instant hit weapons:
you could use a fast cannon projectile or a laser maybe.
or if it works for you, then use the rifle type.
dont know from head what tags you have to change to make a flatter trajectory. maybe just higher weaponVelocity will work.And one more thing, the cannon archs. I change that by switching the trajectory, I take it?
sadly there is no nice list of weapon related tags yet.
- Machinesrocks
- Posts: 37
- Joined: 10 Aug 2011, 20:35
Re: Weapon Problems.
I'll check the example game.for factories there is one function that returns the piece at which at the unit will be build. (can also move/spin that piece and the unit will follow, spinning only seems to work around y axis unless you use some tricks)
and a second funcion returns a piece where a nano particle is created.
dont know if that is needed actually.
see the wiki links or example game for more info.
http://springrts.com/wiki/Weapon_Variablessadly there is no nice list of weapon related tags yet.
Is that one okay? Found it a while ago.
Re: Weapon Problems.
yes that is best one i think.Machinesrocks wrote:http://springrts.com/wiki/Weapon_Variables
Is that one okay? Found it a while ago.
its not perfect or 100% reliable though.
- Machinesrocks
- Posts: 37
- Joined: 10 Aug 2011, 20:35
Re: Weapon Problems.
...one more problem
. Probably my (almost) last problem with units, since I still never got a building working properly. Spring refuses to recognize my building. My code inside of the units folder:
The code within the scripts folder:
And here is the download in case you need to see the model or placements: http://www.filedropper.com/openmachines_2
Sorry about all the problems, first time with a spring game, and no tutorial has properly discussed any of these problems. Not one that I know of at least. Thanks again. =P

Code: Select all
local unitName = "lightinfantryfactory"
local unitDef = {
--Internal settings
name = "Light Infantry Factory",
objectName = "liteinfantryfactory.s3o",
BuildPic = "filename.bmp",
Category = [[TANK SMALL NOTAIR NOTSUB]],
Side = "TANKS",
TEDClass = "TANK",
UnitName = "lightinfantryfactory",
script = "lifscript.lua",
--Unit limitations and properties
BuildTime = 100,
Description = "Builds light machines.",
MaxDamage = 0,
RadarDistance = 0,
SightDistance = 400,
SoundCategory = "TANK",
Upright = 0,
buildoptions = {
[[tank]],
},
--Energy and metal related
BuildCostEnergy = 0,
BuildCostMetal = 75,
--Pathfinding and related
Acceleration = 0,
BrakeRate = 0,
FootprintX = 2,
FootprintZ = 2,
MaxSlope = 15,
MaxVelocity = 0,
MaxWaterDepth = 0,
MovementClass = "Default2x2",
TurnRate = 0,
--Abilities
Builder = 0,
CanAttack = 0,
CanGuard = 0,
CanMove = 0,
CanPatrol = 0,
CanStop = 0,
LeaveTracks = 0,
Reclaimable = 1,
--Hitbox
-- collisionVolumeOffsets = "0 0 0",
-- collisionVolumeScales = "10 10 10",
-- collisionVolumeTest = 1,
-- collisionVolumeType = "10 10 10",
--Weapons and related
BadTargetCategory = "NOTAIR",
ExplodeAs = "TANKDEATH",
NoChaseCategory = "AIR",
}
return lowerkeys({ [unitName] = unitDef })
Code: Select all
local main, pad, = piece "main", piece "pad",
function script.Create(unitID)
return 0
end
function script.QueryBuildInfo() return pad end
Sorry about all the problems, first time with a spring game, and no tutorial has properly discussed any of these problems. Not one that I know of at least. Thanks again. =P
Re: Weapon Problems.
what is the error? (infolog.txt)
anyway, this is a working factory/building:
http://code.google.com/p/springtutorial ... actory.lua
and that is its script:
http://code.google.com/p/springtutorial ... actory.lua
Difference between (mobile) unit and building is mainly that buildings have a yardmap. (the grid footprint thing you see when placing it)
YardMap ="ooooo occco occco occco occco",
read like this:
ooooo
occco
occco
occco
occco
o = "wall"
c ="open/closes when factory builds something"
so this factory has a U-shaped footprint.
Also buildings have no MovementClass because well, they do not move.
Oh, and needs Builder = true, instead of Builder = 0, for a factory.
And a buildoptions list what the builder can build.
just use the linked file and replace the names for unit/.s3o file/script etc
anyway, this is a working factory/building:
http://code.google.com/p/springtutorial ... actory.lua
and that is its script:
http://code.google.com/p/springtutorial ... actory.lua
Difference between (mobile) unit and building is mainly that buildings have a yardmap. (the grid footprint thing you see when placing it)
YardMap ="ooooo occco occco occco occco",

ooooo
occco
occco
occco
occco
o = "wall"
c ="open/closes when factory builds something"
so this factory has a U-shaped footprint.
Also buildings have no MovementClass because well, they do not move.
Oh, and needs Builder = true, instead of Builder = 0, for a factory.
And a buildoptions list what the builder can build.
just use the linked file and replace the names for unit/.s3o file/script etc
Re: Weapon Problems.
http://terminus.pl/~seba/machines.jpg (not all visible on this pic)
i might send u obj file soon, if i dont forget, what might mean even week lol.
anyway, i dont have that much time now, only few are 'finished' (only 3dmesh) about rest... my terrible creativity failed even more than usually.
if u provide some images/blueprints, i might do something (point was i didnt want to copy-paste old models, u can do it urself tbh)
i might send u obj file soon, if i dont forget, what might mean even week lol.
anyway, i dont have that much time now, only few are 'finished' (only 3dmesh) about rest... my terrible creativity failed even more than usually.
if u provide some images/blueprints, i might do something (point was i didnt want to copy-paste old models, u can do it urself tbh)
- Machinesrocks
- Posts: 37
- Joined: 10 Aug 2011, 20:35
Re: Weapon Problems.
You're sebak on wiredforwar.org, aren't you? I've seen your models. Anyway, I have a dev team, I don't need any .obj's. =PWombat wrote:http://terminus.pl/~seba/machines.jpg (not all visible on this pic)
i might send u obj file soon, if i dont forget, what might mean even week lol.
anyway, i dont have that much time now, only few are 'finished' (only 3dmesh) about rest... my terrible creativity failed even more than usually.
if u provide some images/blueprints, i might do something (point was i didnt want to copy-paste old models, u can do it urself tbh)
@Knorke: http://www.filedropper.com/infolog
Re: Weapon Problems.
omg that pagewiredforwar.org

sorry to say but do not have good memories of that. I LOVED Machines and found that site when searching for patch/crack/cd image some years ago, so mp games would be easier to set up.
well, it said you needed X amount of postings to acess the downloads so I did not even bother with registering and looked elsewhere. Still pissed me off massively at the time.
By then there were already threads about making "Machines 2"
It seems the only stuff that happend since then is lots of dream postings and maybe some 3d models.
No offense, but unless there is some secret site nobody in that forum did anything for 5 years. What kind of "team" is that?
Someone seriously proposed to use "the Steam Engine" while others ask if there are "Visual C++ programmers" around. "Or maybe dark basic should be used?" Sadly one guy could not help because his excel does not work. Oo
I can tell this is fail from having seen quite some fail in my time and often contributing to it.
Anyway, do not get disattracted with all that, as you see it produced little results in the last years. Concentrate on learning scripting, modeling and try to get 3,4 working units ingame.
Then, if multiple people start to contribute content (not ideas), set up an SVN.
-----------
from that infolog:
some synthax error in the factory script in line 1. might look at it later but maybe you can figure it out yourself too.[f=0000000] Loading unit script: scripts/lifscript.lua
[f=0000000] Failed to load: lifscript.lua ([string "scripts/lifscript.lua"]:1: '<name>' expected near '=')
remove the redsmoke effect tag thing from the unitdef. not sure if missing effects stop the unit from being loaded but worth a try.[f=0000000] [CCEG::Load] WARNING: table for CEG "redsmoke" invalid (parse errors?)
- Machinesrocks
- Posts: 37
- Joined: 10 Aug 2011, 20:35
Re: Weapon Problems.
This isn't Machines 2. It's a remake. Those posts are very old. The guy with no excel was me, and the grow plan wasn't a grow plan for the game. Anyway, It's a separate project and we started on like august 6th. If you see a random guy with 1 post randomly suggesting an engine, it's not our team.
I have libre office anyway. The forums do look like a joke now, but we do have a team.
EDIT: There is also a development tab on the first page that showed some early progress on this engine. We're mainly using an irc.
I have libre office anyway. The forums do look like a joke now, but we do have a team.
EDIT: There is also a development tab on the first page that showed some early progress on this engine. We're mainly using an irc.
Re: Weapon Problems.
Protip brosef don't turn down free help because " you have a team," ever.Machinesrocks wrote:You're sebak on wiredforwar.org, aren't you? I've seen your models. Anyway, I have a dev team, I don't need any .obj's. =PWombat wrote:http://terminus.pl/~seba/machines.jpg (not all visible on this pic)
i might send u obj file soon, if i dont forget, what might mean even week lol.
anyway, i dont have that much time now, only few are 'finished' (only 3dmesh) about rest... my terrible creativity failed even more than usually.
if u provide some images/blueprints, i might do something (point was i didnt want to copy-paste old models, u can do it urself tbh)
@Knorke: http://www.filedropper.com/infolog
- Machinesrocks
- Posts: 37
- Joined: 10 Aug 2011, 20:35
Re: Weapon Problems.
I probably shouldn't, but the modellers right now make models that look similar to each other. If he wants to help with something else, he could, but I really don't need a modeller right now.smoth wrote:Protip brosef don't turn down free help because " you have a team," ever.Machinesrocks wrote:You're sebak on wiredforwar.org, aren't you? I've seen your models. Anyway, I have a dev team, I don't need any .obj's. =PWombat wrote:http://terminus.pl/~seba/machines.jpg (not all visible on this pic)
i might send u obj file soon, if i dont forget, what might mean even week lol.
anyway, i dont have that much time now, only few are 'finished' (only 3dmesh) about rest... my terrible creativity failed even more than usually.
if u provide some images/blueprints, i might do something (point was i didnt want to copy-paste old models, u can do it urself tbh)
@Knorke: http://www.filedropper.com/infolog
Also, If you need the machines discs, you can let me know. We have them working on xp, vista, and windows 7.