Page 1 of 1

Reclaim doesnt work.

Posted: 25 Mar 2014, 13:10
by code_man
My harvesters dont reclaim tiberium and i have no idea why.
The cursor changes to reclaim cursor and harvys get in range of the crystals but nothing then happens.
Pretty sure its not the feature that is a problem.
Need a hint here.

Code: Select all

local unitName = "harvester"

local unitDef = {
    buildPic = "harvester.png",
    category = "TANK SMALL NOTAIR NOTSUB",
    objectName = "vehicles/harvester.dae",
    name = "Tiberium Harvester",
    tEDClass = "TANK",
    unitName = "harvester",
    script = "harvester.lua",
    collisionVolumeType = "box",
    collisionVolumeScales = {25, 25, 50},
    --collisionVolumeOffsets = {32, 32, 16},
    
    buildTime = 140,
    description = "Tiberium collector",
    maxDamage = 1000,
    radarDistance = 0,
    sightDistance = 200,
    soundCategory = "TANK",
    buildCostMetal = 1400,
    
    acceleration = 0.05,
    brakeRate = 0.25,
    footprintX = 3,
    footprintZ = 4,
    maxSlope = 20,
    maxVelocity = 2.5,
    maxReverseVelocity = 0.25,
    maxWaterDepth = 20,
    movementClass = "Default",
    turnRate = 200,
    turnInPlace = false,
    turnInPlaceSpeedLimit = 10,

    canMove = true,
    leaveTracks = 1,

    reclaimable = false,
    capturable = false,

    idleAutoHeal = 1.0, -- First C&C had no harvester self repair but its convenient so we use 

    explodeAs = "harvester_explosion",

    sounds = {
        select = {
            "tone16.wav",
        },
        ok = {
            "newtarg1.wav",
        },
        arrived = {
            "tone2.wav",
        },
    },
}

if false then
    unitDef.canAttack = 1
    unitDef.canGuard = 1
    unitDef.canFight = 1
    unitDef.canPatrol = 1

    unitDef.kamikaze = true
    unitDef.kamikazeDistance = 100.0
    unitDef.selfDestructCountdown = 3
    unitDef.fireState = 1
else
    unitDef.builder = true
    unitDef.buildDistance = 64.0
    unitDef.workerTime = 1.0
    unitDef.canRestore = false
    unitDef.canReclaim = true
    unitDef.canBeAssisted = false
    unitDef.canAssist = false
    unitDef.canRepair = false
end

local weaponDefs = {
    harvester_explosion = {
	weapontype = "Cannon",
	areaofeffect = 250,
	avoidfeature = false,
	avoidfriendly = true,
	canattackground = true,
	collidefriendly = true,
	collisionsize = 8,
	commandfire = false,
	craterboost = 0,
	cratermult = 0,
	edgeeffectiveness = 0.1,
	explosionspeed = 128,
	impulseboost = 0,
	impulsefactor = 0,
	intensity = 1,
	noselfdamage = false,
	range = 25,
        soundstart = "tnkfire3",
        soundhit = "xplos",
	reloadtime = 10,
	rgbcolor = "1.0 1.0 1.0",
	turret = false,
	texture1 = "flame",
	weaponvelocity = 800,
	explosiongenerator = "custom:TANKGUN_FX",
	damage = {
            infantry = 500,
	    default = 500,
            heavy_armor = 250,
	},
    },
}

unitDef.weaponDefs = weaponDefs
return lowerkeys({ [unitName]  =  unitDef })

Re: Reclaim doesnt work.

Posted: 25 Mar 2014, 13:13
by Anarchid
Builder (reclaimer, assister, repairer...) units need certain animation callins implemented in order for the relevant functionality to work.

Reference: http://springrts.com/wiki/Animation-Lua ... _factories

Can i see your animation script?

Re: Reclaim doesnt work.

Posted: 25 Mar 2014, 13:14
by code_man
I suspected something like that but i couldnt find anything in the anim callin page that seemed right.

Code: Select all

-- harvester.lua

-- Harvester animations

include("wheeled_vehicle.lua")

function script.Activate()

end 

function script.Deactivate() 

end

Re: Reclaim doesnt work.

Posted: 25 Mar 2014, 13:16
by Anarchid
I think you need StartBuilding too, and a few others.

I've added the link to my post above, but i was too slow with the edit :P

You can find them here: http://springrts.com/wiki/Animation-Lua ... _factories

Re: Reclaim doesnt work.

Posted: 25 Mar 2014, 13:18
by code_man
I think i already tried with building callins, but il try again.

EDIT2:
It does work now i think but it takes EXTREMELY long time.
Il have to do some examination.

Re: Reclaim doesnt work.

Posted: 25 Mar 2014, 13:30
by Anarchid
unitDef.workerTime = 1.0
Increasing this value will likely result in quicker reclaim.

Re: Reclaim doesnt work.

Posted: 25 Mar 2014, 13:36
by code_man
I added reclaimTime to the featuredef its working fine now, thanks.
Tough reclaimTime default comes down to 600, is this supposed to be 10 minutes?
Seems like a shitty default value tbh, 10 minutes for a 100 resources is kinda loooong.

Re: Reclaim doesnt work.

Posted: 25 Mar 2014, 17:08
by FLOZi
http://springrts.com/wiki/Gamedev:Featu ... _Resources

float reclaimTime Default: (metal + energy) * 6.0

The actual time taken is a function of the builders reclaimSpeed, of course.

Re: Reclaim doesnt work.

Posted: 26 Mar 2014, 11:17
by Pressure Line
That and no-one uses '1' as the workertime anyway. Much better to use ~100, then balance the reclaimtime of your features if required.

Re: Reclaim doesnt work.

Posted: 31 Mar 2014, 01:33
by Forboding Angel
Pressure Line wrote:That and no-one uses '1' as the workertime anyway. Much better to use ~100, then balance the reclaimtime of your features if required.
O_O, You be talkin' crazy.

Silly.