Simple(?) script request

Post » Tue Jun 19, 2012 2:00 am

If anyone would be so kind as to help a poor scripting soul out, I would appreciate it.
Here is what I'm looking for just to get me started...

A script attached to an actor that when that actor is hit by something, the script will:

1: Detect if the striking weapon has a specific keyword.

2: Detect if the struck actor is wearing armor/clothing with a certain keyword.

3: Display a message box stating if the striking weapon does have that certain keyword or not and also if the struck actor is wearing armor/clothing with a certain keyword or not. True/False or 1/0... doesn't matter.


Really basic... I'm mainly looking for the functions and syntax I need to use.

THANK YOU!!! :-D
User avatar
NAkeshIa BENNETT
 
Posts: 3519
Joined: Fri Jun 16, 2006 12:23 pm

Post » Mon Jun 18, 2012 11:18 pm

http://www.creationkit.com/ObjectReference.OnHit_%28Papyrus%29 is the function you're looking for.

I'm not 100% positive on how to search for a keyword (I don't think you can). If you have a finite piece of armour and you know the IDs you can check if the actor has it or is wearing it.

You can check akSource for the striking weapon (you'll need to know what type before hand. IE If I wanted to show a message if the player was hit by an iron weapon I would have this, in pseudo code:
WEAPON Property IronMace Auto "			   "		    IronSword "EtcEvent OnHit(akSource, akProjectile, etc etc)  if (akSource == IronMace) || ( akSource == IronSword) || etc	    **  || means 'OR'.	 ShowMessage(MyMessage)  <- you'll have to find the syntax for this  endif
And ShowMessage should get you started.
User avatar
Thomas LEON
 
Posts: 3420
Joined: Mon Nov 26, 2007 8:01 am

Post » Mon Jun 18, 2012 10:47 pm

there is a hasKeyword() function but i cant get it working, compiler error :( (Although I am trying to get an akAggressor.hasKeyowrd).

but I agree that an onHit event is what you need!
User avatar
Emma louise Wendelk
 
Posts: 3385
Joined: Sat Dec 09, 2006 9:31 pm

Post » Mon Jun 18, 2012 6:02 pm

Thank you both! :-)

I managed to get an OnHit event to work in http://www.gamesas.com/topic/1349536-my-first-script-please-help/. Though I can't seem to figure out how to detect a keyword.

I thought that "HasKeyword" and "WornHasKeyword" may work similar to how they work in conditions. But I can't seem to get the syntax to play nice with me :-P

There aren't compile errors, but I can't get the result I want in game.
User avatar
Nicholas
 
Posts: 3454
Joined: Wed Jul 04, 2007 12:05 am


Return to V - Skyrim