May 23, 2012, 02:28:31 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Please report any bugs or issues that you might be encountering with the Beta in the Support System so that we can better keep track of any oustanding issues that may come up.

GameCore Support System
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Make object loose HP on impact  (Read 751 times)
pixel_legolas
Hero Member
*****
Posts: 786


View Profile
« on: October 16, 2009, 03:55:39 PM »

I have a sword with a collision object around it called SwordTip.

I want to make a box have 100 HP and when I hit it with the SwordTip collision object makes it loose HP. Is it hard? Any snippets? I looked at network_character, exploadable, raygun etc but so much codes to patch together Smiley

PS. I managed to load a sword for the character by using

Quote
LoadObject sword.opr
ObjectName Sword
ObjectParent Bip01 Prop1

And also when I gave it a collsion object I have managed to make it so when the sword hits a physics box it actually moves it Smiley
« Last Edit: October 16, 2009, 03:58:28 PM by pixel_legolas » Logged
Ron
Sr. Member
****
Posts: 326


View Profile
« Reply #1 on: October 16, 2009, 08:41:02 PM »


I have no idea, hopefully someone else does. I am guessing it might go into the controller script for the sword in the following section?

Quote
//------------------------------------------------------------
//
//   void CollisionCallback( Object@ object, Object@ otherObject, ObjectCollide@ collide, ObjectCollide@ otherCollide, const Vector& in worldPos, const Vector& in normal)
//
//      Called whenever an object collides with another object.
//
//   Parameters:
//
//      object - The object that this controller is to act upon.
//      otherObject - the object that we have collided with
//      collide - the specific collision object that was hit
//      otherCollide - the specific collision object in the other object that was hit
//       worldPos - the specific location of the hit
//      normal - the normal of the hit itself
//
void CollisionCallback( Object@ object, Object@ otherObject, ObjectCollide@ collide, ObjectCollide@ otherCollide, const Vector& in worldPos, const Vector& in normal)
{
   
}


Logged
zknack
Full Member
***
Posts: 207


View Profile
« Reply #2 on: October 17, 2009, 12:16:49 AM »

Heartcode example has this almost exactly.

Also shows how to have something only happen once when the buttons pushed.
Logged
pixel_legolas
Hero Member
*****
Posts: 786


View Profile
« Reply #3 on: October 17, 2009, 05:34:17 AM »

Well imported the exploding barrel that has all of these things. But I can't get it to work with the sword. I have to hit the barrel with the character body to make it explode
Logged
gekido
Guest
« Reply #4 on: November 14, 2009, 12:47:52 PM »

The default weapons system has support for melee weapons.  Basically melee weapons are similar to projectile weapons, in that they do a raycast to see if/what the weapon hits.  For melee weapons, basically the raycast is much shorter, so the weapon only collides with something close to the player.

If you look at the SimpleFPS template (or add the SimpleWeaponPack as an object template to your project, you will find an example 'knife' weapon.

The magic line in the knife.opr file that differentiates it from a projectile weapon is this one:

ControllerSetting ShotMaxDistance 0.3

This basically defines the range of the melee weapon.
Logged
pixel_legolas
Hero Member
*****
Posts: 786


View Profile
« Reply #5 on: November 14, 2009, 08:56:17 PM »

quite logical but haven't looked at it yet, will do Smiley

Logged
Pages: [1]
  Print  
 
Jump to:  

 
Powered by MySQL Powered by PHP bluBlur Skin © 2006, hbSkins
Powered by SMF 1.1.14 | SMF © 2006-2011, Simple Machines LLC
Valid XHTML 1.0! Valid CSS!