Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 20:05
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (7th_zorro), 1,300 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to make a Plasma Grenade like in Halo 1- 3 ? #362456
03/08/11 12:55
03/08/11 12:55
Joined: Jun 2008
Posts: 402
Germany
S
sebbi91 Offline OP
Senior Member
sebbi91  Offline OP
Senior Member
S

Joined: Jun 2008
Posts: 402
Germany
Hi again,

I want to use grenades in my game that sticks at objects.
It's like the "Plasma Grenade" in Halo 1- 3?

Who don't know the game:
In the game is a kind of grenade that sticks at modells.
Here you can see it in action:
plasma grenade sample video
and here is something to read:
Plasma grenade text



Ok I think you know what I want.

I tried it by using the PhysX-Engine to throw the grenate.
Here is my hopeless try for the grenade.

Code:
action pl_grenade_act()
	{
		set(my,CAST|SHADOW|PASSABLE);
		my.emask|=ENABLE_SHOOT|ENABLE_BLOCK|ENABLE_IMPACT|ENABLE_ENTITY|ENABLE_FRICTION;
		my.push=50;		

		my.waittime=40;
		pXent_settype(me,PH_RIGID,PH_SPHERE);	
		pXent_setmass (my, 10); 
		pXent_setfriction (my, 80);
		pXent_setdamping (my, 10, 10); 
		pXent_setelasticity (my, 50); 
		my.lightrange=70;
		my.red=0;
		my.blue=100;
		my.green=20;
		
		pXent_settype(me, PH_RIGID, PH_SPHERE);
		
		wait(1);
		
		
		while(1)
		{	
                        //get sticky now:

			c_trace (my.x,you.x,IGNORE_ME|IGNORE_PASSABLE|SCAN_TEXTURE);	
			if(you&&my.waittime<=36)
			{		
			   pXent_settype(me,NULL,NULL);	
			   VECTOR hit_vec;		
			   CONTACT* contact1 =ent_getvertex(you,NULL,hit.vertex);
			   vec_for_ent (contact1.x, my);
			   vec_for_vertex (hit_vec,you,hit.vertex);
                           my.x=hit_vec.x;		
			}

                //handle time counter and explosion


                ...

			wait(1);
		}
	}




My problem is to handle that the grenade find the next vertex to stick on it.

I've read something about. hit.vertex but cant handle to use it.

I think its an hard way to get it working with the c_trace event.
My next try was to use the physX engine to get sure that the grenade collides with another PhysX-modell.


I used something like that:

Code:
pXent_setcollisionflag(me,enemy,NX_NOTIFY_ON_START_TOUCH); 
my.event=get_sticky;



But it doesn't work. frown



Any Ideas?
BTW I am using 3D Gamestudio A8-Commercial for that.


regards sebbi


3D-Gamestudio A8 - Commercial
Re: How to make a Plasma Grenade like in Halo 1- 3 ? [Re: sebbi91] #362486
03/08/11 15:01
03/08/11 15:01
Joined: Jul 2010
Posts: 974
United Arab Emirates, Dubai
TheShooter Offline
User
TheShooter  Offline
User

Joined: Jul 2010
Posts: 974
United Arab Emirates, Dubai
Try a partikeleffect. When define a rarius, where the grenade do some damage. Sorry, I'm not so good with physX.


Staub ist das neue Prime!!

Programming is like sex:
One mistake and you have to support it for the rest of your life.

Aktuelles Projekt: http://thisiswargame.bplaced.net/index.html

A8 Commercial *freu*
Re: How to make a Plasma Grenade like in Halo 1- 3 ? [Re: TheShooter] #362499
03/08/11 15:36
03/08/11 15:36
Joined: Dec 2008
Posts: 1,660
North America
Redeemer Offline
Serious User
Redeemer  Offline
Serious User

Joined: Dec 2008
Posts: 1,660
North America
Make an entity that flies through the air with c_move and the USE_POLYGON flag. When it hits another entity, you can make it stick by calculating the distance vector between the grenade and the hit entity and then set the grenade to the position of the hit entity + the calculated distance vector.

Here's an untested example action explaining what I mean:

Code:
#define reldist_x skill1
#define reldist_y skill2
#define reldist_z skill3
#define absdist_x skill4
#define absdist_y skill5
#define absdist_z skill6
#define entity_handle skill7

action grenade()
{
  my.reldist_x = 16; // forward velocity
  my.reldist_y = 0;
  my.reldist_z = 0;
  my.absdist_x = 0;
  my.absdist_y = 0;
  my.absdist_z = 16; // the grenade flies upwards at first.

  while( my ) // while I exist
  {
    if( !is(my,FLAG1) ) // "flying through the air" mode
    {
      my.absdist_z -= time_step; // the grenade flies downward over time.
      c_move( my, my.reldist_x, my.absdist_x, USE_POLYGON );
      if( trace_hit && you ) // hit an entity
      {
        // remember the entity I hit with a handle
        my.entity_handle = handle( you );

        // go to "sticky" mode
        set( my, FLAG1 );
      }
    }
    else // "sticky" mode
    {
      your = ptr_for_handle( my.entity_handle );
      if( your ) // only do this if the entity still exists, of course (otherwise we get a pointer error)
      {
        // In sticky mode, I repurpose my.absdist to be the position of the grenade + the distance between the grenade and the hit entity.
        vec_diff( my.absdist_x, my.x, your.x );
        vec_add( my.absdist_x, my.x );
        vec_set( my.x, my.absdist_x );
      }
    }

    wait(1);
  }
}



When this action is assigned to an entity, it will fly through the air with an initial upward velocity and begin to descend. When it hits another entity, it enters "sticky mode" and begins to stick to the entity!

Hope that helped. wink

Last edited by Redeemer; 03/08/11 15:40.

Eats commas for breakfast.

Play Barony: Cursed Edition!
Re: How to make a Plasma Grenade like in Halo 1- 3 ? [Re: Redeemer] #362509
03/08/11 16:35
03/08/11 16:35
Joined: Jun 2008
Posts: 402
Germany
S
sebbi91 Offline OP
Senior Member
sebbi91  Offline OP
Senior Member
S

Joined: Jun 2008
Posts: 402
Germany
first of all thanks for your posts.

it works but its not sticked at a vertex-point.
it means if the grenade is at the leg it doesn't sticked at the vertex at the leg, it's still in the position.

But thanks for your try anyway smile

any idea how to put it at the vertex ?


regards Sebbi


3D-Gamestudio A8 - Commercial
Re: How to make a Plasma Grenade like in Halo 1- 3 ? [Re: sebbi91] #362670
03/09/11 00:49
03/09/11 00:49
Joined: Dec 2008
Posts: 1,660
North America
Redeemer Offline
Serious User
Redeemer  Offline
Serious User

Joined: Dec 2008
Posts: 1,660
North America
You don't need to make the entity stick to a vertex. If the grenade sticks out from the entity after hitting it, you just need to make the bounding box of the grenade smaller, or just set the POLYGON flag on the grenade.


Eats commas for breakfast.

Play Barony: Cursed Edition!
Re: How to make a Plasma Grenade like in Halo 1- 3 ? [Re: Redeemer] #362677
03/09/11 03:34
03/09/11 03:34
Joined: May 2009
Posts: 1,816
at my pc (duh)
darkinferno Offline
Serious User
darkinferno  Offline
Serious User

Joined: May 2009
Posts: 1,816
at my pc (duh)
i think he means that your code follows a the entire models angles which doesnt work great if for example you stuck someone on the leg, it should move along with the leg as it moves

Re: How to make a Plasma Grenade like in Halo 1- 3 ? [Re: darkinferno] #362681
03/09/11 06:07
03/09/11 06:07
Joined: Aug 2003
Posts: 7,439
Red Dwarf
Michael_Schwarz Offline
Senior Expert
Michael_Schwarz  Offline
Senior Expert

Joined: Aug 2003
Posts: 7,439
Red Dwarf
just place the grenade at the nearest vertex, that should do it


"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku
Re: How to make a Plasma Grenade like in Halo 1- 3 ? [Re: Michael_Schwarz] #362739
03/09/11 14:54
03/09/11 14:54
Joined: Jun 2008
Posts: 402
Germany
S
sebbi91 Offline OP
Senior Member
sebbi91  Offline OP
Senior Member
S

Joined: Jun 2008
Posts: 402
Germany
Originally Posted By: Michael_Schwarz
just place the grenade at the nearest vertex, that should do it


And this is exactly what I want to have smile
Please, could you tell me how?

best regards
sebbi


3D-Gamestudio A8 - Commercial
Re: How to make a Plasma Grenade like in Halo 1- 3 ? [Re: sebbi91] #362767
03/09/11 16:12
03/09/11 16:12
Joined: May 2009
Posts: 1,816
at my pc (duh)
darkinferno Offline
Serious User
darkinferno  Offline
Serious User

Joined: May 2009
Posts: 1,816
at my pc (duh)
cant do it like that alone, because when you toss it at level models with low poly counts, such as a wall... the effect will fail, unless you check the type of entity and use two different attachment methods, anyways:

vec_for_vertex(my.x,you,VERTEXNUMBER);

read C_MOVE if you want to see how to get the vertex number, i dont have enough time to go into this now.. sorry

Re: How to make a Plasma Grenade like in Halo 1- 3 ? [Re: darkinferno] #362968
03/10/11 14:58
03/10/11 14:58
Joined: Jun 2008
Posts: 402
Germany
S
sebbi91 Offline OP
Senior Member
sebbi91  Offline OP
Senior Member
S

Joined: Jun 2008
Posts: 402
Germany
@ Michael_Schwarz: Please could you tell me how?
I can't get it working.

@darkinferno: The thing with walls is not the problem.
I have an system that kows if the ground is a map entity or an enemy (like, Vehicles or humans)
the only thing what i want to know is how to put the grenade at the models next vertex.

Quote:
i dont have enough time to go into this now.. sorry


No problem, but thanks anyway for your help. wink


kind regards

Sebbi


3D-Gamestudio A8 - Commercial

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1