Collision

Topics regarding Scripting with Reality Factory
Post Reply
Masta_J
Posts: 37
Joined: Tue Apr 17, 2007 1:35 pm
Location: Johannesburg South Africa

Collision

Post by Masta_J »

Sup guys, I have three questions:

1) Is there is a script command which detects collision on a bone level between two actors or entities? For example: If pawn1's, "Bip 01 R Hand," colides with pawn2's, "Bip 01 Head," then a new order is executed from either pawn.

2) I would also like to know if there is a command which forces one pawn into a certain order depending on the order of another pawn? For example: If pawn1 is executing the order, "Attack", then pawn2 two will be forced into executing the order,"Defend."

3) Is it possible to set a fixed camera entity to force view to isometric upon the player reaching a certain range of an enemy pawn? I have tried using the trigger entity but it crashes upon loading.

Much appreciated
A good warrior knows his limits, but a great warrior finds his way around them.
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post by Juutis »

1) The manual:
float GetBoneToBone(char *BoneName, char *TargetEntityName, char *TargetBoneName );

Returns the distance between the pawn’s bone BoneName and the specified target’s bone TargetBoneName.
It doesn't exactly check collision, but I guess it's the best option.



2) This can be done, it's a bit tricky though. To my knowledge, you can't just force a pawn to execute a certain order with another script. However, you can make the pawns interact in other ways.
You could for example give pawn2 an attribute called 'ForcedOrder'. You could then modify this attribute with pawn1's script (SetAttribute() and ModifyAttribute()) and make pawn2 check if the attribute has changed. Attributes can only contain integers, so you would have to set a certain number for each order, like 'Attack' = 1, 'Defend' = 2, 'Run' = 3 etc...

In the 'Attack' order of pawn1 you would set:

Code: Select all

SetAttribute("ForcedOrder",2,"pawn2");
Then, with pawn2, just simply check:

Code: Select all

if(GetAttribute("ForcedOrder") = 2)
{
self.think = "Defend";
}

3) I'm not sure about this, but the SwitchView() could work. Just make the pawn check if the player is close enough and then use that command to switch the view.
Pain is only psychological.
Post Reply