generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: How do you make a capturable flag like the 1s in Wingman8's "Armored patrol" and "City patrol" games?

Previous Thread :: Next Thread 
almanandACDC is not online. almanandACDC
Joined: 17 Apr 2009
Total Posts: 746
20 Jun 2011 09:04 AM
I want to add one to my game that isn't a free model, and I need to know how to make it!
Report Abuse
Camoy is not online. Camoy
Joined: 21 May 2009
Total Posts: 6207
20 Jun 2011 09:05 AM
There should be a flag on a flag stand in the Insert panel.
Report Abuse
myrobloxman is not online. myrobloxman
Joined: 06 Dec 2009
Total Posts: 1369
20 Jun 2011 09:05 AM
never played the game...
Report Abuse
almanandACDC is not online. almanandACDC
Joined: 17 Apr 2009
Total Posts: 746
20 Jun 2011 09:08 AM
Yes, i know there is a stand but the one in his games go up and down and you do not have to pick it it you just stand next to it!
Report Abuse
almanandACDC is not online. almanandACDC
Joined: 17 Apr 2009
Total Posts: 746
20 Jun 2011 09:11 AM
What I mean is, I want a flag that you stand close to and then it goes up and down until you capture it.
Report Abuse
myrobloxman is not online. myrobloxman
Joined: 06 Dec 2009
Total Posts: 1369
20 Jun 2011 09:13 AM
script it
Report Abuse
almanandACDC is not online. almanandACDC
Joined: 17 Apr 2009
Total Posts: 746
20 Jun 2011 09:15 AM
I don't know how to script...
Report Abuse
myrobloxman is not online. myrobloxman
Joined: 06 Dec 2009
Total Posts: 1369
20 Jun 2011 09:27 AM
[ Content Deleted ]
Report Abuse
almanandACDC is not online. almanandACDC
Joined: 17 Apr 2009
Total Posts: 746
20 Jun 2011 09:30 AM
Ok, that was pretty lol. BUT I REALLY NEED HELP!!!
Report Abuse
Wfs225 is not online. Wfs225
Joined: 16 Jan 2010
Total Posts: 65
20 Jun 2011 09:36 AM
This is not a request forum so sorry.
Report Abuse
almanandACDC is not online. almanandACDC
Joined: 17 Apr 2009
Total Posts: 746
20 Jun 2011 09:37 AM
No! I am asking how to make one! ...
Report Abuse
almanandACDC is not online. almanandACDC
Joined: 17 Apr 2009
Total Posts: 746
20 Jun 2011 09:38 AM
God, posting forums for help and keeping them on track is extremely hard work!
Report Abuse
darkkiller5555 is not online. darkkiller5555
Joined: 22 Nov 2009
Total Posts: 6359
20 Jun 2011 09:59 AM
Well, if you don't know HOW to script, you're not gonna understand HOW to make it.
Report Abuse
1Ra is not online. 1Ra
Joined: 02 May 2010
Total Posts: 2400
20 Jun 2011 10:15 AM
use a ontouched function.
Report Abuse
TheReturned is not online. TheReturned
Joined: 06 Feb 2011
Total Posts: 30
20 Jun 2011 10:48 AM
onTouched won't work, you gotta use magnitude.
Report Abuse
myrobloxman is not online. myrobloxman
Joined: 06 Dec 2009
Total Posts: 1369
20 Jun 2011 10:49 AM
on touch will work if you make an invisible and can collide false brick around the flag ;P
Report Abuse
TheReturned is not online. TheReturned
Joined: 06 Feb 2011
Total Posts: 30
20 Jun 2011 10:51 AM
It's too complicated though. You'd have to have multiple bricks and multiple checks on them.
Report Abuse
myrobloxman is not online. myrobloxman
Joined: 06 Dec 2009
Total Posts: 1369
20 Jun 2011 10:53 AM
I wasn't saying it's the best I was just saying magnitude isn't the only way
Report Abuse
TheReturned is not online. TheReturned
Joined: 06 Feb 2011
Total Posts: 30
20 Jun 2011 11:19 AM
Touche.
Report Abuse
almanandACDC is not online. almanandACDC
Joined: 17 Apr 2009
Total Posts: 746
27 Jul 2011 07:23 PM
lol?
Report Abuse
RBXSummerDay is not online. RBXSummerDay
Joined: 07 Oct 2010
Total Posts: 99
27 Jul 2011 07:26 PM
I've come up with code similar to what I believe you want. Let me... retrieve it..
Report Abuse
darkkiller5555 is not online. darkkiller5555
Joined: 22 Nov 2009
Total Posts: 6359
27 Jul 2011 07:27 PM
.Touched

Not onTouch. onTouch is merely the name of the function that people chose to use. The real event is .Touched.

Magnitude is your answer.

if (plyr.Torso.Position - flag.Position).magnitude <= 10 then
Report Abuse
RBXSummerDay is not online. RBXSummerDay
Joined: 07 Oct 2010
Total Posts: 99
27 Jul 2011 07:33 PM
This is a bugged version of my flag capture script. I don't remember how I fixed it...






local OwnerTeam = script.Parent.OwnerTeam
local Flag = script.Parent.Flag.Fabric
local time4one = 4
local offset = 0
local red = BrickColor.new("Bright red")
local blue = BrickColor.new("Bright blue")
local default = BrickColor.new("Medium stone grey")

function getTeams() --reds, blues
        local reds = { }
        local blues = { }
        for _, v in pairs(game.Players:GetPlayers()) do
                if v.TeamColor == red then
                        table.insert(reds, v)
                else
                        table.insert(blues, v)
                end
        end
        return reds, blues
end

function getNumRedsBluesInArea()
        local reds, blues = getTeams()
        local redC, blueC = 0, 0;
        for _, v in pairs(reds) do
                if v.Character and v.Character:FindFirstChild("Torso") then
                        if (v.Character.Torso.Position.x^2 + v.Character.Torso.Position.z^2)^0.5 <= script.Parent.Region.Size.x/2 then
                                redC = redC + 1
                        end
                end
        end
        for _, v in pairs(blues) do
                if v.Character and v.Character:FindFirstChild("Torso") then
                        if (v.Character.Torso.Position.x^2 + v.Character.Torso.Position.z^2)^0.5 <= script.Parent.Region.Size.x/2 then
                                blueC = blueC + 1
                        end
                end
        end
        return redC, blueC
end

function getPeople() --ALWAYS ally, enemy
        if OwnerTeam.Value == default then return getTeams() end
        local enemies = { }
        local allies = { }
        for _, v in pairs(game.Players:GetPlayers()) do
                if v.TeamColor ~= OwnerTeam.Value then
                        table.insert(enemies, v)
                else
                        table.insert(allies, v)
                end
        end
        return allies, enemies
end

function ResetFlag()
        Flag.Mesh.Offset = Vector3.new(0,0,0)
end

function Capture(team)
        local reds, blues = getTeams()
        if team == red then
                for _, v in pairs(reds) do
                        if v.Character and v.Character:FindFirstChild("Torso") then
                                if (v.Character.Torso.Position.x^2 + v.Character.Torso.Position.z^2)^0.5 <= script.Parent.Region.Size.x/2 then
                                        v.leaderstats.Points.Value = v.leaderstats.Points.Value + 50
                                end
                        end
                end
        else
                for _, v in pairs(blues) do
                        if v.Character and v.Character:FindFirstChild("Torso") then
                                if (v.Character.Torso.Position.x^2 + v.Character.Torso.Position.z^2)^0.5 <= script.Parent.Region.Size.x/2 then
                                        v.leaderstats.Points.Value = v.leaderstats.Points.Value + 50
                                end
                        end
                end
        end
        for _, v in pairs(script.Parent:GetChildren()) do
                if v:IsA("SpawnLocation") then
                        v.TeamColor = team
                end
        end
        OwnerTeam.Value = team
        Flag.BrickColor = team
        ResetFlag()
end

function Recolor(team)
        Flag.BrickColor = team
end

function GetFirstInArea()
        while true do
                for _, v in pairs(game.Players:GetPlayers()) do
                        if v.Character and v.Character:FindFirstChild("Torso") then
                                if (v.Character.Torso.Position.x^2 + v.Character.Torso.Position.z^2)^0.5 <= script.Parent.Region.Size.x/2 then
                                        return v
                                end
                        end
                end
                wait()
        end
end

function Animate()
        local Noob = GetFirstInArea()
        while offset > -10 do
                local R, B = getNumRedsBluesInArea()
                if Noob.TeamColor == red and R == 0 then ResetFlag() return end
                if Noob.TeamColor == blue and B == 0 then ResetFlag() return end
                if R==0 and B==0 then ResetFlag() return end
                if (R==0 and B~=0) or (R~=0 and B==0) then
                        offset = offset - (1/time4one * (Noob.TeamColor == red and R or B))
                        Flag.Mesh.Offset = Vector3.new(0,offset,0)
                end
                wait(0.05)
        end
        Recolor(Noob.TeamColor)
        while offset < 0 do
                local R, B = getNumRedsBluesInArea()
                if Noob.TeamColor == red and R == 0 then ResetFlag() return end
                if Noob.TeamColor == blue and B == 0 then ResetFlag() return end
                if R==0 and B==0 then ResetFlag() return end
                if (R==0 and B~=0) or (R~=0 and B==0) then
                        offset = offset + (1/time4one * (Noob.TeamColor == red and R or B))
                        Flag.Mesh.Offset = Vector3.new(0,offset,0)
                end
                wait(0.05)
        end
        Capture(Noob.TeamColor)
end

Recolor(OwnerTeam.Value)
while wait() do
        Animate()
end
Report Abuse
darkkiller5555 is not online. darkkiller5555
Joined: 22 Nov 2009
Total Posts: 6359
27 Jul 2011 07:38 PM
T.T

print(Roblox.People.RBXSummerDay:GetMainAccount())
Report Abuse
RBXSummerDay is not online. RBXSummerDay
Joined: 07 Oct 2010
Total Posts: 99
27 Jul 2011 07:41 PM
> "The data is not Archived."
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image