Help on a Script Please

Post » Mon Nov 19, 2012 12:16 pm

Hello
I am Trying to get the actor level using Even Onhit.
I have been testing it and it always say " Level 0" even i set the actor level at 6 in calc minimum and if i use the console to getlevel it says level 6.
here is my script
Scriptname GP_TEST extends ObjectReference
Actor Property PlayerRef Auto
Actor Target
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
Target.GetBaseObject()
If akAggressor == PlayerRef
Debug.Notification("Level " + Target.GetLevel())
EndIf
EndEvent
User avatar
Claire Vaux
 
Posts: 3485
Joined: Sun Aug 06, 2006 6:56 am

Post » Mon Nov 19, 2012 9:08 am

As your script is set up, you are trying to get the base object of a variable that has no value. Change that line to this:

Target = Self.GetBaseObject()

This will give the variable a valid value for your script to use.
User avatar
Madison Poo
 
Posts: 3414
Joined: Wed Oct 24, 2007 9:09 pm

Post » Mon Nov 19, 2012 12:46 am

I am getting an error :
type mismatch while assigning to a actor (cast missing or types unrelated)

Scriptname GP_TEST extends ObjectReference
Actor Property PlayerRef Auto
Actor Target
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
Target = Self.GetBaseObject()
If akAggressor == PlayerRef
Debug.Notification("Level " + Target.GetLevel())
EndIf
EndEvent
User avatar
Tyrel
 
Posts: 3304
Joined: Tue Oct 30, 2007 4:52 am

Post » Mon Nov 19, 2012 3:49 am

Target is already a reserved variable of the event, so instead of Target = Target.GetBaseObject(), try TargetBO = Target.GetBaseObject() and then Debug.Notification ("Level" + TargetBO.GetLevel())
User avatar
Katy Hogben
 
Posts: 3457
Joined: Mon Oct 30, 2006 12:20 am

Post » Mon Nov 19, 2012 2:10 am

i am getting 4 errors now !

Scriptname GP_TEST extends ObjectReference

Actor Property PlayerRef Auto
Actor Target

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
TargetBo = Target.GetBaseObject()
If akAggressor == PlayerRef
Debug.Notification("Level " + TargetBO.GetLevel())
EndIf
EndEvent
User avatar
Krystina Proietti
 
Posts: 3388
Joined: Sat Dec 23, 2006 9:02 pm

Post » Mon Nov 19, 2012 7:29 am

The first line of the event should read ActorBase TargetBO = self.GetBaseObject()
User avatar
Jason Wolf
 
Posts: 3390
Joined: Sun Jun 17, 2007 7:30 am

Post » Mon Nov 19, 2012 11:18 am

here.

Scriptname GP_TEST extends ObjectReference

Actor Property PlayerRef Auto ; value is set PlayerRef
ActorBase Property target Auto ; value is set to default

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
Target = GetBaseObject()
If akAggressor == PlayerRef
;Debug.Notification("Level " + Target.GetLevel())
EndIf
EndEvent
; I Am getting this error : type mismatch while assigning to a actorbase (cast missing or types unrelated)

Spoiler
 

Spoiler
Scriptname GP_TEST extends ObjectReference

Actor Property PlayerRef Auto ; value is set PlayerRef
ActorBase Property target Auto ; value is set to default

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
Target = GetBaseObject()
If akAggressor == PlayerRef
;Debug.Notification("Level " + Target.GetLevel())
EndIf
EndEvent
; I Am getting this error : type mismatch while assigning to a actorbase (cast missing or types unrelated)



User avatar
Lil Miss
 
Posts: 3373
Joined: Thu Nov 23, 2006 12:57 pm

Post » Mon Nov 19, 2012 11:10 am

Okay... a few posts went away, the OP and I had a brief discussion... we've all been there, you get a little frustrated etc. So, consider this a fresh start. :)

OP, just give as much info as you can about what errors you are getting. Be patient, if someone can help you out they will.
User avatar
Josh Dagreat
 
Posts: 3438
Joined: Fri Oct 19, 2007 3:07 am

Post » Sun Nov 18, 2012 8:56 pm

Target = GetBaseObject() As ActorBase
User avatar
Spencey!
 
Posts: 3221
Joined: Thu Aug 17, 2006 12:18 am

Post » Mon Nov 19, 2012 11:40 am

Thx Justin for your help again, I still havent figured out how to post my script in here in a spoiler.
however, regarding my script, in the Actor Target, do i need to set it as property like i did with the "Actor Property PlayerRef Auto " or just type it in the script as " Actor Target" ?
thx.
User avatar
Verity Hurding
 
Posts: 3455
Joined: Sat Jul 22, 2006 1:29 pm

Post » Mon Nov 19, 2012 1:34 am

Thx Justin for your help again, I still havent figured out how to post my script in here in a spoiler.
however, regarding my script, in the Actor Target, do i need to set it as property like i did with the "Actor Property PlayerRef Auto " or just type it in the script as " Actor Target" ?
thx.

Target = GetBaseObject() As ActorBase
Just type that in your script, in place of your
Target = GetBaseObject()
You already set "Target" to be a property (3rd line of your script)
What Justin's line does is "fill" that property with a "value"

:)
User avatar
Auguste Bartholdi
 
Posts: 3521
Joined: Tue Jun 13, 2006 11:20 am

Post » Mon Nov 19, 2012 12:51 am

ok check this Script and see if i did it right because i am getting an error :
"GetLevel is not a function or does not exist"


Scriptname gp_aaa extends ObjectReference

Actor Property PlayerRef Auto
ActorBase target

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
If akAggressor == PlayerRef
Target = GetBaseObject() As ActorBase
Debug.Notification(Target.GetLevel())
EndIf
EndEvent
User avatar
Mr. Ray
 
Posts: 3459
Joined: Sun Jul 29, 2007 8:08 am

Post » Sun Nov 18, 2012 11:02 pm

ok check this Script and see if i did it right because i am getting an error :
"GetLevel is not a function or does not exist"


Scriptname gp_aaa extends ObjectReference

Actor Property PlayerRef Auto
ActorBase target

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
If akAggressor == PlayerRef
Target = GetBaseObject() As ActorBase
Debug.Notification(Target.GetLevel())
EndIf
EndEvent
User avatar
Motionsharp
 
Posts: 3437
Joined: Sun Aug 06, 2006 1:33 am

Post » Mon Nov 19, 2012 4:23 am

Thx Justin for your help again, I still havent figured out how to post my script in here in a spoiler.
thx.
When editing a post, toggle the WYSIWYG editor with the lightswitch looking button in the upper left and [spoiler][code][/code][/spoiler]. The result will be:

Spoiler
User avatar
Anna S
 
Posts: 3408
Joined: Thu Apr 19, 2007 2:13 am

Post » Mon Nov 19, 2012 11:16 am

Scriptname gp_aaa extends ObjectReference

Actor Property PlayerRef Auto
Spoiler
Actor Property target  Auto 

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
        If akAggressor == PlayerRef
Target = GetBaseObject() As ActorBase
Debug.Notification(Target.GetLevel())
EndIf
EndEvent
User avatar
Monique Cameron
 
Posts: 3430
Joined: Fri Jun 23, 2006 6:30 am

Post » Mon Nov 19, 2012 6:08 am

Scriptname gp_aaa extends ObjectReference

Actor Property PlayerRef Auto ; Set Value Auto to PlayerRef
Actor Property target Auto ; Set Value Default

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
If akAggressor == PlayerRef
Target = GetBaseObject() As ActorBase
Debug.Notification(Target.GetLevel())
EndIf
EndEvent
User avatar
RaeAnne
 
Posts: 3427
Joined: Sat Jun 24, 2006 6:40 pm

Post » Mon Nov 19, 2012 12:10 pm

Scriptname gp_aaa extends ObjectReference

Actor Property PlayerRef Auto
Actor Property target Auto

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
If akAggressor == PlayerRef
Target = GetBaseObject() As ActorBase
Debug.Notification(Target.GetLevel())
EndIf
EndEvent
User avatar
Jon O
 
Posts: 3270
Joined: Wed Nov 28, 2007 9:48 pm

Post » Mon Nov 19, 2012 10:09 am

Scriptname gp_aaa extends ObjectReference

Actor Property PlayerRef Auto
Actor Property target Auto

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
If akAggressor == PlayerRef
Target = GetBaseObject() As ActorBase
Debug.Notification(Target.GetLevel())
EndIf
EndEvent
User avatar
NAtIVe GOddess
 
Posts: 3348
Joined: Tue Aug 15, 2006 6:46 am

Post » Sun Nov 18, 2012 8:44 pm

ok i paste my script in here and turned the switch, then the script becomes gray color or like unlit, then what ?
User avatar
Veronica Martinez
 
Posts: 3498
Joined: Tue Jun 20, 2006 9:43 am

Post » Sun Nov 18, 2012 11:03 pm

Spoiler
Scriptname gp_aaa extends ObjectReference
Actor Property PlayerRef Auto
Actor Property target Auto
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
If akAggressor == PlayerRef
Target = GetBaseObject() As ActorBase
Debug.Notification(Target.GetLevel())
EndIf
EndEvent
User avatar
Tinkerbells
 
Posts: 3432
Joined: Sat Jun 24, 2006 10:22 pm

Post » Sun Nov 18, 2012 11:11 pm

Scriptname gp_aaa extends ObjectReference
Actor Property PlayerRef Auto
Actor Property target Auto
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
If akAggressor == PlayerRef
Target = GetBaseObject() As ActorBase
Debug.Notification(Target.GetLevel())
EndIf
EndEvent
User avatar
Cathrin Hummel
 
Posts: 3399
Joined: Mon Apr 16, 2007 7:16 pm

Post » Mon Nov 19, 2012 12:00 pm

Scriptname gp_aaa extends ObjectReference
Actor Property PlayerRef Auto
Actor Property target Auto
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
If akAggressor == PlayerRef
Target = GetBaseObject() As ActorBase
Debug.Notification(Target.GetLevel())
EndIf
EndEvent
Spoiler
Scriptname gp_aaa extends ObjectReference
Actor Property PlayerRef Auto
Actor Property target Auto

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
If akAggressor == PlayerRef
Target = GetBaseObject() As ActorBase
Debug.Notification(Target.GetLevel())
EndIf
EndEvent
User avatar
Hazel Sian ogden
 
Posts: 3425
Joined: Tue Jul 04, 2006 7:10 am

Post » Sun Nov 18, 2012 10:09 pm

I believe an issue comes into play with the use of GetBaseObject(). As GetBaseObject() has nothing to run off of, who knows what it is returning. You need to do something like this (or for whatever property you are actively trying to GetBaseObject()):
Target = Target.GetBaseObject() As ActorBase

Here is what I looked at for GetBaseObject() to arrive at my thought on the issue: http://www.creationkit.com/GetBaseObject_-_ObjectReference
User avatar
SamanthaLove
 
Posts: 3565
Joined: Mon Dec 11, 2006 3:54 am

Post » Mon Nov 19, 2012 8:08 am

You should be able to edit your existing posts instead of making a new one each time. Also try using the "Preview Post" button, which you can find under "More Reply Options".

Try this: click on the "switch" icon when making your post so that it appears to be in a fixed-width font. Then, copy and paste the following into your post and put your script in the middle of it:

[spoiler][code]Code goes here[/code][/spoiler]

P.S. Nice trick for posting BBCode JustinOther, I'm going to start using that :)

Cipscis
User avatar
Melly Angelic
 
Posts: 3461
Joined: Wed Aug 15, 2007 7:58 am

Post » Mon Nov 19, 2012 9:11 am

Scriptname gp_aaa extends ObjectReference

Actor Property PlayerRef Auto
ActorBase Property target Auto
Spoiler
Code goes here

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
If akAggressor == PlayerRef
Target = GetBaseObject() As ActorBase
Debug.Notification(Target.GetLevel())
EndIf
EndEvent
User avatar
Kanaoka
 
Posts: 3416
Joined: Fri Jun 16, 2006 2:24 pm

Next

Return to V - Skyrim