Getting in and OUT of a turret

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Parts
Sergeant
Posts: 72
Joined: Thu Apr 10, 2003 12:35 pm
Location: UK
Contact:

Getting in and OUT of a turret

Post by Parts »

Hi,

I'm having trouble with a spearhead script. Having played with every setting under the sun and searched the forums I'm still having no joy. I've tried the jeep script posted earlier on these forums but that doesn't work either.

I have a script that places a player on a 30 car MG turret on the back of a jeep. Problem is getting the guy off the demn thing! Using DetatchTurret seems to just remove the turrret from the jeep but the player is still attached to the turret. Anyone know how to do this? Here's the script I have so far:

Code: Select all

Jeep:

	//spawn the jeep
	spawn vehicles/jeep.tik "targetname" "jeep"
	$jeep.origin = "-433 3732 1184" 
	$jeep.angle = 330
	$jeep.health = 5000
	$jeep takedamage
	
	
	//spawn the trigger around the jeep
	spawn trigger_use "targetname" "JeepTrigger"
	$JeepTrigger.origin = $jeep.origin
	$JeepTrigger.angles = $jeep.angles
	$JeepTrigger.model = "static/vehicle_jeep.tik"
	$JeepTrigger triggerable
	$JeepTrigger notsolid
	
	$JeepTrigger setthread "GetInJeep"
		
end

GetInJeep:

		local.Player = parm.other

		$jeep thread EnterJeep local.Player
		thread WatchPlayerInJeep local.Player

end

EnterJeep local.Player:
	
	local.Player iprint "Getting in Jeep"
	local.vturretent = self queryturretslotentity 0
	local.vturretent unlock
	self attachturretslot 0 local.Player
	//local.player perferredweapon ".30cal Machine Gun"
	local.vturretent lock
end

WatchPlayerInJeep local.Player:

	wait 2
	local.repeat = 1
	while (local.repeat == 1)
	{
		if (local.Player.useheld == 1)
		{
			local.Player iprint "Exiting Jeep"
			$jeep thread LeaveJeep local.Player
			local.repeat = 0
		}
		
		wait 1		
	}
end

LeaveJeep local.Player:

	[b][color=red]//THIS IS THE THREAD THAT DOESN'T WORK!!![/color][/b]

                local.vturretent = self queryturretslotentity 0

	//self DetachDriverSlot 0
	//self DetachPassengerSlot 0
	local.vturretent unlock
	self detachturretslot 0
	
	releaseplayer 
	cueplayer
	//local.vturretent delete
	//local.vturretent item_droptofloor
	level.InJeep = 0

	local.Player finishuseobject
	local.Player physics_on
	local.Player ready
	local.Player turretexit local.vturretent
	local.Player weapnext
	local.vturretent remove
	local.Player physics_on
end

[VS-UK]Capt.Parts[BnHQ]
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Try removing the turret immediately after detaching it.
Image
Parts
Sergeant
Posts: 72
Joined: Thu Apr 10, 2003 12:35 pm
Location: UK
Contact:

Post by Parts »

nope :(

This is obviously something that has changed between MOHAA and Spearhead. It must be possible but just doesn't seem to want to work.

Currently I end up out of the jeep but attahed to the turret. So it looks like the turret is till there from first person view. however you cannot shoot the turet so I suspect if has actuallly been removed. I think it might have something to do with weapon selection!
[VS-UK]Capt.Parts[BnHQ]
Angex
Major
Posts: 293
Joined: Mon Dec 30, 2002 1:23 pm
Contact:

Post by Angex »

Maybe you could try attaching NIL to the turret, thus removing the player.

Code: Select all

local.vturretent = self queryturretslotentity 0 
local.vturretent unlock 
self attachturretslot 0 NIL
local.vturretent lock
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

After you're stuck type 'state' in console. What does it say for legs and torso?
Image
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

forcelegsstate and forcetorsostate?
Post Reply