how exactly does "Self " work ?

Post » Thu Jul 31, 2014 11:15 pm

so I'm working on adding bleed effects to actors ( preferably ALL of them - but right now i only get it working on the player since i attached the script to the default player actor - if anyone knows a neat way to go about that I'd give you lots of hugs and kisses)

this is a very basic script just trying to get effects working.

as you can see basically the script is supposed to just cast a spell that i created on the actor who receives the hit .

fact 1 : when i load any save game the oninit event loads up just fine.

fact 2 : whenever ( no i think theres a delay actually but I havent got around to being hit a lot of times per second) the player receives a hit the debug message pops up saying "]makebleed" or something of that sort.

question 1 : am i doing it right? (lol)

question 2 : i figured the problem must be with the call "Self"... so what is it referring to? how do i call the actual receiver of the hit cause it seems that the Self in my script is refering to the script and not the actor(player)?

question 3(in combination with question 1) : is there a nicer / tiedier way? i dont like the idea of having to cast a spell on myself or any actor who receives a hit to simply activate a bleed effect.

what im trying to create is a mod that will add blood and bleeding effects WHENEVER an onhit event takes place no matter who or how. ( altho that becomes important in the next step, but i'd be happy with just that for now)

in turn i want to disable direct damage for combat realism. i want targets to die from bleeding to death / or being deadly injured. not from losing HP - if you get the Idea.

ScriptName makebleed extends objectreferenceSPELL Property selfbleedspell Auto Event OnInit()    Debug.Notification("all right, lets see if this is running")    GoToState("Waiting")    EndEventstate Waiting    Event OnHit(ObjectReference akAggressor, Form akWeapon, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)    selfbleedspell.cast(self)    Debug.Notification(self + " is injured")    endeventendstate
User avatar
rheanna bruining
 
Posts: 3415
Joined: Fri Dec 22, 2006 11:00 am

Post » Fri Aug 01, 2014 1:47 am

"Self" is not the problem. You have specified self as the caster, but not the target. Anyway, a spell would probably not be the best solution as you said yourself.

Try finding the Bleeding effect's script, assuming it has one. I've never had a look at it myself.

User avatar
Tanika O'Connell
 
Posts: 3412
Joined: Fri Jan 26, 2007 1:34 am


Return to V - Skyrim