Pickup weapon
by Rojalee · in Torque Game Engine · 04/21/2006 (8:47 am) · 7 replies
What is it that allows a player to pickup (mount) the crossbow?
I've inserted a weapon from Medieval Weapons Pack, but he won't pick it up.
What am I missing?
I changed this in server/scripts/game.cs
Will this work as a datablock for it?
I just made a copy of Crossbow and changed/deleted what was necessary.
I've inserted a weapon from Medieval Weapons Pack, but he won't pick it up.
What am I missing?
I changed this in server/scripts/game.cs
// Starting equipment %player.setInventory(Broadsword,1); %player.mountImage(BroadswordImage,0);
Will this work as a datablock for it?
I just made a copy of Crossbow and changed/deleted what was necessary.
//-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Crossbow weapon. This file contains all the items related to this weapon
// including explosions, ammo, the item and the weapon item image.
// These objects rely on the item & inventory support system defined
// in item.cs and inventory.cs
//-----------------------------------------------------------------------------
datablock ItemData(Broadsword)
{
// Mission editor category
category = "Weapon";
// Hook into Item Weapon class hierarchy. The weapon namespace
// provides common weapon handling functions in addition to hooks
// into the inventory system.
className = "Weapon";
// Basic Item properties
shapeFile = "~/data/shapes/broadsword/broadsword.dts";
mass = 1;
elasticity = 0.2;
friction = 0.6;
emap = true;
// Dynamic properties defined by the scripts
pickUpName = "a Broadsword";
image = BroadswordImage;
};
//--------------------------------------------------------------------------
// Crossbow image which does all the work. Images do not normally exist in
// the world, they can only be mounted on ShapeBase objects.
datablock ShapeBaseImageData(CrossbowImage)
{
// Basic Item properties
shapeFile = "~/data/shapes/broadsword/broadsword.dts";
emap = true;
// Specify mount point & offset for 3rd person, and eye offset
// for first person rendering.
mountPoint = 0;
eyeOffset = "0.1 0.4 -0.6";
// When firing from a point offset from the eye, muzzle correction
// will adjust the muzzle vector to point to the eye LOS point.
// Since this weapon doesn't actually fire from the muzzle point,
// we need to turn this off.
correctMuzzleVector = false;
// Add the WeaponImage namespace as a parent, WeaponImage namespace
// provides some hooks into the inventory system.
className = "WeaponImage";
};About the author
#2
maxInv[Broadsword] = 1;
to your player character.
Without MaxInv you will never pick it up :)
Regards
Graham
04/21/2006 (9:06 am)
This may seem silly, but in Player.cs have you added a line for MaxInventory such as maxInv[Broadsword] = 1;
to your player character.
Without MaxInv you will never pick it up :)
Regards
Graham
#3
he still wont pick it up.
Edit: AHA the crossbow that you can pick up is in a different place in the WorldEditorCreator.
my sword was only under Static Shapes.
how do I get it under Shapes?
I bet I need to have broadsword.cs initialized somewhere, but where do I stick it?
04/21/2006 (9:12 am)
Yes I had that.he still wont pick it up.
Edit: AHA the crossbow that you can pick up is in a different place in the WorldEditorCreator.
my sword was only under Static Shapes.
how do I get it under Shapes?
I bet I need to have broadsword.cs initialized somewhere, but where do I stick it?
#4
Look for exec("./crossbow.cs"); and add exec("./broadsword.cs"); directly after it.
Regards
Graham
04/21/2006 (9:20 am)
In Game.cs towards the top.Look for exec("./crossbow.cs"); and add exec("./broadsword.cs"); directly after it.
Regards
Graham
#5
I picked up a crossbow, and it became the sword???
it was xbow on the ground, the sword in my hand lol. and my sword shoots xbow bolts!!
so now i just have to get it to attack with it.
make the animations for the character to attack.
and the sword to attack.
I guess?
ok Solved that myself.
Now both work correctly.
04/21/2006 (9:37 am)
Here's a wierd one.I picked up a crossbow, and it became the sword???
it was xbow on the ground, the sword in my hand lol. and my sword shoots xbow bolts!!
so now i just have to get it to attack with it.
make the animations for the character to attack.
and the sword to attack.
I guess?
ok Solved that myself.
Now both work correctly.
#6
datablock ShapeBaseImageData(CrossbowImage)
should be
datablock ShapeBaseImageData(BroadswordImage)
04/21/2006 (10:50 pm)
I think this might explain the switchup you're experiencing:datablock ShapeBaseImageData(CrossbowImage)
should be
datablock ShapeBaseImageData(BroadswordImage)
Torque Owner Chris Byars
Ion Productions