Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Need help with an OnHit script


Citrus
 Share

Recommended Posts

This may be very simple, or very complicated. I tried a few things but it still doesn't work as I want it to. The script is down below and it aims to do the following: when a certain creature is hit, a message pops up telling you to leave it alone (the creature is from an enemy faction but the aggression is set to 1) and it checks a variable in the script to make sure it was hit once. This works both for weapon or magic hits. If you hit the creature again, it turns hostile (sets the aggression to 100) and then it ends. The problem is, the moment I enter the cell the creatures are in, the message displays and if I hit them once, they turn hostile.

scn aaKOTNRCTSpectreScript


short SpectreHit

short doOnce


Begin OnHit Player


	if SpectreHit == 0

		MessageBox "As I struck the wraith, it didn't fight back. I better leave it alone."

		Set SpectreHit to 1


	elseif SpectreHit == 1

		SetActorValue Aggression 100

		Set doOnce to 1

	Endif

End


Begin OnMagiceffectHit	


	if SpectreHit == 0

		MessageBox "As I struck the wraith, it didn't fight back. I better leave it alone."

		Set SpectreHit to 1


	elseif SpectreHit == 1

		SetActorValue Aggression 100

		Set doOnce to 1

	Endif

End

They are in a room with some FXCloudThick01 and FXCloudSmall meshes; I dunno if that affects anything since they are statics.

Link to comment
Share on other sites

Is the wraith set to persistent. I believe I read somewhere that ceatures have to be a persistent ref for OnHit to work properly. It's been a very long time since I scripted though...

No, it isn't. I'll make it persistent and try again to see if it works.

Link to comment
Share on other sites

I would try commenting our or removing the OnMagicEffectHit block for testing purposes. Their own ghost ability is probably triggering it and counting as the first hit. If that is the problem I don't realy see an elegant solution off the top of my head. You could add seperate entries for each hostile magic effect that raise a variable rather than executing your code, but it's hardly an elegant approach.

WT

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...