Weapon Problems. - Page 2

Weapon Problems.

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Weapon Problems.

Post by smoth »

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. :-)
Noone ever listens when I ask :'(
User avatar
Machinesrocks
Posts: 37
Joined: 10 Aug 2011, 20:35

Re: Weapon Problems.

Post by Machinesrocks »

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.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Weapon Problems.

Post by knorke »

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:

Code: Select all

function script.QueryWeapon1()
return 0
end 
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:

Code: Select all

piecer_number = piece "piece_name"
ie

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
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Weapon Problems.

Post by knorke »

weaponType=[[Rifle]],

just see this now.
I found the rifle weapon type to be pretty fail.
use "Cannon" or something.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Weapon Problems.

Post by smoth »

Isn't rifle a hit cast? What's bad aboot it eh?
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Weapon Problems.

Post by knorke »

smoth wrote:Isn't rifle a hit cast? What's bad aboot it eh?
cast to what?
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

:arrow: http://www.file-upload.net/download-365 ... d.zip.html

Image

good luck ;)
last try to make a Machines game did not get very far sadly.
http://springrts.com/phpbb/viewtopic.ph ... t=machines
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Re: Weapon Problems.

Post by FLOZi »

smoth wrote:Isn't rifle a hit cast? What's bad aboot it eh?
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.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Weapon Problems.

Post by knorke »

User avatar
Machinesrocks
Posts: 37
Joined: 10 Aug 2011, 20:35

Re: Weapon Problems.

Post by Machinesrocks »

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?
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Weapon Problems.

Post by knorke »

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?
yes.
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.
And one more thing, the cannon archs. I change that by switching the trajectory, I take it?
dont know from head what tags you have to change to make a flatter trajectory. maybe just higher weaponVelocity will work.
sadly there is no nice list of weapon related tags yet.
User avatar
Machinesrocks
Posts: 37
Joined: 10 Aug 2011, 20:35

Re: Weapon Problems.

Post by Machinesrocks »

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.
I'll check the example game.

sadly there is no nice list of weapon related tags yet.
http://springrts.com/wiki/Weapon_Variables
Is that one okay? Found it a while ago.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Weapon Problems.

Post by knorke »

Machinesrocks wrote:
http://springrts.com/wiki/Weapon_Variables
Is that one okay? Found it a while ago.
yes that is best one i think.
its not perfect or 100% reliable though.
User avatar
Machinesrocks
Posts: 37
Joined: 10 Aug 2011, 20:35

Re: Weapon Problems.

Post by Machinesrocks »

...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:

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 })
The code within the scripts folder:

Code: Select all

local main, pad, = piece "main", piece "pad", 

function script.Create(unitID)
    return 0
end

function script.QueryBuildInfo() return pad end
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
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Weapon Problems.

Post by knorke »

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",
:arrow: 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
User avatar
Wombat
Posts: 3379
Joined: 15 Dec 2008, 15:53

Re: Weapon Problems.

Post by Wombat »

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)
User avatar
Machinesrocks
Posts: 37
Joined: 10 Aug 2011, 20:35

Re: Weapon Problems.

Post by Machinesrocks »

Wombat 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)
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. =P

@Knorke: http://www.filedropper.com/infolog
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Weapon Problems.

Post by knorke »

wiredforwar.org
omg that page :shock:
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:
[f=0000000] Loading unit script: scripts/lifscript.lua
[f=0000000] Failed to load: lifscript.lua ([string "scripts/lifscript.lua"]:1: '<name>' expected near '=')
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] [CCEG::Load] WARNING: table for CEG "redsmoke" invalid (parse errors?)
remove the redsmoke effect tag thing from the unitdef. not sure if missing effects stop the unit from being loaded but worth a try.
User avatar
Machinesrocks
Posts: 37
Joined: 10 Aug 2011, 20:35

Re: Weapon Problems.

Post by Machinesrocks »

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.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Weapon Problems.

Post by smoth »

Machinesrocks wrote:
Wombat 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)
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. =P

@Knorke: http://www.filedropper.com/infolog
Protip brosef don't turn down free help because " you have a team," ever.
User avatar
Machinesrocks
Posts: 37
Joined: 10 Aug 2011, 20:35

Re: Weapon Problems.

Post by Machinesrocks »

smoth wrote:
Machinesrocks wrote:
Wombat 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)
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. =P

@Knorke: http://www.filedropper.com/infolog
Protip brosef don't turn down free help because " you have a team," ever.
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.

Also, If you need the machines discs, you can let me know. We have them working on xp, vista, and windows 7.
Post Reply

Return to “Game Development”