Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Squishing the player.
Squishing the player.
2002-07-17, 6:54 PM #1
Ive finally gotten around to writing the TVTCS Door Module.. (Its about time, isnt it... [http://forums.massassi.net/html/wink.gif] ) But first, I wanted to test an actual door, in an actual door frame. So, I modified my POC to do this. I had to jimmy the template to get it work, but the problem is, it doesnt squish the player when it comes down. It just goes right through him like its set to collide 0 (Which, of course, it isnt).


My question is, what is a quick and easy way to detect object collision in cases like this? Or, more importantly, how would I squish the player if he is under the door? (Other than getthingsector()...)


For clarity, Ill give out my POC templates...

Code:
# DESC: 
# BBOX: -.03 -.03 -.03 .03 .03 .03
crate4_1_1        _walkstruct        model3d=plat.3do size=0.05 movesize=0.05 move=physics surfdrag=0 airdrag=0 mass=0 height=0.043038 physflags=0x425d
# DESC: Door 4x4 Single Drk Grey
# BBOX: -.2 -.01 -.15 .2 .01 .25
crate4_1_2        crate4_1_1         model3d=d4x4.3do height=-0.05 size=0.2 movesize=0.01 collide=3


The collide=3 was an appempt of mine to correct the problem...


Im sure I could figure it out on my own, but my time is getting more and more limited... [http://forums.massassi.net/html/frown.gif]

------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-07-18, 12:29 AM #2
Hmmm... try making it a structure.

Also, perhaps re-parsearging the collid- *is smacked*

And anyway, maybe I shouldn't be helping you... *squints* ;]
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2002-07-18, 4:09 AM #3
How bout this?
Code:
Touched:
thing = GetSenderRef()    // or GetSource
If((GetThingType(thing) == 2) || (GetThingType(thing) == 10)) Call blocked_door;
This will react to an actor or the player. [http://forums.massassi.net/html/biggrin.gif]

------------------
The Sniper Missions. Current project, The Sniper Missions
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-18, 5:15 AM #4
Unfortunatly, that would also call the code if the player simply bumped into the door.

I could do a mixture of that and sector checking...


*Loads Notepad*

------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-07-18, 1:01 PM #5
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Lord_Grismath:
And anyway, maybe I shouldn't be helping you...</font>


Problably not... [http://forums.massassi.net/html/wink.gif]


DP, your method doesnt work. Mainly because the engine doesnt call Touched or Entered when it hits the player. [http://forums.massassi.net/html/frown.gif]


But, the good news is, I solved the problem.


Inside the door class cog's pulse (The pulse that actully controlls the doors movement), I placed this code. Its only run when the door is on the downward motion, though...


Code:
If(Getthingsector(Player) == Pos_s && Vectordist(Getthingpos(Door), Frame0) <= Height) { 
Damagething(Player, Rand()*10, 0, Player); Addthingvel(Player, Kick0[Rand()*2]); } } }



In a nutshell, as the door is travelling downward, it checks every 0.01 seconds (The pulse speed) To see if it is within the player's height. If it is, and the player is also in the door's sector, it applies a random amount of damage, and kicks the player in one of two directions. (Either side of the door).


Bingo, problem solved. Thank you gentlemen, and goodnight... [http://forums.massassi.net/html/biggrin.gif]

------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-07-18, 1:14 PM #6
I swear it did. oh well... I guess I'll go off and do some cogs 'n' levels. [http://forums.massassi.net/html/smile.gif]

------------------
The Sniper Missions. Current project, The Sniper Missions
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-18, 1:33 PM #7
In any normal case, sure, it would. But these objects Im dealing with have really screwed up flags, so they dont always act the way you'd expect them to.

------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-07-18, 5:41 PM #8
Something like this should work. You will have to play with the offsets probably.

thing door
flex damage=100.0
flex yoffset=0.01
flex xoffset=0.01
flex zoffset=0.01

int target local
vector doorvec local
vector targvec local
***

touched:
if(GetSourceRef() != door) return;
target=GetSenderRef();
if(target != GetLocalPlayerThing()) return;

targvec=GetThingPos(target);
doorvec=GetThingPos(door);

if((VectorY(doorvec) +yoffset >= VectorY(targvec)) || (VectorY(doorvec) -yoffset >= VectorY(targvec))
{
if((VectorX(doorvec) +Xoffset >= VectorX(targvec)) || (VectorX(doorvec) -xoffset >= VectorX(targvec))
{
if((VectorZ(doorvec) +zoffset >= VectorZ(targvec)) || (VectorZ(doorvec) -zoffset >= VectorZ(targvec))
{
DamageThing(target, damage);
}
else
{
call open_door;
}
}
else
{
call open_door;
}
}
else
{
call open_door;
}


-Greven

*Edit*

Note to self: read entire post before posting. Kthx ignore this.

[This message has been edited by Evil_Greven (edited July 18, 2002).]
2002-07-18, 6:48 PM #9
Im afraid I dont quite understand why you are going to such leanghts to attain such a simple value. [http://forums.massassi.net/html/confused.gif]


Regardless, your code wouldnt work, as I said before, the engine isnt calling Touched or Entered... If it did, it would problably also collide properly...

------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.

[This message has been edited by GBK (edited July 18, 2002).]
And when the moment is right, I'm gonna fly a kite.
2002-07-19, 11:45 AM #10
*whew* for a moment I thought that was Greven il-Vec. (ye vets will know what I'm talking about)
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2002-07-19, 6:09 PM #11
I once went by that name, a long time ago, in a Zone far away.

Ah, it isn't? How odd. Ah well, least you got it to work.

-Greven

↑ Up to the top!