View previous topic :: View next topic |
Author |
Message |
smd
Joined: 23 Sep 2007 Posts: 23
|
Posted: Fri Sep 28, 2007 6:17 pm Post subject: Weird Spikes Question |
|
|
hi!
i've tried out this nice tutorial from pastor and it worked great, thx!!
my only question: is it possible that the nails dont stuck so deep in the wall?
i want them that they stuck about half so deep!
maybe someone know whats to change here !?
Code: | void() spike_touch =
{
local float rand;
if (other == self.owner)
return;
if (other.solid == SOLID_TRIGGER)
return; // trigger field, do nothing
if (pointcontents(self.origin) == CONTENT_SKY)
{
remove(self);
return;
}
// hit something that bleeds
if (other.takedamage)
{
spawn_touchblood (9);
T_Damage (other, self, self.owner, 9);
remove(self); //add this so they don't float...
return; //add this to avoid errors
}
else
{
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
if (self.classname == "wizspike")
WriteByte (MSG_BROADCAST, TE_WIZSPIKE);
else if (self.classname == "knightspike")
WriteByte (MSG_BROADCAST, TE_KNIGHTSPIKE);
else
WriteByte (MSG_BROADCAST, TE_SPIKE);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
}
self.velocity = '0 0 0'; //add this, it makes the nail stop
self.nextthink = time + 10; //add this, to prevent packet overflows
self.think = SUB_Remove; //add this for same reason as above
}; |
|
|
Back to top |
|
 |
Sajt
Joined: 16 Oct 2004 Posts: 1026
|
Posted: Fri Sep 28, 2007 6:42 pm Post subject: |
|
|
Change this:
Code: | ...
self.velocity = '0 0 0';
... |
To this ((I added some extra stuff too which should be there):
Code: | ...
self.solid = SOLID_NOT;
self.movetype = MOVETYPE_NONE;
setorigin (self, self.origin - normalize(self.velocity) * 3);
self.velocity = '0 0 0';
... |
_________________ F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe. |
|
Back to top |
|
 |
smd
Joined: 23 Sep 2007 Posts: 23
|
Posted: Fri Sep 28, 2007 10:03 pm Post subject: |
|
|
thank u, workssss
the only problem now is that if i shoot an enemy and he falls down a few spikes always stuck in the air.
also when spikes are on a door, when the door opens, the spikes are also stucking in the air. |
|
Back to top |
|
 |
Sajt
Joined: 16 Oct 2004 Posts: 1026
|
Posted: Fri Sep 28, 2007 10:13 pm Post subject: |
|
|
After ...
Code: | if (other.solid == SOLID_TRIGGER)
return; // trigger field, do nothing |
add...
Code: | if (other.solid != SOLID_BSP || other.movetype == MOVETYPE_PUSH)
{
remove(self);
return;
} |
This will make them just disappear when they hit doors or dying monsters. _________________ F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe. |
|
Back to top |
|
 |
smd
Joined: 23 Sep 2007 Posts: 23
|
Posted: Fri Sep 28, 2007 10:42 pm Post subject: |
|
|
hmm..
now with this new piece of code my spikes fly through all enemys, walls...
i cant kill with spikes now
maybe i have put your code at the wrong place?
Code: | .float hit_z;
void() spike_touch =
{
local float rand;
if (other == self.owner)
return;
if (other.solid == SOLID_TRIGGER)
return; // trigger field, do nothing
if (other.solid != SOLID_BSP || other.movetype == MOVETYPE_PUSH)
{
remove(self);
return;
}
if (pointcontents(self.origin) == CONTENT_SKY)
{
remove(self);
return;
}
// hit something that bleeds
if (other.takedamage)
{
spawn_touchblood (9);
T_Damage (other, self, self.owner, 9);
remove(self); //add this so they don't float...
return; //add this to avoid errors
}
else
{
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
if (self.classname == "wizspike")
WriteByte (MSG_BROADCAST, TE_WIZSPIKE);
else if (self.classname == "knightspike")
WriteByte (MSG_BROADCAST, TE_KNIGHTSPIKE);
else
WriteByte (MSG_BROADCAST, TE_SPIKE);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
}
self.solid = SOLID_NOT;
self.movetype = MOVETYPE_NONE;
setorigin (self, self.origin - normalize(self.velocity) * 3);
self.velocity = '0 0 0'; //add this, it makes the nail stop
self.nextthink = time + 10; //add this, to prevent packet overflows
self.think = SUB_Remove; //add this for same reason as above
};
|
|
|
Back to top |
|
 |
Sajt
Joined: 16 Oct 2004 Posts: 1026
|
Posted: Sat Sep 29, 2007 8:13 am Post subject: |
|
|
Sorry. I think some dyslexic kid got on my inside3d account somehow and posted that. It's utter lies and untruths.
Code: | .float hit_z;
void() spike_touch =
{
local float rand;
if (other == self.owner)
return;
if (other.solid == SOLID_TRIGGER)
return; // trigger field, do nothing
if (pointcontents(self.origin) == CONTENT_SKY)
{
remove(self);
return;
}
// hit something that bleeds
if (other.takedamage)
{
spawn_touchblood (9);
T_Damage (other, self, self.owner, 9);
remove(self); //add this so they don't float...
return; //add this to avoid errors
}
if (other.solid != SOLID_BSP || other.movetype == MOVETYPE_PUSH)
{
remove(self);
return;
}
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
if (self.classname == "wizspike")
WriteByte (MSG_BROADCAST, TE_WIZSPIKE);
else if (self.classname == "knightspike")
WriteByte (MSG_BROADCAST, TE_KNIGHTSPIKE);
else
WriteByte (MSG_BROADCAST, TE_SPIKE);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
self.solid = SOLID_NOT;
self.movetype = MOVETYPE_NONE;
setorigin (self, self.origin - normalize(self.velocity) * 3);
self.velocity = '0 0 0'; //add this, it makes the nail stop
self.nextthink = time + 10; //add this, to prevent packet overflows
self.think = SUB_Remove; //add this for same reason as above
}; |
_________________ F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe. |
|
Back to top |
|
 |
smd
Joined: 23 Sep 2007 Posts: 23
|
Posted: Sat Sep 29, 2007 12:55 pm Post subject: |
|
|
fsss....
this also doesnt work
now i can kill enemys, but there are no spikes visible |
|
Back to top |
|
 |
Sajt
Joined: 16 Oct 2004 Posts: 1026
|
Posted: Sat Sep 29, 2007 2:54 pm Post subject: |
|
|
So worldspawn is MOVETYPE_PUSH now? They keep changing that one on me.
Just change: Code: | if (other.solid != SOLID_BSP || other.movetype == MOVETYPE_PUSH) | to: Code: | if (other != world) |
I've never been good at coughing up code without testing it. _________________ F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe. |
|
Back to top |
|
 |
smd
Joined: 23 Sep 2007 Posts: 23
|
Posted: Sat Sep 29, 2007 4:21 pm Post subject: |
|
|
now everything looks nice,thx. except a little problem that when i shoot on doors or elevators there is nothing to see.
no spikes and no impact fx.
maybe you can fix this last little problem also  |
|
Back to top |
|
 |
Sajt
Joined: 16 Oct 2004 Posts: 1026
|
Posted: Sat Sep 29, 2007 7:24 pm Post subject: |
|
|
Sigh...
Code: | void() spike_stuck_think =
{
if (self.aflag <= time)
{
remove (self);
return;
}
setorigin(self, self.pos1 + self.owner.origin - self.pos2);
self.nextthink = time;
};
void() spike_touch =
{
local float rand;
if (other == self.owner)
return;
if (other.solid == SOLID_TRIGGER)
return; // trigger field, do nothing
if (pointcontents(self.origin) == CONTENT_SKY)
{
remove(self);
return;
}
// hit something that bleeds
if (other.takedamage)
{
spawn_touchblood (9);
T_Damage (other, self, self.owner, 9, DTYPE_SHOT);
remove(self); //add this so they don't float...
return; //add this to avoid errors
}
else if (other.solid != SOLID_BSP)
{
remove(self);
return;
}
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
if (self.classname == "wizspike")
WriteByte (MSG_BROADCAST, TE_WIZSPIKE);
else if (self.classname == "knightspike")
WriteByte (MSG_BROADCAST, TE_KNIGHTSPIKE);
else
WriteByte (MSG_BROADCAST, TE_SPIKE);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
self.solid = SOLID_NOT;
self.movetype = MOVETYPE_NONE;
setorigin (self, self.origin - normalize(self.velocity) * 3);
self.velocity = '0 0 0'; //add this, it makes the nail stop
if (other.solid == SOLID_BSP && other != world)
{
self.owner = other;
self.pos1 = self.origin;
self.pos2 = other.origin;
self.aflag = time + 10;
self.think = spike_stuck_think;
self.nextthink = time;
}
else
{
self.nextthink = time + 10; //add this, to prevent packet overflows
self.think = SUB_Remove; //add this for same reason as above
}
}; |
If the nails lag a frame behind the movers........... play with a higher framerate. _________________ F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe. |
|
Back to top |
|
 |
smd
Joined: 23 Sep 2007 Posts: 23
|
Posted: Sat Sep 29, 2007 8:23 pm Post subject: |
|
|
wooow
now it works perfect!!!
thank u soooooooo much  |
|
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
|