Jump to content

Help Please: How to know type of damage received on "onhit" events


Recommended Posts

Hello. Excuse my English, it's not my native language.

 

Im trying to make a mod with different types of injuries depending on the damage received. For example, if you receive a damage from a Flamer, you get burned. I thought that the function isinlist can help me there, if "aksource" isinlist then make fire injury. If not, then other...

 

I'm scripting everything from a Quest that controls everything. I'm not attaching the complete script but you can get the idea.

 

 

"

Scriptname IAA_InjuriesDiseaseControl extends Quest

 

Actor Property PlayerRef Auto Const

Formlist Property IAA_List_FireDamage Auto Const

 

Event OnInit()
RegisterForHitEvent(PlayerRef)
EndEvent
Event OnHit(objectReference akTarget, objectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked, string apMaterial)
if akTarget == PlayerRef
If akSource.Isinlist IAA_List_FireDamage == 1
Debug.notification("Fire damage done")
else
Debug.Notification("Not fire damage")
endif
endif
RegisterForHitEvent(PlayerRef) ;To check another hit
Endevent
"
I'm getting error "no viable alternative at input 'IAA_List_FireDamage'", don't know why is happening, even though the wiki is not helping me so much :(
Thanks for your help.
Have a nice day

 

Link to comment
Share on other sites

Form script doesn't have such function. And even if it had, your syntax is wrong, it would be If akSource.Isinlist(IAA_List_FireDamage). But forget it.

 

There are two ways I can think of.

 

1) Check for keywords with HasKeyword or HasKeywordInFormList.

 

2) Call HasForm on Formlist and pass akSource as parameter to check if that formlist contains what you need.

Link to comment
Share on other sites

I managed to get it working with the HasKeywordInFormList. THANK YOU SO MUCH FOR YOUR HELP SHAVKACAGARIKIA!!!!!!!!!!!!!!!!!!

 

Maybe is better the second option "HasForm" because I think is more complex to give keywords to weapons than add them into a formlist, because if some mod modifies that weapon, you will have to make a patch to give it the keyword... am i right? :S

 

I'm so sorry if the script is not writen the best way, but i'm learning all of this stuff and it is very dificult :(

 

Here is the modification i made

 

if akTarget == PlayerRef

If akSource.HasKeywordInFormList(IAA_List_KWFireDamage)
Debug.notification("Fire damage")
Else
Debug.notification("Normal damage")
Endif
Endif
Thank you again!
Link to comment
Share on other sites

Hmm, just check it with keywords that already are on form. For example Flamer already has animsFlamer keyword and you can check that instead of adding your custom keyword on it.

Yes, that's what I did, but there are some weapons that doesnt have keyword, but is ok, no problem! thank you so much :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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