View previous topic :: View next topic |
Author |
Message |
dayfive

Joined: 10 Nov 2006 Posts: 77
|
Posted: Thu Feb 28, 2008 2:21 am Post subject: func_train, one point at a time? |
|
|
hi,
is there presently any way in the plain generic quake engine to instead of having a trigger_once or trigger_multiple start a func_train in motion and not be able to stop it instead have some kind of trigger once to make the train simply increment one point along its path? |
|
Back to top |
|
 |
frag.machine

Joined: 25 Nov 2006 Posts: 728
|
Posted: Thu Feb 28, 2008 4:14 am Post subject: |
|
|
This can be handled in the QuakeC side, and I think mods like Quoth already do it. _________________ frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/ |
|
Back to top |
|
 |
Willem
Joined: 23 Jan 2008 Posts: 73
|
Posted: Thu Feb 28, 2008 10:49 am Post subject: |
|
|
I'm pretty sure this code does what you're asking. It's a func_train adaptation that will stop at any path_corner that has a wait of -1. When you trigger it again, it will move to the next one in the path.
If this doesn't work, I apologize, it may have rotted since I last used it.
You'll have to add some variables to def.qc like "isMoving". I hope this at least gets you on the right track.
Or use Quoth.
Code: |
// ================================================================
// FUNC_MOVER
// ================================================================
// Forward declarations
void() func_mover_next;
void() func_mover_use;
void() func_mover_wait;
void() func_mover_blocked =
{
if( time < self.attack_finished )
{
return;
}
self.attack_finished = time + 0.5;
T_Damage (other, self, self, self.dmg);
};
// Triggered.
void() func_mover_use =
{
// Ignore triggers if we are already moving
if( self.isMoving )
{
return;
}
func_mover_next();
};
void() func_mover_wait =
{
sound( self, CHAN_VOICE, self.noise, 1, ATTN_NORM );
if( self.wait )
{
self.nextthink = self.ltime + self.wait;
}
else
{
self.nextthink = self.ltime + 0.01;
}
self.isMoving = FALSE;
self.think = func_mover_next;
};
void() func_mover_next =
{
local entity targ;
targ = find( world, targetname, self.target );
self.target = targ.target;
if( !self.target )
{
objerror( "mover_next: no next target" );
}
if( targ.wait )
{
self.wait = targ.wait;
}
else
{
self.wait = 0;
}
self.isMoving = TRUE;
sound( self, CHAN_VOICE, self.noise1, 1, ATTN_NORM );
SUB_CalcMove( targ.origin - self.mins, self.speed, func_mover_wait );
};
void() func_mover_find =
{
local entity targ;
// Find the first path_corner we are targeting
targ = find( world, targetname, self.target );
self.target = targ.target;
// Move to the target
setorigin( self, targ.origin - self.mins );
// If this mover isn't being targetted, make it start moving immediately
if( !self.targetname )
{
// not triggered, so start immediately
self.nextthink = self.ltime + 0.1;
self.think = func_mover_next;
}
};
/*QUAKED func_mover (.8 .5 .0) ?
A mover is a brush entity that can move to path_corners.
This works a lot like a func_train except that each time the mover stops, it can be triggered again.
Set up a series of path_corners with a wait of -1 to create a mover that moves and stops at waypoints.
"sounds =
0) None
1) Train
2) Base
3) Medieval
*/
void() func_mover =
{
if( !self.speed )
{
self.speed = 100;
}
if (!self.target)
{
objerror ("func_mover without a target");
}
if( !self.dmg )
{
self.dmg = 2;
}
self.isMoving = FALSE;
self.cnt = 1;
self.solid = SOLID_BSP;
self.movetype = MOVETYPE_PUSH;
self.blocked = func_mover_blocked;
self.use = func_mover_use;
self.classname = "mover";
if (self.sounds == 0)
{
precache_sound ("misc/null.wav");
self.noise = ("misc/null.wav");
precache_sound ("misc/null.wav");
self.noise1 = ("misc/null.wav");
}
else if (self.sounds == 1)
{
precache_sound ("plats/train2.wav");
self.noise = ("plats/train2.wav");
precache_sound ("plats/train1.wav");
self.noise1 = ("plats/train1.wav");
}
else if (self.sounds == 2)
{
precache_sound ("plats/plat2.wav");
self.noise = "plats/plat2.wav";
precache_sound ("plats/plat1.wav");
self.noise1 = "plats/plat1.wav";
}
else if (self.sounds == 3)
{
precache_sound ("plats/medplat2.wav");
self.noise = "plats/medplat2.wav";
precache_sound ("plats/medplat1.wav");
self.noise1 = "plats/medplat1.wav";
}
setmodel( self, self.model );
setsize( self, self.mins, self.maxs );
setorigin( self, self.origin );
// Start movers on the second frame, to make sure their targets have had a chance to spawn
self.nextthink = self.ltime + 0.1;
self.think = func_mover_find;
};
|
_________________ www.wantonhubris.com |
|
Back to top |
|
 |
Dr. Shadowborg Inside3D Staff

Joined: 16 Oct 2004 Posts: 726
|
Posted: Thu Feb 28, 2008 4:28 pm Post subject: |
|
|
See Rogue's Dissolution of Eternity source as well. _________________ "Roboto suggests Plasma Bazooka." |
|
Back to top |
|
 |
leileilol

Joined: 15 Oct 2004 Posts: 1321
|
Posted: Thu Feb 28, 2008 6:33 pm Post subject: |
|
|
p0x's Extras has this too _________________
 |
|
Back to top |
|
 |
OneManClan
Joined: 28 Feb 2009 Posts: 62
|
Posted: Tue Apr 13, 2010 8:12 am Post subject: |
|
|
Can this function be used to make a (TF2 style) payload map for Quake1? ie to make the 'cart' stop and start along a fixed path?
ie
If there are Blue players near the cart it moves (slowly)along its path. If there are no Blue players near the cart for (eg) 20 secs, it slowly moves backwards. The cart gives health and ammo to the Blue team.
Possible?
OneManClan |
|
Back to top |
|
 |
c0burn
Joined: 05 Nov 2004 Posts: 158 Location: Liverpool, England
|
Posted: Tue Apr 13, 2010 9:20 am Post subject: |
|
|
Of course it's possible. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2004 phpBB Group
|