Get Enemy Level On Hit Event

Post » Sun Nov 18, 2012 10:36 pm

Hello
I would like to make a script and attach it to an enemy actor, so i get his level displayed as Debug.Notification, if it can be done.
let me show you how i want it, and then tell me how to script it the right way please.

event on hit
if hit by the player
get my level
Debug.Notification my level
endif
endevent

thx.
User avatar
Klaire
 
Posts: 3405
Joined: Wed Sep 27, 2006 7:56 am

Post » Mon Nov 19, 2012 5:33 am

Hi Ghassan,

You'll probably want to use http://www.gamesas.com/topic/1349649-dynamically-attaching-scripts-to-actors-near-the-player/ to be able to attach an http://www.creationkit.com/OnHit_-_ObjectReference event to all nearby http://www.creationkit.com/Actor_Script in a script extending http://www.creationkit.com/ReferenceAlias_Script.

Something like this should do the trick:
ScriptName ReportLevelOnHit Extends ReferenceAliasActor Property Me AutoEvent OnInit()	Me = GetActorReference()EndEventEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)	Debug.Notification(Me.GetLevel())EndEvent

Cipscis
User avatar
Tamika Jett
 
Posts: 3301
Joined: Wed Jun 06, 2007 3:44 am

Post » Mon Nov 19, 2012 6:07 am

Hello Cipscis
its not working :(
i tried edit value in the properties and pick reference in the render window, couldnt do it , the cursor was red color
what do i need to do
thx
User avatar
Jack
 
Posts: 3483
Joined: Sat Oct 20, 2007 8:08 am

Post » Sun Nov 18, 2012 7:49 pm

Sorry, I'm so used to using properties that I didn't even realise that should be a variable instead. It doesn't need to be set in the Creation Kit or accessed from another script, after all. Try using this with the setup described in that thread:
ScriptName ReportLevelOnHit Extends ReferenceAliasActor MeEvent OnInit()        Me = GetActorReference()EndEventEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)        Debug.Notification(Me.GetLevel())EndEvent

Cipscis
User avatar
Stephanie Valentine
 
Posts: 3281
Joined: Wed Jun 28, 2006 2:09 pm

Post » Mon Nov 19, 2012 7:16 am

still not working.
dont we need to use an if statment
if hit by the player
do this ?
User avatar
Emerald Dreams
 
Posts: 3376
Joined: Sun Jan 07, 2007 2:52 pm

Post » Mon Nov 19, 2012 8:00 am

If you only want it to show when hit by the player, then yes you'll want to add something like that:
ScriptName ReportLevelOnHit extends ReferenceAliasActor Property PlayerRef Auto{Autofill this property in the Creation Kit, it should point to the player}Actor MeEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)	If akAggressor == PlayerRef		Debug.Notification(Me.GetLevel())	EndIfEndEvent
If the OnHit event isn't firing, I expect the problem is to do with your setup, not this script.

Cipscis
User avatar
Robert Jackson
 
Posts: 3385
Joined: Tue Nov 20, 2007 12:39 am

Post » Sun Nov 18, 2012 5:13 pm

Hello Cipscis
It worked At Last
thx.
User avatar
Claire
 
Posts: 3329
Joined: Tue Oct 24, 2006 4:01 pm

Post » Mon Nov 19, 2012 3:05 am

Hello Cipscis
It worked At Last
thx.
User avatar
Sebrina Johnstone
 
Posts: 3456
Joined: Sat Jun 24, 2006 12:58 pm

Post » Mon Nov 19, 2012 6:38 am

wait i need to put "Level" before (Me.Getlevel())
i tried ("Level" Me.Getlevel())
it did not work:(
User avatar
Elizabeth Lysons
 
Posts: 3474
Joined: Fri Feb 02, 2007 7:16 am

Post » Sun Nov 18, 2012 11:55 pm

wait i need to put "Level" before (Me.Getlevel())
i tried ("Level" Me.Getlevel())
it did not work:(
User avatar
Eilidh Brian
 
Posts: 3504
Joined: Mon Jun 19, 2006 10:45 am

Post » Mon Nov 19, 2012 12:32 am

You'll need to make it ("Level " + me.GetLevel())

Pay attention to the space after Level or you'll end up with Level15 with no space.
User avatar
Emma Copeland
 
Posts: 3383
Joined: Sat Jul 01, 2006 12:37 am

Post » Mon Nov 19, 2012 12:28 am

it worked fine but it show on screen Level1
I still need to put a space between Level and 1
i added a space and still the same
how do i do it ?
thx.
User avatar
Rude Gurl
 
Posts: 3425
Joined: Wed Aug 08, 2007 9:17 am

Post » Sun Nov 18, 2012 10:29 pm

ok I got it done at last.
Thx. All !
Gus.
User avatar
SEXY QUEEN
 
Posts: 3417
Joined: Mon Aug 13, 2007 7:54 pm

Post » Sun Nov 18, 2012 11:50 pm

ok I got it done at last.
Thx. All !
Gus.
User avatar
emily grieve
 
Posts: 3408
Joined: Thu Jun 22, 2006 11:55 pm


Return to V - Skyrim