junnxiang
|
  |
| Joined: 14 Feb 2008 |
| Total Posts: 28 |
|
|
| 18 Nov 2013 09:16 AM |
Hello script helpers, I want to know how to change the script that can shoot and hit the target such as 'Target Dummy', 'Humanoid Zombie' and any figure model that contains 'Humanoid'. I have tried to change the script before, but it stills cannot hit the targets that contains 'Humanoid' and it only let me to hit Enemy Team Color (Blue) if i am on Team Color (Red). [Below of the scripts are about the Raycast of Bullet, tell me which scripts should i change? So i can able to kill any figure models that contains 'Humanoid'. Keys: sp=script.Parent]
function hittarget() local hittargetvalue=sp:FindFirstChild("HitTarget") if hittargetvalue then hittargetvalue.Value=not hittargetvalue.Value end end
function rayignorecheck(hit3) if hit3 then if hit3.Transparency>=1 or string.lower(hit3.Name)=="water" or hit3.Name=="Effect" or hit3.Name=="Rocket" or hit3.Name=="Handle" or hit3:IsDescendantOf(sp.Parent) then return true end for i,v in ipairs(targets hit) do if v and v.Parent~=nil then if hit3:IsDescendantOf(v) then return true end end end end return false end
function raycast(spos,vec,dist) local hit2,pos2=game.Workspace:FindPartOnRay(Ray.new(spos+(vec*.01),vec*dist),sp) if hit2~=nil and pos2 then local dist2=dist-(pos2-spos).magnitude if rayignorecheck(hit2) and dist2>0 then return raycast(pos2,vec,dist2) end end return hit2,pos2 end
function fire(targetpos) local chr=sp.Parent if chr==nil then return end local plr=game.Players:GetPlayerFromCharacter(chr) if plr==nil then return end
local head=chr:findFirstChild("Head") local humanoid=chr:findFirstChild("Humanoid") if head==nil or humanoid==nil then return end
local spread=sp:FindFirstChild("Spread") if humanoid.Health>0 and spread then local startpos=head.Position local targetdist=(targetpos-startpos).magnitude local flawedpos=Vector3.new(spread.Value*((math.random()*2)-1),spread.Value*((math.random()*2)-1),spread.Value*((math.random()*2)-1))*targetdist*spreadpercentoffset local vec=((targetpos+flawedpos)-startpos).unit
targets hit={} hitsolid=false while not hitsolid do hitsolid=true local hit,pos=raycast(startpos,vec,range) if hit~=nil and hit.Parent~=nil then chr=sp.Parent local h=hit.Parent:FindFirstChild("Humanoid") if h~=nil then local p=game.Players:GetPlayerFromCharacter(h.Parent) if p~=nil then if p.TeamColor~=plr.TeamColor and h.Health>0 then finaldamage=damage if hit.Name=="Head" then finaldamage=finaldamage*headshotmultiplier elseif hit.Name=="Torso" then finaldamage=finaldamage--*1.1 end tagHumanoid(h,plr,hit.Name=="Head") h:TakeDamage(finaldamage) hittarget(hit.Parent) if piercing then hitsolid=false table.insert(targets hit,hit.Parent) end end end elseif hit.Name=="Target" then hittarget(hit.Parent) if piercing then hitsolid=false table.insert(targets hit,hit.Parent) end end end
local missile=Instance.new("Part") missile.Name="Effect" missile.formFactor="Custom" missile.Size=Vector3.new(.1,.1,.1) missile.Material=Enum.Material.Plastic missile.BrickColor=plr.TeamColor missile.Locked=true missile.TopSurface=0 missile.BottomSurface=0 missile.CFrame=CFrame.new(pos) missile.Transparency=1 missile.Anchored=true
local mesh=Instance.new("SpecialMesh") mesh.MeshType="Sphere" mesh.Scale=Vector3.new(.5/missile.Size.x,.5/missile.Size.y,.5/missile.Size.z) mesh.Parent=missile
local paint=Instance.new("Fire") paint.Color=plr.TeamColor.Color paint.SecondaryColor=plr.TeamColor.Color paint.Size=5 paint.Heat=0 paint.Parent=missile
Hope everyone can solve my problem, thanks... |
|
|
| Report Abuse |
|
|
|
| 18 Nov 2013 09:21 AM |
"Targets"
Under targets, change the Humanoid name... |
|
|
| Report Abuse |
|
|
junnxiang
|
  |
| Joined: 14 Feb 2008 |
| Total Posts: 28 |
|
|
| 18 Nov 2013 09:22 AM |
'Target Dummy', 'Humanoid Zombie' and any figure model that contains 'Humanoid'
Simply to say, i want to change the scripts that 'Neutral Player' or 'Team Player' can hits 'Neutral Figure Model with Humanoid'. |
|
|
| Report Abuse |
|
|
| |
|
junnxiang
|
  |
| Joined: 14 Feb 2008 |
| Total Posts: 28 |
|
|
| 18 Nov 2013 09:25 AM |
| I think you are not understand my question. So don't ask |
|
|
| Report Abuse |
|
|
|
| 18 Nov 2013 09:28 AM |
This is obviously a complicated free model cause you would know what you scripted,
try changing this line:
if p.TeamColor~=plr.TeamColor and h.Health>0 then |
|
|
| Report Abuse |
|
|
junnxiang
|
  |
| Joined: 14 Feb 2008 |
| Total Posts: 28 |
|
|
| 18 Nov 2013 09:39 AM |
Tried before= 1) if p.TeamColor~=plr.TeamColor or p.Neutral~=plr.Neutral and h.Health> 0 then (same) 2) if h.Health> 0 then (still same) 3) if p.Neutral~=plr.Neutral and h.Health> 0 then (also) |
|
|
| Report Abuse |
|
|
sycips
|
  |
| Joined: 21 Mar 2011 |
| Total Posts: 1368 |
|
|
| 18 Nov 2013 11:19 AM |
maybe something like:
hum = nil --> humanoid can have any name! character = nil --> the model which should be a figure
for _,o in pairs(character:GetChildren()) do if o:IsA("Humanoid") then hum = o end end
I hope this helps you, and I gotta say, I don't understand your question neighter :( But I think this is what you're looking for!
~sycips~ |
|
|
| Report Abuse |
|
|
junnxiang
|
  |
| Joined: 14 Feb 2008 |
| Total Posts: 28 |
|
|
| 18 Nov 2013 11:29 PM |
You mean this one? The fuction of tagHumanoid?
function tagHumanoid(humanoid,player,didheadshot) if humanoid and player then for i,v in ipairs(humanoid:GetChildren()) do if v and v.Parent~=nil then if v.Name=="creator" then v:remove() end end end local creatortag=Instance.new("ObjectValue") creatortag.Value=player creatortag.Name="creator" local weapontag=Instance.new("StringValue") weapontag.Name="WeaponTag" weapontag.Value=sp.Name weapontag.Parent=creatortag if didheadshot then local headshottag=Instance.new("BoolValue") headshottag.Name="HeadshotTag" headshottag.Value=true headshottag.Parent=creatortag end creatortag.Parent = humanoid debris:AddItem(creatortag,2) end end |
|
|
| Report Abuse |
|
|
junnxiang
|
  |
| Joined: 14 Feb 2008 |
| Total Posts: 28 |
|
| |
|
junnxiang
|
  |
| Joined: 14 Feb 2008 |
| Total Posts: 28 |
|
| |
|
breuning
|
  |
| Joined: 30 Oct 2008 |
| Total Posts: 4268 |
|
|
| 19 Nov 2013 05:18 AM |
| putting "bump" into brackets won't make people fix your script. |
|
|
| Report Abuse |
|
|
| |
|
sycips
|
  |
| Joined: 21 Mar 2011 |
| Total Posts: 1368 |
|
|
| 23 Nov 2013 03:34 AM |
| @Junn for real...? Have you got any idea what your script does, what my script does and what I just told you? Cause you seem to have no bloody idea.... |
|
|
| Report Abuse |
|
|