Jump to content

Adding skill expirience scripting help


Recommended Posts

Hey guys, started some modding, as a begining want to rework perk trees, wanted to add Heavy Armor skill exp on unarmed hit(using a heavy glove), hadnt found any non-script methods for this, so below is my script, and i have no ideas if it is working(in-game check shows that it works, but kinda not always)


Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
If akAggressor == Game.GetPlayer()
 If (Game.GetPlayer().GetEquippedItemType(1) == 0)
  If (abHitBlocked == true)
   Game.AdvanceSkill("HeavyArmor", 5)
  elseif (abHitBlocked == false)
   Game.AdvanceSkill("HeavyArmor", 7)
  endif
 endif
endif
Endevent

 

Script is added to a mgef which is to ability(constant\self) which is to perk

Help me please

Link to comment
Share on other sites

Well, this is not going to work... or I am misreading...

The OnHit event fires on the target.  Your script looks good, sort of, but it needs to be on the target, not the player.

The only method that comes to mind is to put a script on the player listening for OnCombatStateChanged events.  Then use the akTarget reference to add your ability on the target (and remove any previously added ability on the previous combat target).

Link to comment
Share on other sites

I am just gonna give you some clues, it is Active Magic Effect and you want this

IF akTarget equ player AND the Source of the hit is Heavy Armored Gloves? 
    IF blocked advance this skill 5
    ELSE (he got hit by heavy glove, that a gimme) advance this skill 7
    ENDIF
ENDIF

The question is how do you code that  in an OnHit Event

hints

Actor akTarget = Self.GetTargetActor()
Keyword ArmorGauntlets = Game.getForm("0x6C0EF") as Keyword
Keyword ArmorHeavy = Game.GetForm("0x6BBD2") as Keyword

btw the top bit, that is pseudo code... 

Link to comment
Share on other sites

2 minutes ago, PeterMartyr said:
Actor akTarget = Self.GetTargetActor()
Keyword ArmorGauntlets = Game.getForm("0x6C0EF") as Keyword
Keyword ArmorHeavy = Game.GetForm("0x6BBD2") as Keyword

Beh! use hasKeywordString instead of loading keywords dynamically.

Screw users who won't install SKSE!

;-]

Or at least, use a property instead of Game.getForm.

Link to comment
Share on other sites

He was just a hint, I want him to work for it

EDIT @Gplayerholyknight I am not being cruel, you will be a better coder for it? I just wrote the bare bones basic HINTS, I left out more than I gave you, I just pointed you the right direction, you now to need to validate the source of the hit has those two keywords in any manner you choose... Property SKSE whatever... plus you may need to reverse your logic, just saying..

 

Link to comment
Share on other sites

@PeterMartyr

 

@xkkmEl

Thank you very much for answering

 

Im very noob in scripting so i didn't understand anything u wrote, 

But now i had some research and realised that my script grants player experience once the player is getting hit & the player is wearing heavy gloves,

so not the thing I actually needed to do 

Now i think about using Perk Entry - apply combat hit spell, and just using a spell which grants exp if conditions are met

Looks like my method is kinda easier then mentioned earlier in this topic

Gonna update when i check my idea

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...