Weird Spikes Question
Moderator: InsideQC Admins
11 posts
• Page 1 of 1
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 !?
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: Select all
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
};
- smd
- Posts: 26
- Joined: Sun Sep 23, 2007 2:58 pm
Change this:
To this ((I added some extra stuff too which should be there):
- Code: Select all
...
self.velocity = '0 0 0';
...
To this ((I added some extra stuff too which should be there):
- Code: Select all
...
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.
- Sajt
- Posts: 1215
- Joined: Sat Oct 16, 2004 3:39 am
After ...
add...
This will make them just disappear when they hit doors or dying monsters.
- Code: Select all
if (other.solid == SOLID_TRIGGER)
return; // trigger field, do nothing
add...
- Code: Select all
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.
- Sajt
- Posts: 1215
- Joined: Sat Oct 16, 2004 3:39 am
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?
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: Select all
.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
};
- smd
- Posts: 26
- Joined: Sun Sep 23, 2007 2:58 pm
Sorry. I think some dyslexic kid got on my inside3d account somehow and posted that. It's utter lies and untruths.
- Code: Select all
.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.
- Sajt
- Posts: 1215
- Joined: Sat Oct 16, 2004 3:39 am
So worldspawn is MOVETYPE_PUSH now? They keep changing that one on me.
Just change:
I've never been good at coughing up code without testing it.
Just change:
- Code: Select all
if (other.solid != SOLID_BSP || other.movetype == MOVETYPE_PUSH)
- Code: Select all
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.
- Sajt
- Posts: 1215
- Joined: Sat Oct 16, 2004 3:39 am
Sigh...
If the nails lag a frame behind the movers........... play with a higher framerate.
- Code: Select all
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.
- Sajt
- Posts: 1215
- Joined: Sat Oct 16, 2004 3:39 am
11 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest