English Return flag to its Place

19 replies
Goto Page
To the start Previous 1 Next To the start
12.12.11 05:53:49 pm
Up
The Camo
User
Offline Off
Hey guys, I was wondering, is there a way to return a flag once its on the ground via lua command?

Or is that piece of lua missing?

Thanks.
-Camo
12.12.11 06:21:34 pm
Up
Cure Pikachu
User
Offline Off
I highly doubt you could.
Entity manipulation just isn't possible. Yet.
IMG:https://i.imgur.com/uUrye71.png
IMG:https://i.imgur.com/xpsyQRX.png
12.12.11 06:36:53 pm
Up
The Camo
User
Offline Off
Got it, thanks for the quick reply Pikachu.
12.12.11 07:15:20 pm
Up
Apache uwu
User
Offline Off
Good idea for the next version :DDD

I guess you could move someone on top of the flag and quickly back to where they were...
12.12.11 07:30:46 pm
Up
DC
Admin
Offline Off
lol that moving thing should actually work. the player would not even notice it because it happens in the same frame.
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
12.12.11 07:59:44 pm
Up
DarkLight66
User
Offline Off
Until there´s no player of that team.
Paradox
12.12.11 08:14:48 pm
Up
Yates
Reviewer
Offline Off
Couldn't you check if the item is dropped and then remove it? Or would the flag not respawn at it's original spot?
12.12.11 08:30:43 pm
Up
EngiN33R
Moderator
Offline Off
user Yates has written:
Couldn't you check if the item is dropped and then remove it? Or would the flag not respawn at it's original spot?


Yeah, that's the point - it wouldn't.
I code, therefore I exist. | Visit my blog for Lua tips and other interesting info
12.12.11 08:57:21 pm
Up
Leiche
Moderator
Offline Off
user DC has written:
lol that moving thing should actually work. the player would not even notice it because it happens in the same frame.

Wasn't there a problem with the Teamgates?
Where it couldn't get picked up anymore because of the Teamgate entity overlaying the "hitbox" of the flag?
Or is that a completely different story now?
I'm watching you sleep.
12.12.11 10:06:04 pm
Up
The Camo
User
Offline Off
Well, it would be much easier if there was a com for that. I'll think about the teleport thing, but it announces to everyone who picked it up, so when someone sees that they picked up the flag without being near it would go all derp'n'herp...
13.12.11 04:47:16 am
Up
CmDark
User
Offline Off
You could always just make a bot as a 'placeholder' which you could manipulate the team of and teleport and reteleport to a point in a map where it do nothing.

Possibly create two bots and leave them in respective bases and name them guardian or something of the respective teams and back to step 1.
IMG:http://i54.tinypic.com/auk478.png
13.12.11 08:04:20 am
Up
Apache uwu
User
Offline Off
This does work, however you will need at least one player on the team of the flag you are returning.

Oh and it gives the player 1k for returning.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
addhook("say","_say")

function _say(id,message)
     if string.lower(message)=="return flag" then
          returnFlag(player(id,"team"))
     end
end

function returnFlag(team)
     tmp=player(0,"team"..team.."living")
     tmp2={player(tmp[1],"x"),player(tmp[1],"y")}
     for _,key in ipairs(item(0,"table")) do
          if item(key,"type")==69+team then
               parse("setpos "..tmp[1].." "..(item(key,"x")*32).." "..(item(key,"y")*32))
          end
     end
     parse("setpos "..tmp[1].." "..tmp2[1].." "..tmp2[2])
end


Screenshots:

IMG:http://img803.imageshack.us/img803/9439/ctfcs2dfortress00154.jpg

IMG:http://img828.imageshack.us/img828/6867/ctfcs2dfortress00155.jpg
13.12.11 10:08:48 am
Up
Jynxxx
User
Offline Off
@user Apache uwu: Can you add that as a command to TLex would be great, because when some people have the flag, they just leave and it is hard to find
14.12.11 02:31:30 pm
Up
The Camo
User
Offline Off
@user Apache uwu:
Works nicely, I'll have to tweak it a little to suit the script.
Thanks, I'll be sure to give you credit for it.
14.12.11 04:46:40 pm
Up
DarkLight66
User
Offline Off
@user Jynxxx: i remember a friend "fixed" that glitch, just spawning another flag on the floor when someone leaves with it, so you´ll see the flag that was spawn, tought passing over it will trigger two "flag taken by ..." messages.
Paradox
15.12.11 11:51:38 am
Up
The Camo
User
Offline Off
Well, I finally started on this part of script.I remade user Apache uwu's to something like this:

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function ctfe.returnflag(id)
     for _,key in ipairs(item(0,"table")) do
          if (player(id,"health"))>=1 then
               if (player(id,"team"))==1 then
               ttmpmoney={player(id,"money")}
               ttmppos={player(id,"x"),player(id,"y")}
                    if item(key,"type")==70 then
                    parse("setpos "..id.." "..(item(key,"x")*32).." "..(item(key,"y")*32))
                    msg("©200200200ID "..id.." returns the flag. @C")
                    end
               parse("setmoney "..id.." "..ttmpmoney[1])
               parse("setpos "..id.." "..ttmppos[1].." "..ttmppos[2])
               end
          end
          if (player(id,"health"))>=1 then
               if (player(id,"team"))==2 then
               cttmpmoney={player(id,"money")}
               cttmppos={player(id,"x"),player(id,"y")}
                    if item(key,"type")==71 then
                    parse("setpos "..id.." "..(item(key,"x")*32).." "..(item(key,"y")*32))
                    msg("©200200200ID "..id.." returns the flag. @C")
                    end
               parse("setmoney "..id.." "..cttmpmoney[1])
               parse("setpos "..id.." "..cttmppos[1].." "..cttmppos[2])
               end
          end
     end
end


user Apache uwu's
Code:
1
2
3
4
5
6
7
8
9
10
11
12
function ctfe.returnflag(team)
tmp=player(0,"team"..team.."living")
tmpmoney={player(tmp[1],"money")}
tmp2={player(tmp[1],"x"),player(tmp[1],"y")}
     for _,key in ipairs(item(0,"table")) do
          if item(key,"type")==69+team then
          parse("setpos "..tmp[1].." "..(item(key,"x")*32).." "..(item(key,"y")*32))
          end
     end
     parse("setmoney "..tmp[1].." "..tmpmoney[1])
     parse("setpos "..tmp[1].." "..tmp2[1].." "..tmp2[2])
end


Since I want it to be timed by ms100 hook Which has ctfe.returnflag(id) that starts it. But only works for 1vs1(like user Apache uwu's when timed - using 'ctfe.returnflag(team)') instead of 1+vs1+. Any ideas of why is this happening, or a fix, would be appreciated.
15.12.11 05:36:16 pm
Up
DC
Admin
Offline Off
you can actually use cs2d cmd trigger to reset the flag entity - but this will only work if the flag entity has a name so you can trigger it. next version of cs2d will have the command cs2d cmd triggerposition which allows you to trigger every entity - but this is not implemented in the current version so you can't use it. you also have to remove the flag item then by using cs2d cmd removeitem (it has to be on the ground for this). you can use the Lua command cs2d lua cmd item to get a list of items and to find the flag item
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
15.12.11 06:56:29 pm
Up
The Camo
User
Offline Off
So then I could use..

Code:
1
2
3
4
5
for _,key in ipairs(item(0,"table")) do
     if item(key,"type")==70 then
     parse("triggerposition "..(item(key,"x")*32).." "..(item(key,"y")*32))
     end
end


Will it remove guns and all other stuff people drop along with flag? I don't mind though, just asking.
Would have to use "spawnitem" with a table or "mp_deathdrop" 0 then 1 in a frame. would mp_deathdrop cause problems occasional?
15.12.11 11:06:27 pm
Up
Apache uwu
User
Offline Off
@DC, using removeitem would completely remove it from play, no team can score now.

What about this?

triggeritem

Parameters

• item (0-X): id of an item on the map

Info
Trigger an item/weapon from the map (as server only).

So triggering a flag would return it.
16.12.11 12:22:40 am
Up
The Camo
User
Offline Off
@user Apache uwu:
Well, that would be only for flag then, would be easier to understand it if it is named "flagreturn" ..

But triggerposition seems it triggers every entity, not remove it. like, HEs will explode on touchdown, flags will be removed instantly, maybe rockets won't be able to pass.. who knows.
To the start Previous 1 Next To the start