Weapon Problems.

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

Weapon Problems.

Post by Machinesrocks » 10 Aug 2011, 20:40

Within my mod, I'm trying to make a unit shoot properly. (Of course.) I've gotten his attack function in, but whenever he shoots, he gets flung out of the map. I'm assuming this is because he is shooting the weapon within himself. So I wanted to ask how to tell the weapon where to shoot from. I've tried multiple things, but now I can't just get it right. I've heard some things about setting the flare, but nothing as really worked out for me. So can somebody explain what I would need to choose for the "flare" spot?

One more problem. When turret is set to "false" or "0," you shouldn't be able to separately move your head. Especially since he doesn't have a spinning head. I can still turn my head, but I can't shoot to the other areas I aim at. Can someone explain this too? Thanks. :mrgreen:
0 x

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

Re: Weapon Problems.

Post by smoth » 10 Aug 2011, 20:49

That sounds hilariously awesome care to post the mod so we can take a look see?
0 x

User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Weapon Problems.

Post by knorke » 10 Aug 2011, 20:53

So I wanted to ask how to tell the weapon where to shoot from.
like this, in your unit script:
function script.QueryWeapon1()
return piece_you_want_to_shot_from
end
another reason might be that your projectile is fired too slow and drops down too fast
0 x

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

Re: Weapon Problems.

Post by Machinesrocks » 10 Aug 2011, 20:54

I'm uploading it. I'll send you the link in a bit.

EDIT: I'll try that out, Knorke.
0 x

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

Re: Weapon Problems.

Post by Machinesrocks » 10 Aug 2011, 21:10

Sorry about the double post, Link is here: http://www.filedropper.com/openmachines Also try it in firstperson.
like this, in your unit script:
function script.QueryWeapon1()
return piece_you_want_to_shot_from
end
I replace "piece_you_want_to_shot_from" with the name of the object the bullet will launch from, right? And it will make sure the bullet doesn't get stuck in his hitbox?
0 x

User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Weapon Problems.

Post by knorke » 10 Aug 2011, 21:24

yes.
actually i am not sure if a bullet can even get stuck in its shooter like that. at least there are some units where it makes me wonder that it does not happen there.
0 x

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

Re: Weapon Problems.

Post by Machinesrocks » 10 Aug 2011, 21:56

knorke wrote:yes.
actually i am not sure if a bullet can even get stuck in its shooter like that. at least there are some units where it makes me wonder that it does not happen there.
Thanks! Still need someone to solve the problem where I can turn my camera in 1st person beyond the area I can actually shoot at.
EDIT: Should this go under the weapons part within the unitdef? Where it shoots from I mean. I can't seem to put it in correctly.
0 x

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

Re: Weapon Problems.

Post by Machinesrocks » 10 Aug 2011, 23:01

Well, this is my current code for the unit anyway.

Code: Select all

local unitName = "scout"

local unitDef = {
  
  --Internal settings
    name = "Bolter Scout",
	objectName = "scout.s3o",
	BuildPic = "filename.bmp",
    Category = "TANK SMALL NOTAIR NOTSUB",
    Side = "TANKS",
    TEDClass = "TANK",
    UnitName = "tank",
    script = "tankscript.lua",
    
--Unit limitations and properties
    BuildTime = 100,
    Description = "A small and fast unit.",
    MaxDamage = 800,
    RadarDistance = 0,
    SightDistance = 400,
    SoundCategory = "TANK",
    Upright = 0,
    
--Energy and metal related
    BuildCostEnergy = 100,
    BuildCostMetal = 0,
    
--Pathfinding and related
    Acceleration = 0.50,
    BrakeRate = 0.51,
    FootprintX = 2,
    FootprintZ = 2,
    MaxSlope = 15,
    MaxVelocity = 7.0,
    MaxWaterDepth = 20,
    MovementClass = "Default2x2",
    TurnRate = 900,
    
--Abilities
    Builder = 0,
    CanAttack = 1,
    CanGuard = 1,
    CanMove = 1,
    CanPatrol = 1,
    CanStop = 1,
    LeaveTracks = 0,
    Reclaimable = 0,

--Hitbox
--    collisionVolumeOffsets    =  "0 0 0",
--    collisionVolumeScales     =  "10 10 10",
--    collisionVolumeTest       =  1,
--    collisionVolumeType       =  "10 10 10",
    
--Weapons and related
    BadTargetCategory = "NOTAIR",
    ExplodeAs = "TANKDEATH",
    NoChaseCategory = "AIR",  


 weapons = {
[1]={name  = "scoutbolter",
	onlyTargetCategory = [[LAND]],
	},	
},
}


return lowerkeys({ [unitName] = unitDef })
The weapon loads up another script inside of a weapons folder within the directory, which is:

Code: Select all

local weaponName="scoutbolter"
local weaponDef={
name="Bullet",
weaponType=[[MissileLauncher]],

Accuracy=2000,

--Physic/flight path
range=1000,
reloadtime=3,
weaponVelocity=500,
startVelocity=500,
weaponAcceleration=50,
flightTime=2.5,
BurnBlow=0,
FixedLauncher=true,
dance=100,--200
wobble=1000,
tolerance=8000,
tracks=false,
Turnrate=0,
collideFriendly=true,
TrajectoryHeight = 2,

----APPEARANCE
model="projectiles/cubebullet.s3o",
smokeTrail=false,
explosionGenerator="custom:redsmoke",
CegTag="smoketrail",

----TARGETING
turret=false,
CylinderTargetting=false,
avoidFeature=false,
avoidFriendly=false,

----BURST
burst                   = 1,--8
burstrate               = 0.1,

--commandfire=true,

----DAMAGE
damage={
default=150,
heavyarmor=150,
},
areaOfEffect=100,
craterMult=0,

--?FIXME***
lineOfSight=true,


--sound
--soundHit=[[kanoba/SabotHitRemake.ogg]],
--soundStart=[[kanoba/RockLit1Remake.ogg]],
}

return lowerkeys ({[weaponName]=weaponDef})
So I don't really know where to add in the code you gave me.
0 x

User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Weapon Problems.

Post by knorke » 10 Aug 2011, 23:37

Machinesrocks wrote:So I don't really know where to add in the code you gave me.
in the unitscript.
That is the file that you define in the unitdef with the
script = "tankscript.lua",
should be in scripts\ and it controlls unit animation, aiming etc.
http://springrts.com/wiki/Animation-LuaScripting

But you already have a kind of working script, otherwise your unit would not shot at all.

I think it is something with the weapon.
maybe to high dance or wobble or try turret=true
0 x

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

Re: Weapon Problems.

Post by Machinesrocks » 10 Aug 2011, 23:40

Hmm, funny thing is that tankscript.lua doesn't exist, so it can't be loading it. I guess I should work on an animation script then. Also, I was trying not to have a turret, so that I can't turn my mouse, and I have tried that.
EDIT: Problem solved! I just need to make it faster, and make sure it doesn't hit the ground, or else I get launched away.
0 x

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

Re: Weapon Problems.

Post by smoth » 11 Aug 2011, 15:30

fps mode is not really a supported engine feature. It is just sort of their.

HOWEVER, a unit still obeys fire arc limitations in fps mode with regards to where it can fire. you can look there, you just cannot shoot.
0 x

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

Re: Weapon Problems.

Post by Machinesrocks » 11 Aug 2011, 15:52

Well do I have to code inside of his unitscript to make him stop trying to turn his invisible head to shoot?
0 x

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

Re: Weapon Problems.

Post by smoth » 11 Aug 2011, 17:13

I don't understand the head spinning thing. Can you give me some more details?
0 x

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

Re: Weapon Problems.

Post by Machinesrocks » 11 Aug 2011, 17:21

Well in the default spring gui, on the bottom left, there is a green pointer on top of a blue pointer. The mouse moves the green pointer which is supposed to be a tank turret or something, the blue pointer is moved by the arrow keys. I basically want to disable movement of the green pointer.
0 x

User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6103
Joined: 29 Apr 2005, 01:14

Re: Weapon Problems.

Post by FLOZi » 11 Aug 2011, 18:41

Not possible afaik.
0 x

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

Re: Weapon Problems.

Post by Machinesrocks » 11 Aug 2011, 18:57

...So all units need to be tanks or they can't shoot? That doesn't make sense.

EDIT: btw, I meant I want to disable the blue pointer, it's the other way around.
Last edited by Machinesrocks on 11 Aug 2011, 19:01, edited 1 time in total.
0 x

User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6103
Joined: 29 Apr 2005, 01:14

Re: Weapon Problems.

Post by FLOZi » 11 Aug 2011, 19:01

fps mode is not really a supported engine feature

[quote]fps mode is not really a supported engine feature[/quote]


[quote]fps mode is not really a supported engine feature[/quote]
0 x

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

Re: Weapon Problems.

Post by Machinesrocks » 11 Aug 2011, 19:02

Not only in fps mode. He doesn't turn around to shoot. He tries to turn his head which doesn't exist. He can't aim unless facing forward. Which is why I want him to turn his body around to shoot.
0 x

User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6103
Joined: 29 Apr 2005, 01:14

Re: Weapon Problems.

Post by FLOZi » 11 Aug 2011, 19:05

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. :-)
0 x

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

Re: Weapon Problems.

Post by Machinesrocks » 11 Aug 2011, 19:06

Alright. I'll be uploading then.
0 x

Post Reply

Return to “Game Development”

cron