Jump to content

Can Normal hit by creature cause scropt effects?


Recommended Posts

I am making Creature Companion mod and trying to give him some skills and abilities.

 

some skills are based on his normal hit or Death of Enemies

 

(ex. 1) When Dog hit enemies, Hits cause 25% Paralyze 2) When Dog kill enemy, Buff effect activated)

 

I tried following script but not works :(

 

Can i have it work?

 

------------------------------------------------------------------------------------------------

Scn Talent01 ; script when Enemy die

Ref Target

...

...

If CompanionRef.GetCombatTarget == Target

Get Target to Getself

If Target.Getdead == 1

Actor.Moveto Player

Actor.Cast BuffSpell Player

endif

endif

-------------------------------------------------------------------------------------------------

Thx for Reading :)

Link to comment
Share on other sites

You could use OBSE event handlers for registering hits by your dog, but other than that, I cannot think of a way to make a buff activate in a neat fashion off the top of my head. Maybe someone else has an idea on how to do that. For hit event registration, you will need:

  • Your persistent dog reference in the gameworld.
  • A function (an object script with a function block) to call when a hit event happens.
  • Registration command when the game is started, to register the function as a handler to the event.

For the event handler, something like this might be worth looking into, although I have not tested it myself and it has been some time since I last made an event handler (trying to get back to modding soon):

scriptname YourUniquelyNamedDogHitEventHandler

ref Target
ref Attacker

begin _Function { Target Attacker }
    PrintToConsole "DogHitEvent: %n (%i) -> %n (%i)" Attacker Attacker Target Target
end

For registration, assuming your dog reference is called "YourUniquelyNamedDogReference", something like the following might work in a quest script, so that the event would be registered for while in main menu after the game has been restarted (assuming I remember the menu code correctly, I think 1044 was the main menu but I am not sure):

scriptname YourUniquelyNamedDogQuestScript

begin _MenuMode 1044
    if ( GetGameRestarted )
        seteventhandler "OnHit" YourUniquelyNamedDogHitEventHandler "object"::YourUniquelyNamedDogReference
    endif
end

Hopefully that helps a bit. Any corrections are welcome if anyone remembers something I have forgotten. :thumbsup:

Edited by Contrathetix
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...