Author Topic: [function] Player collides with brick  (Read 1316 times)

What is the function for when a player collides with a brick?
Is it something like Armor::onCollide or anything like that?

fxDtsBrick::onPlayerTouch(%this,%obj,%client);
I think.

Yes, you can use event inputs as normal functions. I've done it with onActivate.

fxDtsBrick::onPlayerTouch(%this,%obj,%client);
I think.

Yes, you can use event inputs as normal functions. I've done it with onActivate.

So how can you run a regular script from there? That would be neat.


fxDtsBrick::onPlayerTouch(%this,%obj,%client);
I think.

Yes, you can use event inputs as normal functions. I've done it with onActivate.
Last I checked, this is not called unless the brick has a onplayertouch input event function.

I must've been wrong then.

onActivate was working without events being there though.

onPlayerTouch is called at any time a player is touching the brick. You can use onTeamPlayerTouch events and onBotTouch (this isn't a separate function, just triggered from onPlayerTouch) without there being a normal onPlayerTouch event on the brick.

but is there a function that is on the player, not on the brick?

I'm working on an playertype, but is it possible to let the brick dissapear when a player touches it, or should I add a package, that has the fxDtsBrick::onPlayerTouch edited, so that it checks if the playertype is that playertype, and than dissapear?

//Confusing text^

What are you actually trying to do?

onPlayerTouch is called at any time a player is touching the brick without there being a normal onPlayerTouch event on the brick.

Lies.
Code: [Select]
function FXDtsBrick::onPlayertouch(%this,%obj,%col)
{
if($Debug_OPT){
if(isobject(%obj.client)){
announce("killing.");
%obj.kill();
}else{
announce("not killing.");
}
   parent::onPlayerTouch(%this,%obj,%col);
}

I put this into a package which is enabled, turned on $debug_OPT, and spawned 2 2x2 bricks.
One has an onplayertouch event. The other does not. The evented one kills me, the other does not. Also for the record the onplayertouch event is not player>kill.




What are you actually trying to do?
I'm trying to make a new playertype, using the regular model, that when it touches a brick, the brick fake kills

Wouldn't you just fall through any and all terrain?

Wouldn't you just fall through any and all terrain?
no, the playertype should just let a brick fake kill when it touches it, it should only work with bricks, not with terrain

Wait, isn't it the armor::onCollision? used the trace function for my topic below, and there was a armor::onCollision function, i'll try if that is the function

Question: How do I know which variables should come in the function ()'s? Like Armor::onCollision(%this,...)
What one's do I need?

other question: Can I use the armor name of the specific playertype instead of armor in the function?
like myplayertypeArmor::onCollision?
« Last Edit: September 13, 2009, 11:02:07 AM by chilmans »