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?
This forum is locked and will eventually go offline. If you have feedback to share you can find us in our Discord channel "MythoLogic Interactive" https://discord.gg/nECKnbT7gk
Forum rules
Forum 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: 27
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