| Class KX_NetworkMessageActuator (2.48) |
|
|
| setBody |
setSubject |
| setBodyType |
setToPropName |
|
|
|
| getExecutePriority |
setExecutePriority |
| getOwner |
---------- |
|
|
setBody
setBody(body)
Sets the message body.
body:
Type is string
Sample
Code
# get controller
controller = GameLogic.getCurrentController()
# get message actuator attached to the controller named Health
health = controller.getActuator("Health")
# set body type to text
health.setBodyType(False)
# set message body
health.setBody("Your message here")
# use actuator
GameLogic.addActiveActuator(health, True)
setBodyType
setBodyType(bodyType)
Sets the body type
body:
Type:
bool
True or 1 = Set body type to Property
False or 0 = Set body type to Text
Sample
Code
# get controller
controller = GameLogic.getCurrentController()
# get message actuator attached to the controller named Health
health = controller.getActuator("Health")
# set body type to Property
health.setBodyType(True)
# set message body
health.setBody("Full_Health")
# use actuator
GameLogic.addActiveActuator(health, True)
setSubject
setSubject(subject)
Sets the subject field of the message. Can be used to filter
messages.
subject:
Type is string
Sample
Code
# get controller
controller = GameLogic.getCurrentController()
# get message actuator attached to the controller named Health
health = controller.getActuator("Health")
# Set Subject
health.setSubject("Heal")
# use actuator
GameLogic.addActiveActuator(health, True)
setToPropName
setToPropName(name)
Sets the objects that messages will be sent to.
name:
Type is string.
Name of the object with the message sensor you want to try and trigger.
Note:
Leave blank to trigger all of the network message
sensors in the scene.
Sample
Code
# get controller
controller = GameLogic.getCurrentController()
# get message actuator attached to the controller named Health
health = controller.getActuator("Health")
# Set Subject
health.setSubject("Heal")
# send message only to object with name OBPlayer
health.setToPropName("OBPlayer")
# use actuator
GameLogic.addActiveActuator(health, True)
|