Jump to content

question: how to assign projectile type into an onhit event?


3aq

Recommended Posts

so on https://www.creationkit.com/index.php?title=OnHit_-_ObjectReference

 

it mentions akprojectile.. how would I go about properly assigning a projectile type?

 

such as arrow or missile or beam from https://www.creationkit.com/index.php?title=Projectile

 

and by assigning I mean by assigning for onhit event.I wish for an action to take place when actor x gets hit by a projectile

 

thank you in advance :happy:

Link to comment
Share on other sites

You have to state the projectile property, then after calling the onhit event use a IF statement wich will conditionalize it with the projectile you want to trigger the event with.

 

Example:

 

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \
bool abBashAttack, bool abHitBlocked)

If AkProjectile == MyProjectile

;Do Stuff

Endif

Endevent

 

Projectile Property MyProjectile

 

Hope i get myself clear.

Link to comment
Share on other sites

yes I understand that, what i don't understand is how my listed property is understood as a missile or beam or other type but not something else by my script.
Link to comment
Share on other sites

You have to state the projectile property, then after calling the onhit event use a IF statement wich will conditionalize it with the projectile you want to trigger the event with.

 

Example:

 

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \

bool abBashAttack, bool abHitBlocked)

If AkProjectile == MyProjectile

;Do Stuff

Endif

Endevent

 

Projectile Property MyProjectile

 

Hope i get myself clear.

You have to use SKSE

 

and use this function https://www.creationkit.com/index.php?title=GetType_-_Form recongnize akProjectile as a Form

 

You will find all the types of projectiles there

Link to comment
Share on other sites

so do I include

 

int MyProjectile = MyArrow.GetType() into the onhit script or make a derivative script and extend it to form and have the onhit script reference the external derivative script?

 

apologies for the question I'm simply lost on this.

 

if there are working examples of it floating around which I could reference I think that would probably help figure this out for me.

Link to comment
Share on other sites

You don't need to extend to form and then spin your brain in circles by making another script to extend ObjectReference. Stick with the current script. Nice and easy and less confusing(and it can be because papyrus is a messy version of C++ imo)

 

If you want the Event to check for the kind of projectile it is, then GetType is the way(but slow way) to do this. So I think the approach here is:

; since you might need to call it many times
int projectileType = akProjectile.GetType()

if projectileType == 63 ;  missle type, Fireball for example
    ; do stuff to akProjectile
endif

The link provided by Alaebasta has the type codes on it.

Edited by Rasikko
Link to comment
Share on other sites

by slow, you mean performance wise right? if so, what would be the "fast way"?

Edited by 3aq
Link to comment
Share on other sites

by slow, you mean performance wise right? if so, what would be the "fast way"?

Because it calculates every type of forms untill it gets to yours.

 

If you are going to check a particular type of projectile you can still use a Formlist to narrow triggers.

Link to comment
Share on other sites

Formlist as in [actor, spell, armor, weapon, etc] property <blank> auto?

 

or the one found in esp? I have no concrete idea what it is you are referring to.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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