Aller au contenu

[solved]Event_Type_Damaged for placeable?


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
Guest_dewkl_*

Guest_dewkl_*
  • Guests
I can't get this case to work. I've created a placeable that is hostile and created an action in the EVENT_TYPE_DAMAGED, but it doesn't seem to fire. The idea is that a specific creature throws a specific spell (that creature only has one spell, so it just needs to filter the spell's creator) on a placeable and it performs an action. Does this only work with specific placeables that are intended to be destroyed? Like the barricades you see in the game.

I had this question a while ago for some different idea, but I ended up solving it by making the spell detect the placeable (and not the other way around, which ended up being a much better solution for that problem). I guess I could do that again, but I prefer that as a last resort.

Modifié par dewkl, 20 juin 2010 - 10:59 .


#2
TimelordDC

TimelordDC
  • Members
  • 923 messages
I haven't experimented with this but have you checked that the placeable can be damaged (i.e. not set as plot) and has some reasonable hp (so that the death event is not fired on the first hit)?

Have you also made sure the EVENT_TYPE_DAMAGED is not being called - by putting in log statements?



The alternative would be to see if EVENT_TYPE_ATTACKED is fired and do the required work there.

#3
Guest_dewkl_*

Guest_dewkl_*
  • Guests
Not set as plot (set to false) and I've set the health to 10000. I've just created a displayfloatymessage that confirms if it works. I've also tested event_type_attacked, event_type_cast_at and the death event. Neither of these work for me.

I just tried PrintToLog just in case, and nothing happened. So I guess the event isn't being called at all.

Modifié par dewkl, 18 juin 2010 - 07:32 .


#4
Craig Graff

Craig Graff
  • Members
  • 608 messages
I assume you've attached the script, but have you also tried enabling the events with EnablevEvent? I can try to look in the engine sometime this weekend to see if these events even fire on placeables.

My suspicion however is that these events fire just fine but the effects are not being allowed to apply because of the following code from Effects_HandleApplyEffect in effects_h:
[dascript]
    if (IsDead(OBJECT_SELF) &&( nEffectType != EFFECT_TYPE_RESURRECTION && nEffectType != EFFECT_TYPE_DEATH) )
    {
        #ifdef DEBUG
        Log_Trace_Effects("effects_h.HandleApplyEffect",eEffect, "EFFECT_REJECTED - target is dead" ,OBJECT_SELF);
        #endif

        nReturnValue = FALSE;
    }
[/dascript]
My guess is that IsDead is returning TRUE for placeables, which is probably a bug.
You could try compiling rules_core.nss after modifying a local copy of effects_h.nss to test if removing this makes a difference.

Modifié par Craig Graff, 19 juin 2010 - 05:58 .


#5
midnightgeek

midnightgeek
  • Members
  • 30 messages
Check out the single player campaign scripts that handle the golem doors.
cir000ip_fade_golem_door
monster_aoe_instant

The spell script signals the custom event and the placeable script handles the event, perhaps you could use this in your module. HTH, Good luck!

EDIT: Shortly after posting I realized that unless you were using a custom spell you would have to either A) override the script for that spell or B) override the 2DA entry for that spell and point it to a custom script.  Option B being the lesser of two evils but still not 100% compatible.  If I think of another solution I'll post it :)

Modifié par midnightgeek, 19 juin 2010 - 09:00 .