Page 1 of 1
Getting DMTeam
Posted: Tue Dec 07, 2004 6:50 pm
by MPowell1944
Ok. I am trying to figure out a script for a mod that I am modifying. This is to prevent teamkilling.
Portable Mines. You pick them up from a central spot, and plant them. When you pick it up, I want the script to get your DMteam, and when a person steps on the mine that you've planted, if you both are on the same team, it doesnt hurt the person. Only blows up if other team steps on it. Right now, it kills anyone.
How would I go about getting a DMteam of the person who uses the trigger, then compare it to the person who steps on the mine that is placed?
Posted: Tue Dec 07, 2004 6:52 pm
by jv_map
Would be easier if you showed us some of your script, but I suppose just setting a variable like $mymine.attacker for the mine when it's being placed and then checking it at boom-time would do it

Posted: Tue Dec 07, 2004 7:06 pm
by MPowell1944
Here is the code for the Grabbing of the mine. Here you can see I did a teamcheck so I could add light to the mines so it would tell which team set them. I am assuming a similar method is used for the problem I am having.
Code: Select all
bomb_place:
local.player = parm.other
local.set = 0
while(local.player.useheld == 1)
{
local.count = getcvar "Elgan_mines"
local.count = int local.count
if (local.player.mines==local.count)
{
// local.player iprint "You need to find a mine first"
end
}
wait 1
local.set++
if(local.set ==3)
{
if(level.can==0)
{
end
}
level.can = 0
level.num++
local.player.mines++
// local.player waitthread global/items.scr::remove_item "explosive"
if(local.player.dmteam == "axis")
{
local.mine = spawn script_model "targetname" ("mine" + level.num)
local.mine model "items/explosive.tik"
local.mine.origin = local.player.origin
local.mine notsolid
local.mine light 100 0 0 64
local.mine setthread mine
}
else
{
local.mine = spawn script_model "targetname" ("mine" + level.num)
local.mine model "items/explosive.tik"
local.mine.origin = local.player.origin
local.mine notsolid
local.mine light 0 0 100 64
local.mine setthread mine
}
local.mine_trig = spawn trigger_multiple "targetname" ("mine_trig" + level.num)
local.mine_trig setsize ( -20 -20 -20 ) ( 20 20 20 )
local.mine_trig.origin = local.player.origin
local.mine_trig setthread mine
local.mine_trig nottriggerable
local.player playsound plantbomb1
local.mine_shoot = spawn trigger_multiple "spawnflags" "128" "health" "999999" "targetname" ("mineshot" + level.num)
local.mine_shoot setsize ( -20 -20 -20 ) ( 20 20 20 )
local.mine_shoot.origin = local.player.origin
local.mine_shoot setthread mine_shot
$("mineshot" + level.num) glue $("mine" + level.num)
$("mine_trig" + level.num) glue $("mine" + level.num)
local.bottom_spot = local.player.origin - ( 0 0 10000 )
local.spot = trace local.player.origin local.bottom_spot 0
$("mine" + level.num) moveto local.spot
$("mine" + level.num) speed 999
$("mine" + level.num) move
local.set = 0
// local.player iprint "You have 5 seconds to get out the way"
iprintln self.targetname
// wait 5
local.player iprint "Mine Active"
wait 2
local.mine_trig triggerable
level.can = 1
level.num1 = level.num
}
}
end
And here is the code for the stepping on the mine
Code: Select all
mine:
local.newnum = level.num
local.newnum = local.newnum - level.take
local.player=parm.other
local.Exp1 = spawn "fx/scriptbazookaexplosion.tik"
local.Exp2 = spawn "animate/fx_mortar_dirt.tik"
local.Exp1.origin = local.player.origin // $("bomb" + local.player).origin
local.Exp1 anim start
local.Exp2.origin = local.player.origin //$("bomb" + local.player).origin
local.Exp2 anim start
wait 1
local.Exp1 remove
local.Exp2 remove
for (local.t=0; local.t <= level.num + 1; local.t++)
{
if(self istouching $("mine" + local.t)){
$("mine" + local.t) remove
}
wait .1
}
self remove
end
I have tried checking the team and setvar after
mine: but when I do that, mod doesnt work at all for some reason.
Posted: Tue Dec 07, 2004 8:17 pm
by jv_map
Well in the mine placing code add s/th like this:
Where you have this:
Code: Select all
local.mine model "items/explosive.tik"
local.mine.origin = local.player.origin
local.mine notsolid
local.mine light 100 0 0 64
local.mine setthread mine
Add:
Code: Select all
// might want to use it to give planter kills
local.mine.planter = local.player
// also simply get team b/c planter could switch teams
local.mine.planter_team = local.player.dmteam
And in the explosion code add (below local.player = parm.other):
Code: Select all
if(local.player.dmteam == self.planter_team)
end
Posted: Tue Dec 07, 2004 9:41 pm
by MPowell1944
Ok I got it to work. However, will the mine still kill the person who places it?
Posted: Wed Dec 08, 2004 4:45 am
by Elgan
few,right
after 5 hours of debugging i read this thread again and realised self.planter_team is not the mine, its the trigger!!!!!!!
Code: Select all
mine:
local.newnum = level.num
local.newnum = local.newnum - level.take
local.player=parm.other
for (local.t=0; local.t <= level.num + 1; local.t++)
{
if(self istouching $("mine" + local.t))
{
if(local.player.dmteam == $("mine" + local.t).planter_team)
{
end
}
$("mine" + local.t) remove
}
wait .1
}
waitthread explode parm.other self.origin self
self remove
end
now im going to bed:)
Posted: Wed Dec 08, 2004 7:10 am
by jv_map
lol yah true

nice find Elgan

Posted: Wed Dec 08, 2004 5:15 pm
by Elgan
hehe luckily doin so i managed to remove alot of silly code and make it alot better. wonder if i made them silly code in the other mines scripts and sticky bombs:S