Kill cam for mohaa where would I start

Post your scripting questions / solutions here

Moderator: Moderators

dcoshea
Colour Sergeant
Posts: 94
Joined: Thu Mar 04, 2004 3:00 am
Location: Sydney, Australia
Contact:

Post by dcoshea »

bdbodger wrote:well that bit of code still need work the command self stufftext "spectator" does put you in to spectator mode that is what is annoying about it . You will have to rechoose gun and team you can't just click the fire button and respawn .
How about:

Code: Select all

local.cur_team = local.player.dmteam
// do camera stuff here, setting to spectator mode, etc.
wait 5 // seconds, or whatever
local.player join_team local.cur_team
By the way, you do have to stufftext "spectator" and other comands like "join_team" above? I don't think you do which is why I didn't do it above. I believe the client just sends the command to the server when it's entered locally anyway.

I don't suppose the above code will work in Free-For-All mode since the documentation states that dmteam will return "freeforall" in that mode, instead of a team name.

I guess you might still have to re-select your weapon after that.
In this mode you can move like in noclip mode
So "spectator" goes into the spectator mode where you can move around, not the spectator mode where you follow a player - does anyone know how to go into the mode where you follow a player?
but you can't freelook either because of the viewangles statement or just that fact you are in spectator mode
In normal spectator mode you can look around freely, so I guess it's because of the viewangles statement. Do you agree?
I didn't know of an easy way to find who shot you are at least what direction you where shot from .
I posted some code earlier in this thread which isn't easy, but will tell you with reasonable accuracy (I think) who shot you.

Regards,
David
User avatar
small_sumo
Lieutenant General
Posts: 953
Joined: Mon Jul 01, 2002 4:17 pm
Contact:

Post by small_sumo »

Well for me rejoining team and gun is a small price tyo pay for finding the shooter, its a balanced pay off I think, why would it only work with 2 and not 3, 4 or 30?

Test it with a friend and experience it then you can comment from experience, not just guessing.
Image

www.smallsumo.tk

Yeah Truth above Honor Man ;)
dcoshea
Colour Sergeant
Posts: 94
Joined: Thu Mar 04, 2004 3:00 am
Location: Sydney, Australia
Contact:

Post by dcoshea »

small_sumo wrote:Well for me rejoining team and gun is a small price tyo pay for finding the shooter, its a balanced pay off I think, why would it only work with 2 and not 3, 4 or 30?
If there are two people playing, and one goes spectator, they will always spectate the other person, and if there are two people playing, and one gets shot, it's always the other one that shot them :)
Test it with a friend and experience it then you can comment from experience, not just guessing.
I'd need 2 friends to test the theory :) Anyway Bdbodger confirmed the code isn't doing anything to spectate on the shooter. Hopefully he'll volunteer to integrate my code which tries to figure out who shot you into his code, otherwise I can try doing it :)

Regards,
David
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

I seen your post about spawning triggers but it did not work for me . Maybe you can make a test script for us .
Image
dcoshea
Colour Sergeant
Posts: 94
Joined: Thu Mar 04, 2004 3:00 am
Location: Sydney, Australia
Contact:

Post by dcoshea »

bdbodger wrote:I seen your post about spawning triggers but it did not work for me . Maybe you can make a test script for us .
FYI I was using Spearhead when I was playing with this, hopefully that's not significant. Pretty much all I did was put the code I posted into maps/obj/obj_team2.scr with the addition of a thread which called the bullet_detect_init thread for one player. Also I guess I changed the bounding box a bit since I made the post, but I'm not sure.

I put this after level waittill spawn:

Code: Select all

	thread testing1
and put these new threads in:

Code: Select all

testing1:
	wait 5

	local.player = $player[1]
	local.player iprint "YOU HAVE THE TRIGGER"

	local.player thread bullet_detect_init

end

//
// bullet_detect_init -
//
// Call this thread once for each player.  self points to the Player object
// we wish to monitor.
//
bullet_detect_init:
	local.trigger = spawn trigger_multiple origin local.player.origin setthread bullet_detect_trigger spawnflags 128 // DAMAGE
	local.trigger setsize ( -32 -32 0) ( 32 32 96) // I think the bounding box for the player is actually ( -16 -16 0) ( 16 16 96), but with that size, not all bullets were detected, probably because the 'glue'ing of the trigger to the player isn't perfect and the trigger is probably not always completely aligned with the player, hence a margin around the player is needed
	local.trigger glue self // attach trigger to player
	local.trigger.player = self // so setthread thread can work out which player the trigger is attached to
end


//
// bullet_detect_trigger -
//
// Called when the trigger_multiple glued to a player is damaged.
//
bullet_detect_trigger:
	local.player = self.player // the player who this trigger is attached to
	local.shooter = parm.other // the player who fired the bullet
	iprintln_noloc "Shooter classname: " parm.other.classname
	if (isalive local.player) {
		if (local.player == local.shooter) {
			iprintln_noloc "Player " local.player.entnum " fired/bashed with his weapon" // or injured himself with his own grenade
		} else {
			iprintln_noloc "Player " local.shooter.entnum " shot at player " local.player.entnum
		}
	} else {
		if (local.player == local.shooter) {
			iprintln_noloc "Player " local.player.entnum " killed himself" // or possibly was firing at the same moment he got killed by another player
		} else {
			iprintln_noloc "Player " local.shooter.entnum " killed player " local.player.entnum
		}
	}
end
As you can see, rather than use proper code to detect players spawning, I just attached the trigger to the first player 5 seconds after they spawned because I was just testing. I can find some code which apparently accurately detects when players spawn (by not only checking for them being alive, but making sure they have a weapon in their hands) if you need it.

I hope it works for you!

Regards,
David
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

well it does not detect an ai shooting me . I think is did this before but maybe I did not set the trigger big enough or it was another part of the script I don't remember .
Image
dcoshea
Colour Sergeant
Posts: 94
Joined: Thu Mar 04, 2004 3:00 am
Location: Sydney, Australia
Contact:

Post by dcoshea »

bdbodger wrote:well it does not detect an ai shooting me . I think is did this before but maybe I did not set the trigger big enough or it was another part of the script I don't remember .
I didn't try with AI, I only saw it respond to (a) other players shooting me and (b) getting killed by an exploding barrel. I would kind of expect that if an exploding barrel is detected, AI would be too, but maybe you need to set the MONSTERS spawnflag too to get AI to be detected. I seem to remember that the DAMAGE spawnflags setting covered all damage regardless of MONSTERS being set or not, though :(

Are you using Spearhead too?

Regards,
David
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

No I am not useing spearhead . I think when I did his before I had not added a way to see if you where triggering it yourself . I did ignore hits by myself but had no output for it . Anyway will try it again later maybe.
Image
dcoshea
Colour Sergeant
Posts: 94
Joined: Thu Mar 04, 2004 3:00 am
Location: Sydney, Australia
Contact:

Post by dcoshea »

bdbodger wrote:No I am not useing spearhead . I think when I did his before I had not added a way to see if you where triggering it yourself . I did ignore hits by myself but had no output for it . Anyway will try it again later maybe.
I guess I ought to be the one to try and get my own code working so I can do it if you don't feel like it :) I can test it in both AA and Spearhead. I wouldn't be doing it until the weekend though.

Regards,
David
M&M
General
Posts: 1427
Joined: Sun Sep 14, 2003 1:03 am
Location: egypt
Contact:

Post by M&M »

hey,i have mohaa ,sh and bt .i could do testing 4 u if u tell me exactly what 2 do.i also have a lan which might be useful.however my response could be a day late or so :wink:
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

size

Post by tltrude »

I am pretty sure a player's origin is at or near his feet. So, that trigger will be to low and may only come up to his knees.
Tom Trude,

Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

well it did detect when you shot your gun so it may work but I don't know why an ai didn't trigger it . Something different about a ai shooting or spawnflags need adjusting maybe . I want it to detect players anyway .
Image
User avatar
small_sumo
Lieutenant General
Posts: 953
Joined: Mon Jul 01, 2002 4:17 pm
Contact:

Post by small_sumo »

Good work guys, thanks for the effort so far.
Image

www.smallsumo.tk

Yeah Truth above Honor Man ;)
dcoshea
Colour Sergeant
Posts: 94
Joined: Thu Mar 04, 2004 3:00 am
Location: Sydney, Australia
Contact:

Post by dcoshea »

M&M wrote:hey,i have mohaa ,sh and bt .i could do testing 4 u if u tell me exactly what 2 do.i also have a lan which might be useful.however my response could be a day late or so :wink:
Thanks for the offer, might take you up on it :) Damn that Bdbodger, he has pointed out something regarding single-player-to-multi-player map conversions which will help me immensely with the few maps I've worked on (or helped with, at least) so I have to try and not get distracted by that work heheh :)

Regards,
David
dcoshea
Colour Sergeant
Posts: 94
Joined: Thu Mar 04, 2004 3:00 am
Location: Sydney, Australia
Contact:

Re: size

Post by dcoshea »

tltrude wrote:I am pretty sure a player's origin is at or near his feet. So, that trigger will be to low and may only come up to his knees.
I made it 96 units high, I thought that was the correct height of a player? I'm not sure where I think I got that information from but for some reason I think it's 96, could be totally wrong there :)

Regards,
David
Post Reply