Forum

> > CS2D > General > turret for DM
Forums overviewCS2D overviewGeneral overviewLog in to reply

English turret for DM

14 replies
To the start Previous 1 Next To the start

old turret for DM

JONY
User Off Offline

Quote
Is it possible to make so that a turret attacks everyone except the player who created it? It can be effectively used with Deathmatch mod

I assume that currently, that as soon as the turret sees a player it checks whether he is T or CT and decides to shoot or not, but it would be cool to make so that it checks player's id and decides to kill this player or not.

Regards,
J.

old Re: turret for DM

SRAN
User Off Offline

Quote
whta do you mean it already done in deathmatch mode this dont make sence

old Re: turret for DM

JONY
User Off Offline

Quote
Oh sorry, didnt say it correctly.
I want the turret to attack everyone (except the creator) in TEAM deathmatch mode
(it sounds pointless, but it's still cool, can be used for mods)

old Re: turret for DM

JONY
User Off Offline

Quote
Well, i kind of tried to do it with lua:
Spoiler >


Or should i rather post it in Lua thread?

old Re: turret for DM

Surplus
User Off Offline

Quote
Yes, post it in the lua section.
And it is possible. If the player builds the turret, make it neutral on HIS NAME!

old Re: turret for DM

JONY
User Off Offline

Quote
Wow thanx PartyPooPer... that seems to be the complete solution
gonna do it now

Edit: Shiiiiit. The neutral turret attacks your teammates but doesnt do any damage. I tried also doing that the turret is completely neutral (not built by you), but in that case it kills you as well (but that's to be expected)

I tried to make it so that with lua script turret also takes away hp from your teammates:
1
2
3
4
5
6
7
8
9
10
11
addhook("second","turret")
function turret()
	if (object(12,"exists") and object(12,"target") ~= 0 and object(12,"target") ~= object(12,"player"))  then
		local id = object(12,"target")
		if (player(id,"health")+10)>10 then
			parse("sethealth "..id.." "..player(id,"health")-10)
		else
			parse("customkill "..id.." Turret "..id)
		end
	end
end

But for some reason it tells me that player(id,"health") is a boolean and i cant perform arithmetic operations on it i thought it returns player's health. Can anyone help?
edited 1×, last 10.12.10 10:38:15 pm

old Re: turret for DM

SRAN
User Off Offline

Quote
in a rp server i saw white colored buildings it dont attack it dont make anything even the wall if you hit it it wont explode how is this possible

old Re: turret for DM

Phe0
User Off Offline

Quote
Just if you are admin, you can spawn objects, like
/spwanobject <type of object> <TileX> <TileY> <rotation> <mode (Like a supply, by selecting 1 you're making supply, which is making 1st weapon from list) <team (here are only 3 normal 0 - neutral, and 1,2 (tt or ct), more than 2 makes them white) <PlayerID>
That's all about white ones.
That lua will be cool.

old Re: turret for DM

Vectarrio
User Off Offline

Quote
JONY has written
Shiiiiit. The neutral turret attacks your teammates but doesnt do any damage. I tried also doing that the turret is completely neutral (not built by you), but in that case it kills you as well (but that's to be expected)

turn off friendlyfire

old Re: turret for DM

SRAN
User Off Offline

Quote
Pho has written
Just if you are admin, you can spawn objects, like
/spwanobject <type of object> <TileX> <TileY> <rotation> <mode (Like a supply, by selecting 1 you're making supply, which is making 1st weapon from list) <team (here are only 3 normal 0 - neutral, and 1,2 (tt or ct), more than 2 makes them white) <PlayerID>
That's all about white ones.
That lua will be cool.

uh i dont understand i think i should see it in commands

old Re: turret for DM

JONY
User Off Offline

Quote
Vectar666 has written
turn off friendlyfire


doesnt work, i can kill teammates, but the turret doesnt (even though it shoots them but doesnt do any damage)

7agarrr has written
even the wall if you hit it it wont explode how is this possible


put this into your server.lua file:
1
2
3
4
addhook("objectdamage","nodamage")
function nodamage()
	return 1
end
To the start Previous 1 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview