Hwo to take kind of hit object: landscape or clonk.
For example:
protected func Hit(){
if(hit ladscape){
nothing
}
if(hit clonk){
explode
}
}
For example:
protected func Hit(){
if(hit ladscape){
nothing
}
if(hit clonk){
explode
}
}
Hit() is only called when hitting solid ground (i.e. the landscape). You don't get a callback in the hitting object when it hits a clonk. But you get a callback to the clonk getting hit: QueryCatchBlow(object by) (see here for all calls made from the engine)
You could use that call in the clonk to make a call to the object (by).
You could use that call in the clonk to make a call to the object (by).
Maybe you want to have a look at the arrow.
If you add the effect
If you add the effect
AddEffect("HitCheck", this, 1,1, nil,nil, shooter);
and it hits an object public func HitObject(object obj)
is called. So you could try:func Initialize()
{
AddEffect("HitCheck", this, 1,1, nil,nil, shooter);
}
func HitObject(object obj)
{
Explode(10);
}
There is no trivial way to do it because the concept of hit does not exist for objects with objects - e.g. several rocks would fly past each other.
But of course, as anything else you can implement this in script by checking each frame if at the position of the object, there is another object. This has already been done for objects like the arrow. See Pyrit. Note though that you should probably add the effect when your object is thrown (exits it's container) and pass the container object to the hit check effect. Otherwise, the hit check would find the clonk that throws the object right away and explode on his hands :-). Like this:
But of course, as anything else you can implement this in script by checking each frame if at the position of the object, there is another object. This has already been done for objects like the arrow. See Pyrit. Note though that you should probably add the effect when your object is thrown (exits it's container) and pass the container object to the hit check effect. Otherwise, the hit check would find the clonk that throws the object right away and explode on his hands :-). Like this:
func Departure(object container)
{
if(container
AddEffect("HitCheck", this, 1,1, nil,nil, container);
}
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill