×
Меню
Индекс

MSFD Object Collision Functions

 
GetCollidingPC (returns Boolean/short)
GetCollidingActor (returns Boolean/short)
 
     if ( GetCollidingPC == 1 )
 
HurtCollidingActor, damage_enum
 
HurtCollidingActor, 100
Object_ID->HurtCollidingActor, 100
    
These functions go on an object to allow it to interact with Actors colliding with it. GetCollidingPC returns 1 if the PC is currently colliding with the object and 0 otherwise. GetCollidingActor works the same as the PC version of the function but will return 1 if any Actor (other than the PC) is colliding with the object. HurtCollidingActor lowers the colliding Actor’s health Damage points every second.
 
Note: An object has to have collision to trigger these functions, so if you can walk through the object, none of these functions will trigger.
 
Sample script:
When this script is placed on an object, any Actor touching that object will take damage. A different message is given depending on whether the Actor is the PC or someone else.
Begin hurtActor
 
if ( GetCollidingPC == 1 )
     MessageBox "You scream in pain as you touch the rock."
Elseif ( GetCollidingActor == 1 )
     MessageBox "Nearby someone screams in pain."
Endif
 
HurtCollidingActor 100
 
End