View topic - Weapon Problems.



All times are UTC + 1 hour


Post new topic Reply to topic  [ 76 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: Weapon Problems.
PostPosted: 10 Aug 2011, 19:40 
User avatar

Joined: 10 Aug 2011, 19:35
Location: EVERYWHERE
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:


Top
 Offline Profile  
 
 Post subject: Re: Weapon Problems.
PostPosted: 10 Aug 2011, 19:49 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
That sounds hilariously awesome care to post the mod so we can take a look see?


Top
 Offline Profile  
 
 Post subject: Re: Weapon Problems.
PostPosted: 10 Aug 2011, 19:53 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
Quote:
So I wanted to ask how to tell the weapon where to shoot from.

like this, in your unit script:
Quote:
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


Top
 Online Profile  
 
 Post subject: Re: Weapon Problems.
PostPosted: 10 Aug 2011, 19:54 
User avatar

Joined: 10 Aug 2011, 19:35
Location: EVERYWHERE
I'm uploading it. I'll send you the link in a bit.

EDIT: I'll try that out, Knorke.


Top
 Offline Profile  
 
 Post subject: Re: Weapon Problems.
PostPosted: 10 Aug 2011, 20:10 
User avatar

Joined: 10 Aug 2011, 19:35
Location: EVERYWHERE
Sorry about the double post, Link is here: http://www.filedropper.com/openmachines Also try it in firstperson.
Quote:
like this, in your unit script:
Quote:
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?


Top
 Offline Profile  
 
 Post subject: Re: Weapon Problems.
PostPosted: 10 Aug 2011, 20:24 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
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.


Top
 Online Profile  
 
 Post subject: Re: Weapon Problems.
PostPosted: 10 Aug 2011, 20:56 
User avatar

Joined: 10 Aug 2011, 19:35
Location: EVERYWHERE
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.


Top
 Offline Profile  
 
 Post subject: Re: Weapon Problems.
PostPosted: 10 Aug 2011, 22:01 
User avatar

Joined: 10 Aug 2011, 19:35
Location: EVERYWHERE
Well, this is my current code for the unit anyway.
Code:
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:
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.


Top
 Offline Profile  
 
 Post subject: Re: Weapon Problems.
PostPosted: 10 Aug 2011, 22:37 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
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


Top
 Online Profile  
 
 Post subject: Re: Weapon Problems.
PostPosted: 10 Aug 2011, 22:40 
User avatar

Joined: 10 Aug 2011, 19:35
Location: EVERYWHERE
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.


Top
 Offline Profile  
 
 Post subject: Re: Weapon Problems.
PostPosted: 11 Aug 2011, 14:30 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
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.


Top
 Offline Profile  
 
 Post subject: Re: Weapon Problems.
PostPosted: 11 Aug 2011, 14:52 
User avatar

Joined: 10 Aug 2011, 19:35
Location: EVERYWHERE
Well do I have to code inside of his unitscript to make him stop trying to turn his invisible head to shoot?


Top
 Offline Profile  
 
 Post subject: Re: Weapon Problems.
PostPosted: 11 Aug 2011, 16:13 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
I don't understand the head spinning thing. Can you give me some more details?


Top
 Offline Profile  
 
 Post subject: Re: Weapon Problems.
PostPosted: 11 Aug 2011, 16:21 
User avatar

Joined: 10 Aug 2011, 19:35
Location: EVERYWHERE
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.


Top
 Offline Profile  
 
 Post subject: Re: Weapon Problems.
PostPosted: 11 Aug 2011, 17:41 
Moderator
User avatar

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
Not possible afaik.


Top
 Online Profile  
 
 Post subject: Re: Weapon Problems.
PostPosted: 11 Aug 2011, 17:57 
User avatar

Joined: 10 Aug 2011, 19:35
Location: EVERYWHERE
...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, 18:01, edited 1 time in total.

Top
 Offline Profile  
 
 Post subject: Re: Weapon Problems.
PostPosted: 11 Aug 2011, 18:01 
Moderator
User avatar

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
Quote:
fps mode is not really a supported engine feature


Quote:
fps mode is not really a supported engine feature


Quote:
fps mode is not really a supported engine feature


Top
 Online Profile  
 
 Post subject: Re: Weapon Problems.
PostPosted: 11 Aug 2011, 18:02 
User avatar

Joined: 10 Aug 2011, 19:35
Location: EVERYWHERE
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.


Top
 Offline Profile  
 
 Post subject: Re: Weapon Problems.
PostPosted: 11 Aug 2011, 18:05 
Moderator
User avatar

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
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. :-)


Top
 Online Profile  
 
 Post subject: Re: Weapon Problems.
PostPosted: 11 Aug 2011, 18:06 
User avatar

Joined: 10 Aug 2011, 19:35
Location: EVERYWHERE
Alright. I'll be uploading then.


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 76 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.