what is with the \ in Onhit event in the Wiki ?

Post » Tue Jun 19, 2012 7:06 am

So the wiki said this:

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

But I have a feeling that is not right. Becasue the following will not work:


Scriptname aadpPlayercombatScript extends ActiveMagicEffectEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \  bool abBashAttack, bool abHitBlocked)	  Debug.Trace("Hit by " + akAggressor)endevent


What is the \ in this for?

Should I change it to:

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
User avatar
Reven Lord
 
Posts: 3452
Joined: Mon May 21, 2007 9:56 pm

Post » Tue Jun 19, 2012 10:59 am

The \ is to tell the Papyrus compiler that the statement is continued or finished on the next line. This is needed because the compiler separates statements by lines, unlike C-style languages which use a semicolon to separate statements.

Either way works just as well. Sometimes splitting a statement into multiple lines helps with readability.
User avatar
Jah Allen
 
Posts: 3444
Joined: Wed Jan 24, 2007 2:09 am

Post » Tue Jun 19, 2012 4:51 am

Thank you very much trira

ok, so it works now, I had to change debug trace to debug.messagebox, what is debug.trace?
anyway that is not as important as this question:

I got my message box but instead of a ref actor as I exspected I got this:

"Hit by TGGoldScript"

?huh

Am I not going to get actor refs? Instead I get the script they are using? I need to get the actor ref of the actor that hit me, how do I do that then?
User avatar
Phillip Hamilton
 
Posts: 3457
Joined: Wed Oct 10, 2007 3:07 pm

Post » Tue Jun 19, 2012 10:16 am

That's definitely strange... I'd assume personally that using akAggressor would print out the actor's EditorID, unless the aggressor, for some reason, is a script? Is the damage coming from a script?

You can try doing this:

Debug.MessageBox("Hit by " + (akAggressor as String))

Might make a difference, might not make a difference.
User avatar
Taylrea Teodor
 
Posts: 3378
Joined: Sat Nov 18, 2006 12:20 am

Post » Tue Jun 19, 2012 5:26 am

When you write a script, you're also defining a type. When you attach a script to an object, you are also making that object the type defined by your script (of course, because multiple scripts can be attached, an object can have multiple types). The game engine automatically attaches native scripts like http://www.creationkit.com/Actor_Script to objects that are the right native type, so without any other scripts attached, and Actor is just an Actor. If you attach a script called TGGoldScript to it, though, that Actor is now also of type TGGoldScript.

Try using http://www.creationkit.com/GetFormID_-_Form to get its formID, and also perhaps http://www.creationkit.com/GetBaseObject_-_ObjectReference.

Printing out object variables as a string doesn't seem to give the type of information you might expect. You probably have the right value in your variable to do what you need.

http://www.creationkit.com/Trace_-_Debug prints a message to the script error log, which can be found under My Documents\My Games\Skyrim\Logs\Script. It'll have a name like Papyrus.0.log, and is a plain text file.

Cipscis
User avatar
Jeff Tingler
 
Posts: 3609
Joined: Sat Oct 13, 2007 7:55 pm


Return to V - Skyrim