Jump to content

[Modding] How to use registerformodevent


Recommended Posts

Posted

I have a cloak spell which attaches a magic effect to all NPCs around.

 

What I want is to trigger an event on these surrounding NPCs when something else happens (specifically, to pacify them)

 

The magic effect attached through the cloak contains this

 

Scriptname SAC_03_hangingpersistence_monitoreff extends ActiveMagicEffect  

actor target

event oneffectstart(actor aktarget, actor akcaster)
	target = aktarget 
	RegisterForModEvent("SAC_player_combat_hang", "OnPlayerCombatHang")
	; other stuff which works just fine
endevent

[...]

Event OnPlayerCombatHang()
debug.trace("sac_ received mod event OnPlayerCombatHang, attempting to pacify "+target)
    target.StopCombatAlarm()
    target.stopcombat()    
EndEvent

 

Separately, there's a constant effect monitoring the player and triggering upon a condition (health < xx units)

 

Scriptname sac_hang_player_on_lost_combat extends ActiveMagicEffect  

event oneffectstart(actor akcaster, actor aktarget)
    SendModEvent("SAC_player_combat_hang")
endevent

 

This fires just fine, but the sendmodevent doesn't do anything. I am obviously not using it right, but I don't know how to correct it

 

TY

 

 

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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