Floating items

Locked
nexus024
Posts: 148
Joined: Fri Oct 06, 2006 7:26 pm

Floating items

Post by nexus024 »

Is it possible to add in a item at any point in the map and have it float at a pre-defined position in the air?
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Re: Floating items

Post by ^misantropia^ »

Code: Select all

ent->spawnflags |= 1;
G_SetOrigin(ent, ent->s.origin);
From FinishSpawningItem() in game/g_items.c
nexus024
Posts: 148
Joined: Fri Oct 06, 2006 7:26 pm

Re: Floating items

Post by nexus024 »

I see this code inside g_items.c

Code: Select all

if ( ent->spawnflags & 1 ) {
  G_SetOrigin( ent, ent->s.origin );
}

I don't understand though how I can add an item that isn't already in the map with this code.
corncobman
Posts: 304
Joined: Fri Aug 08, 2003 7:00 am

Re: Floating items

Post by corncobman »

Look at how the items are spawned in g_item.c
-It is not the fall that kills you. It's the sudden stop at the end. (Douglas Adams)-

[url=http://www.violationentertainment.com/misc/ccm]-An eyeful a day is bloody fantastic!-[/url]
nexus024
Posts: 148
Joined: Fri Oct 06, 2006 7:26 pm

Re: Floating items

Post by nexus024 »

Ok, I'll have to research into what is going on in those functions.
Locked