Page 1 of 1

Weapon Questions

Posted: Tue Apr 14, 2009 5:09 pm
by metal_head
OK, so I attatched a gun to a pawn, but I gotta question:
http://www.youtube.com/watch?v=chARlTWvigA I'm using the same actor as in this video, but in the video the gun sticks to the back o the pawn, the pawn can take it and hold it in it's hands, than put it back on it's back... How is this done? It's really cool! This pawn that I'm using has a High Level script with only one low level order, which checks if a trigger has been triggered, I'm sure that this will have to be done in Low Level, but I hope I can keep the structure of the rest of the script:

Code: Select all

{
TRIGGER [edoortrig]
TRIGGER2 [eldetect]
TRIGGER3 [egrunttalk2]

Spawn[ ()
{
Console(true);
SetWeapon("test_rifle");
NewOrder("Start");
} ]

Start[ ()
{
PlayerDistOrder(120, "StartTalking");
} ]

StartTalking[ ()
{
FacePlayer(true, true);
Delay("SG_Draw", 1.01, "");
SetEventState("egrunttalk", true);
Delay("SG_Idle", 1, "");
Delay("SG_Holster", 1.65, "");
Delay("Humming", 2, "");
Delay("SG_Draw", 1.01, "");
NewOrder("StartWalking");
} ] 

StartWalking[ ()
{
FacePlayer(false, false);
NextPoint();
RotateToPoint("SG_TurnLeft", 130, false, "" );
MoveToPoint("SG_Walk_N_Run", 150, "");
NewOrder("TalkAgain");
} ]

TalkAgain[ ()
{
Delay("SG_Walk_N_Stop", 0.85, "");
Delay("SG_Holster", 1.65, "");
Delay("Push_Button_low", 0.8, "");
Delay("Idle", 0.5, "");
SetEventState(TRIGGER, true); 
LowLevel("Detect");
} ]

Detect[ ()
{
if(GetEventState(TRIGGER2))
{
HighLevel("Finnish");
}
} ]

Finnish[ ()
{
NextPoint();
RotateToPoint("Idle", 130, false, "" );
MoveToPoint("Walk_N", 30, "");
RotateToPlayer("Walk_N", 100, false, "");
FacePlayer(true, true);
SetEventState(TRIGGER3, true);
Delay("Yawing", 5, "");
Delay("idle", 2, "");
SetEventState("nextlevel", true);
} ]
}
I have no Idea how this is done, the weapon is attatched to the bone "Hand" (again, I'm using the same actor), there's another bone on the back of the skeleton, I'm sure that the weapon uses it to attatch itself to the back of the pawn, but I have no Idea how can I make the weapon model change it's attatchment bone.

Re: Weapon Questions

Posted: Fri May 15, 2009 12:45 pm
by Juutis
You'll need two different actors (and two different models) because the weapon is attached to the bone(s) in the model itself. So one model where the weapon is attached to the back and one model where it's in the hand should work. Then the only thing you need to do is swap the pawn's weapon between those two.

Re: Weapon Questions

Posted: Fri May 15, 2009 2:11 pm
by metal_head
OK, so let me get this straight, now I got a pawn with a weapon (defined in pawn.ini) attatched to it, and I need two different pawns, one with the weapon attatched to it's hand and another with the weapon attatched to it's back, and I just switch between them?

Re: Weapon Questions

Posted: Fri May 15, 2009 2:35 pm
by Juutis
No, only one pawn but two weapons.

Re: Weapon Questions

Posted: Fri May 15, 2009 3:13 pm
by metal_head
Oh, that sounds simple, it will be harder to assign another weapon to the back bone of the player, than to script the weapon swap :lol:
Thanks!