Jump on Damage mostly for some Pawns

Topics regarding Scripting with Reality Factory
Post Reply
Veleran
Posts: 891
Joined: Mon Aug 22, 2005 10:22 am
Location: Greece

Jump on Damage mostly for some Pawns

Post by Veleran » Wed Nov 18, 2009 9:49 am

If there are some pawns walking up and down guarding a passage like the old platform games,
and you want these pawns to be destroyed by jumping on,instead of firing or slashing at them,would you prefer to:

1.Give the Pawns a high amount of health and raise the Jump on Damage value higher than the health (which is what can be done now).
2.Give these pawns a different health attribute so only the jump damage destroys them,and post a feature request for the playersettup to have an extra entry for the name of the Jump damage Health attribute.

And something else:If you want the pawns that you jump on,to do damage by collision,
how will i make the player not getting damage the moment he lands on the bad guys?

Would the pawn damage function not be settup in the begining of the script,but set it up in another section
using commands that first check if they are already destroyed?
If that is the easy method to do it,can some one post a (working) example for the "DamagebyCollision" script section for this Pawn?

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: Jump on Damage mostly for some Pawns

Post by Juutis » Wed Nov 18, 2009 10:48 am

Here's a short sample script for a pawn that dies when you jump on it and damages the player otherwise:

Code: Select all

{
    
    PAWNHEIGHT          [30]
    DAMAGE              [10]
    DAMAGEATTRIBUTE     [health]
    DAMAGEDELAY         [1]

Spawn[ ()
{
    Console(true);
    BoxHeight(PAWNHEIGHT);
    AddCollisionOrder("Collision");
    NewOrder("Wait");
} ]

Wait[ ()
{
} ]

Collision[ ()
{
    if(player_Y >= current_Y + PAWNHEIGHT)
    {
        NewOrder("Die");
    }
    else
    {  
        LowLevel("dealDamage");
    }
} ]

dealDamage[ ()
{
    DamagePlayer(DAMAGE,DAMAGEATTRIBUTE);
    HighLevel("Restart");
    return;
} ]

Restart[ ()
{
    Delay("",DAMAGEDELAY,"");
    AddCollisionOrder("Collision");
    NewOrder("Wait");
} ]

Die[ ()
{
    Remove(true);
} ]

}
There's no easy way detect collisions in low level so I used the high level method AddCollisionOrder and so it's a bit messy and there's a lot of jumping between high and low level. But it should give you an idea of how to do it.
Pain is only psychological.

Post Reply