Page 1 of 1

Scripting: Attach to Model

Posted: Mon Aug 25, 2003 12:40 pm
by SNakeFluGeL
I am creating a sort of Capture the Flag game, the allies have to steal the documents from the axis base and return it to theirs, axis job is to defend the documents. We have been playing this and it all looks promising...

The documents are hidden on a random place and you can grab them, and the documents will be attached in the left_hand of the player. So other people can actually see that he got the documents. Nothing wrong so far, even drop the documents seems to be working perfect.

But then a friend of mine discovered something which I just can't find the answer on. Somehow if you grab the documents with a 'rifle' 'sniper' or 'bazooka' and you reload with the rifle, the gun dissapears all of a sudden (now you only have grenades and pistol) and with a sniper and bazooka when you fire one shot, it's gone.... You don't have this problem with the SMG, MG or Shotgun.

In the script I had to add this line:

Code: Select all

attachdocs local.player:
	// Attach the Documents to the Stealer
	 while ((isalive local.player) && (level.stealerdoc == "true")) {
		 waitframe
		 local.player removeattachedmodel "tag_weapon_left"
		 local.player attachmodel "models/items/documents1a.tik" "tag_weapon_left" "0.75"
	 }
	 local.player removeattachedmodel "tag_weapon_left"
end
To keep the documents attached to the player so if it changes weapon or holster it, it won't dissapear, maybe the bug is in here since it removed the attachedmodel in the tag_weapon_left =/ Hope you guys can help me out quick :$

Posted: Tue Aug 26, 2003 6:24 am
by jv_map
I think the continuous removeattachedmodel is the problem.

This is the garand reload animation:

Code: Select all

//=========================
// Reload Garand
//========================
rifle_reload		viewmodel/rifle/tps_garand_reload.skc		crossblend 0.05
{
	server
	{
		first reloadweapon
		// attach the weapon to the left hand
		1	weaponcommand mainhand attachtohand offhand									
		// put the ammo clip in the right hand
		4	attachmodel models/ammo/garand_clip_reload.tik tag_weapon_right				
		// put the clip ammo into the gun
		34	weaponcommand mainhand clip_fill											
		// remove the clip model from the right hand
		42	removeattachedmodel tag_weapon_right 0 models/ammo/garand_clip_reload.tik	
		// reattach the weapon to the right hand
		57	weaponcommand mainhand attachtohand mainhand								
	}
}
As you can see at the very first frame the rifle is attached to the 'offhand' of the player which is the left hand. Thus, if the removedattachmodel command is issued when reloading both the docs and the weapon are removed.

A simple solution is to use the attach command instead.

Code: Select all

attachdocs local.player:
	// Attach the Documents to the Stealer
	local.docs = spawn "models/items/documents1a.tik"
	local.docs attach local.player "tag_weapon_left"

	while ((isalive local.player) && (level.stealerdoc == "true"))
		waitframe

	local.docs remove
end

Posted: Tue Aug 26, 2003 12:00 pm
by SNakeFluGeL
I think the problem with what you wrote was that when you change or holster your weapon the documents will not be attached anymore... But I will test it ..

Posted: Tue Aug 26, 2003 12:57 pm
by SNakeFluGeL
Well now the rifle sniper and bazooka indeed don't go away but now the documents aren't attached to the player =/

Posted: Tue Aug 26, 2003 2:12 pm
by jv_map
Hmm that's strange, maybe try another tag just for a test.
local.docs attach local.player "Bip01 Pelvis"

Posted: Tue Aug 26, 2003 2:35 pm
by SNakeFluGeL
jv_map how do you know all the tags? like that pelvis one ? Btw will test it m8 thanks a lot! I have to finish this map tonight :oops:

Posted: Tue Aug 26, 2003 3:05 pm
by SNakeFluGeL
tag_weapon_left
tag_weapon_right

=)

The Pelvis one doesn't seem to work either =( I don't see the documents on the player itself =(

Posted: Wed Aug 27, 2003 5:57 pm
by SNakeFluGeL
U got some other body poarts?

Posted: Wed Aug 27, 2003 7:50 pm
by Alcoholic
Heres all the tags:
I wrote:Bip01 pos
Bip01 rot
Bip01 Footsteps pos
Bip01 Footsteps rot
ORIGIN pos
ORIGIN rot
Bip01 Pelvis pos
Bip01 Pelvis rot
Bip01 Spine pos
Bip01 Spine rot
Bip01 Spine1 pos
Bip01 Spine1 rot
Bip01 Spine2 pos
Bip01 Spine2 rot
Bip01 Neck pos
Bip01 Neck rot
Bip01 Head pos
Bip01 Head rot
Dummy21 pos
Dummy21 rot
eyes bone pos
eyes bone rot
Bip01 L Clavicle pos
Bip01 L Clavicle rot
Bip01 L UpperArm pos
Bip01 L UpperArm rot
Bip01 L Forearm pos
Bip01 L Forearm rot
Bip01 L Hand pos
Bip01 L Hand rot
Bip01 L Finger0 pos
Bip01 L Finger0 rot
Bip01 L Finger01 pos
Bip01 L Finger01 rot
Bip01 L Finger02 pos
Bip01 L Finger02 rot
Dummy06 pos
Dummy06 rot
Bip01 L Finger1 pos
Bip01 L Finger1 rot
Bip01 L Finger11 pos
Bip01 L Finger11 rot
Bip01 L Finger12 pos
Bip01 L Finger12 rot
Dummy07 pos
Dummy07 rot
Bip01 L Finger2 pos
Bip01 L Finger2 rot
Bip01 L Finger21 pos
Bip01 L Finger21 rot
Bip01 L Finger22 pos
Bip01 L Finger22 rot
Dummy08 pos
Dummy08 rot
Bip01 L Finger3 pos
Bip01 L Finger3 rot
Bip01 L Finger31 pos
Bip01 L Finger31 rot
Bip01 L Finger32 pos
Bip01 L Finger32 rot
Dummy09 pos
Dummy09 rot
Bip01 L Finger4 pos
Bip01 L Finger4 rot
Bip01 L Finger41 pos
Bip01 L Finger41 rot
Bip01 L Finger42 pos
Bip01 L Finger42 rot
Dummy10 pos
Dummy10 rot
tag_weapon_left pos
tag_weapon_left rot
Dummy22 pos
Dummy22 rot
Dummy12 pos
Dummy12 rot
Bip01 R Clavicle pos
Bip01 R Clavicle rot
Bip01 R UpperArm pos
Bip01 R UpperArm rot
Bip01 R Forearm pos
Bip01 R Forearm rot
Bip01 R Hand pos
Bip01 R Hand rot
Bip01 R Finger0 pos
Bip01 R Finger0 rot
Bip01 R Finger01 pos
Bip01 R Finger01 rot
Bip01 R Finger02 pos
Bip01 R Finger02 rot
Dummy01 pos
Dummy01 rot
Bip01 R Finger1 pos
Bip01 R Finger1 rot
Bip01 R Finger11 pos
Bip01 R Finger11 rot
Bip01 R Finger12 pos
Bip01 R Finger12 rot
Dummy02 pos
Dummy02 rot
Bip01 R Finger2 pos
Bip01 R Finger2 rot
Bip01 R Finger21 pos
Bip01 R Finger21 rot
Bip01 R Finger22 pos
Bip01 R Finger22 rot
Dummy03 pos
Dummy03 rot
Bip01 R Finger3 pos
Bip01 R Finger3 rot
Bip01 R Finger31 pos
Bip01 R Finger31 rot
Bip01 R Finger32 pos
Bip01 R Finger32 rot
Dummy04 pos
Dummy04 rot
Bip01 R Finger4 pos
Bip01 R Finger4 rot
Bip01 R Finger41 pos
Bip01 R Finger41 rot
Bip01 R Finger42 pos
Bip01 R Finger42 rot
Dummy05 pos
Dummy05 rot
tag_weapon_right pos
tag_weapon_right rot
Dummy27 pos
Dummy27 rot
Dummy28 pos
Dummy28 rot
Bip01 L Thigh rotFK
Bip01 L Calf rotFK
Bip01 L Foot pos
Bip01 L Foot rot
Bip01 L Foot rotFK
Bip01 L Toe0 pos
Bip01 L Toe0 rot
Dummy16 pos
Dummy16 rot
Dummy26 pos
Dummy26 rot
Dummy25 pos
Dummy25 rot
Bip01 R Thigh rotFK
Bip01 R Calf rotFK
Bip01 R Foot pos
Bip01 R Foot rot
Bip01 R Foot rotFK
Bip01 R Toe0 pos
Bip01 R Toe0 rot
Dummy11 pos
Dummy11 rot
Dummy32 pos
Dummy32 rot
Dummy31 pos
Dummy31 rot
Dummy24 pos
Dummy24 rot
Dummy23 pos
Dummy23 rot
Dummy29 pos
Dummy29 rot
Dummy30 pos
Dummy30 rot
Box02 pos
Box02 rot

Posted: Thu Aug 28, 2003 6:19 am
by jv_map
pos + rot = tag :wink:

Thus, 'Bip01 Footsteps pos' is tag 'Bip01 Footsteps' :)

Posted: Thu Aug 28, 2003 9:57 am
by SNakeFluGeL
'Bip01 L Hand' did the trick for me, thanks jv_map ...