Hello,
I am making a boss fight with a giant ragdoll made out of DeadMeat. I need a script that whenever the object "Head1" gets hit, a ScriptTrigger named "BlockBullets" gets activated.
Is that possible?
Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.
New to the forum? Say hello in this topic! Also make sure to read the rules.
New to the forum? Say hello in this topic! Also make sure to read the rules.
Possible to check if IObject is damaged?
Forum rules
By using the forum you agree to the following rules.
By using the forum you agree to the following rules.
- JakSparro98
- Superfighter
- Posts: 530
- Joined: Fri Jul 15, 2016 7:56 pm
- Started SFD: PreAlpha 1.0.5
- Location: Rome, Italy
- Gender:
- Age: 25
This is what you asked for:
Code: Select all
Events.UpdateCallback m_updateEvent = null;
float m_totalElapsed = 0f;
IObject HitTarget;
IObjectTrigger Trigger;
float StoredHealth = 0;
public void OnStartup() {
Trigger = (IObjectTrigger) Game.GetSingleObjectByCustomID("BlockBullets");
HitTarget = (IObject) Game.GetSingleObjectByCustomID("Head1");
StoredHealth = HitTarget.GetHealth();
m_updateEvent = Events.UpdateCallback.Start(OnUpdate, 0);
}
public void OnUpdate(float elapsed) {
if (StoredHealth != HitTarget.GetHealth()) {
Trigger.Trigger();
StoredHealth = HitTarget.GetHealth();
}
}
2 x