Weapon Problems.
Moderator: Moderators
- Machinesrocks
- Posts: 37
- Joined: 10 Aug 2011, 20:35
Weapon Problems.
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.
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.
Re: Weapon Problems.
That sounds hilariously awesome care to post the mod so we can take a look see?
Re: Weapon Problems.
like this, in your unit script:So I wanted to ask how to tell the weapon where to shoot from.
another reason might be that your projectile is fired too slow and drops down too fastfunction script.QueryWeapon1()
return piece_you_want_to_shot_from
end
- Machinesrocks
- Posts: 37
- Joined: 10 Aug 2011, 20:35
Re: Weapon Problems.
I'm uploading it. I'll send you the link in a bit.
EDIT: I'll try that out, Knorke.
EDIT: I'll try that out, Knorke.
- Machinesrocks
- Posts: 37
- Joined: 10 Aug 2011, 20:35
Re: Weapon Problems.
Sorry about the double post, Link is here: http://www.filedropper.com/openmachines Also try it in firstperson.
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?like this, in your unit script:function script.QueryWeapon1()
return piece_you_want_to_shot_from
end
Re: Weapon Problems.
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.
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.
- Machinesrocks
- Posts: 37
- Joined: 10 Aug 2011, 20:35
Re: Weapon Problems.
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.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.
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.
- Machinesrocks
- Posts: 37
- Joined: 10 Aug 2011, 20:35
Re: Weapon Problems.
Well, this is my current code for the unit anyway.
The weapon loads up another script inside of a weapons folder within the directory, which is:
So I don't really know where to add in the code you gave me.
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 })
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})
Re: Weapon Problems.
in the unitscript.Machinesrocks wrote:So I don't really know where to add in the code you gave me.
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
- Machinesrocks
- Posts: 37
- Joined: 10 Aug 2011, 20:35
Re: Weapon Problems.
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.
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.
Re: Weapon Problems.
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.
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.
- Machinesrocks
- Posts: 37
- Joined: 10 Aug 2011, 20:35
Re: Weapon Problems.
Well do I have to code inside of his unitscript to make him stop trying to turn his invisible head to shoot?
Re: Weapon Problems.
I don't understand the head spinning thing. Can you give me some more details?
- Machinesrocks
- Posts: 37
- Joined: 10 Aug 2011, 20:35
Re: Weapon Problems.
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.
Re: Weapon Problems.
Not possible afaik.
- Machinesrocks
- Posts: 37
- Joined: 10 Aug 2011, 20:35
Re: Weapon Problems.
...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.
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.
Re: Weapon Problems.
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]
- Machinesrocks
- Posts: 37
- Joined: 10 Aug 2011, 20:35
Re: Weapon Problems.
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.
Re: Weapon Problems.
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.
If you post up your mod as an sdz or sd7 I'm sure we can get you sorted.
- Machinesrocks
- Posts: 37
- Joined: 10 Aug 2011, 20:35
Re: Weapon Problems.
Alright. I'll be uploading then.