Hopefully Simple Mod Help...

Post » Tue Nov 20, 2012 5:21 pm

I'll start off by asking the defining question:

Is it possible to add scripts to weapons?

What I'd like to do is add an effect to a weapon that can run a console command everytime the wielder of the weapon gets a kill.

Is this possible?

If it is then please let me know and perhaps give me a quick tip as to how to get started. I should be able to take it from there.
User avatar
Justin Hankins
 
Posts: 3348
Joined: Fri Oct 26, 2007 12:36 pm

Post » Tue Nov 20, 2012 12:53 pm

Yes, very possible. Plenty of vanilla skyrim weapons have scripts on them. The most notable are probably weapons like the Wabbajack, and Mehrunes Razor.

Which console command? They don't always translate directly into a Papyrus command which is what you'll be using.
User avatar
Unstoppable Judge
 
Posts: 3337
Joined: Sat Jul 29, 2006 11:22 pm

Post » Tue Nov 20, 2012 6:32 pm

Fantastic news!

Alright, to be more precise, I'd like to add an absorption effect to the ebony blade.

That is, when the wielder kills an ennemy, they absorbe some of their mass and increase in size.

So what I need the script to do is detect the kill, determine the scale of the wielder and add on a specific amount to the scale up to a certain point. So like every kill adds +a.aa to their scale up to b.bb

Thank you so much!
User avatar
April D. F
 
Posts: 3346
Joined: Wed Mar 21, 2007 8:41 pm

Post » Tue Nov 20, 2012 8:59 am

That's a pretty cool idea. What would be your variables? They can be hard-coded (actually defined in the script) or they can be "properties" which can be defined externally.
User avatar
Michelle Smith
 
Posts: 3417
Joined: Wed Nov 15, 2006 2:03 am

Post » Tue Nov 20, 2012 5:44 am

Assuming I'm understanding you, the variables would be the scale of character with the sword and wether or not a hit with the blade actually kills an ennemy.

EDIT: I'm fairely new to papyrus but I had a bit of experience with scripts in Oblivion so that's why I'm somewhat uncertain when it comes to things here.
User avatar
Syaza Ramali
 
Posts: 3466
Joined: Wed Jan 24, 2007 10:46 am

Post » Tue Nov 20, 2012 9:27 am

Yes, but the actual values of those variables. What is the maximum size the player can achieve? How much size do they gain per kill?
User avatar
Christina Trayler
 
Posts: 3434
Joined: Tue Nov 07, 2006 3:27 am

Post » Tue Nov 20, 2012 1:42 pm

Aah, right sorry!

Well I'd hope they'd just be numbers within the script itself that would be changed if someone so desires, but I'd hope for a max scale of say 2.5 with an increase of 0.005 every kill (I'm prety sure that at that rate there'd only be a physical change every 2 kills since the engine rounds up but I'd still like it that way).
User avatar
Tom
 
Posts: 3463
Joined: Sun Aug 05, 2007 7:39 pm

Post » Tue Nov 20, 2012 6:14 pm

Alright, so I'm trying to get this thing started and write my script. I pretty sure I'm going to have to use the OnDeath event. But wouldn't this apply to the creature that was being killed? I thought there might be a simpler event or term I could use for when a weapon's wielder kills someone. Or was I wrong?

I'm thinking I'll have to start with:

Event OnDeath (Actor akKiller)
if (akKiller == Game.GetPlayer())
;-scale line(s) go here-
User avatar
Maria Leon
 
Posts: 3413
Joined: Tue Aug 14, 2007 12:39 am

Post » Tue Nov 20, 2012 7:38 pm

So am I starting off right with that?
User avatar
Austin England
 
Posts: 3528
Joined: Thu Oct 11, 2007 7:16 pm

Post » Tue Nov 20, 2012 4:43 am

Looks good, if you had that code inside an enchantment (give it a duration of 1 second so you don't have to worry about which weapon or how else the player might have killed the NPC) placed on the weapon (not the weapon itself) it should run properly on any NPC's you hit. You'll need to make sure they are humanoid and not a creature also .
User avatar
Emma Parkinson
 
Posts: 3401
Joined: Wed Jul 26, 2006 5:53 pm

Post » Tue Nov 20, 2012 12:59 pm

Is there a specific string I can add to have it affect creatures aswell? Or would I have to add a line for each individual non-humanoid race?
User avatar
SEXY QUEEN
 
Posts: 3417
Joined: Mon Aug 13, 2007 7:54 pm

Post » Tue Nov 20, 2012 5:35 am

Given that the only things the player can actually kill are all ACTOR forms you shouldn't have to specify anything other than any appropriate OnHit and OnDeath Events.
User avatar
Roddy
 
Posts: 3564
Joined: Fri Jun 15, 2007 11:50 pm

Post » Tue Nov 20, 2012 9:35 am

Alright, now how would I make it so this effect works for any wielder if the weapons? Like if I have a follower with it?

Edit: I think I'll have to use the "GetActorReference()" or maybe "GetActorOwner()" to retrieve the actual Id of the wielder. However it looks like I need an alias for the actor first, is there a way to apply an alias to simply the wielder of the weapon? I'm actually probably totally understanding this whole alias thing wrong.

On a side note I thought I knew a few things but apparently I know absolutely nothing. :(
User avatar
Laura
 
Posts: 3456
Joined: Sun Sep 10, 2006 7:11 am

Post » Tue Nov 20, 2012 3:23 pm

If the weapon needs to work for whoever wields it you don't need any special code trying to find just who exactly it is.
User avatar
Kieren Thomson
 
Posts: 3454
Joined: Sat Jul 21, 2007 3:28 am

Post » Tue Nov 20, 2012 6:24 am

So what I have there would still find the actor wielding the weapon, whoever it is?
User avatar
Casey
 
Posts: 3376
Joined: Mon Nov 12, 2007 8:38 am

Post » Tue Nov 20, 2012 12:00 pm

If the script is on the weapon or on an enchantment on the weapon ANY actor will be able to use it and the effects *will apply.

*depending on how you code the actual growth. It's easy to find out who killed another actor (which, I imagine, will be the same person that you want to undergo growth).
User avatar
carley moss
 
Posts: 3331
Joined: Tue Jun 20, 2006 5:05 pm

Post » Tue Nov 20, 2012 8:22 am

I assume the "Game.GetPlayer()" gets the actual player character though right? Not the wielder of the sword if it were anyone but the player? Would I need to use another Get___ statement instead then?

I guess if yes then which one?

Also yes, your assumption above is 100% correct. :smile:

Edit: Just found out what the aliases were all about, boy do I feel stupid.
User avatar
james reed
 
Posts: 3371
Joined: Tue Sep 18, 2007 12:18 am

Post » Tue Nov 20, 2012 7:53 am

Antares, come back! I'd be lost without you (you're probably just busy).
User avatar
Alycia Leann grace
 
Posts: 3539
Joined: Tue Jun 26, 2007 10:07 pm

Post » Tue Nov 20, 2012 5:44 am

Hey! Sorry, I was busy with some modding/papyrus of my own. http://www.creationkit.com/Category:Papyrus is one of my best friends whenever I am doing anything in papyrus, I refer to it constantly (its even bookmarked).

If I may ask, what have you done so far? I'll slap it on a weapon enchantment and see what I can make of it.
User avatar
Wane Peters
 
Posts: 3359
Joined: Tue Jul 31, 2007 9:34 pm

Post » Tue Nov 20, 2012 8:10 am

I think I have it done... if it was referencing the player, how would I let it get/reference any actor who is wielding the weapon?

Here's what I have if it's only for the player:

ScriptName EbonyMassAbsorptionScript extends ActiveMagicEffectEvent OnDeath (Actor akKiller)if akKiller == GetKillerplayerscale = game.getplayer().getscale()  if (playerscale <3.0)  playerscale = playerscale + 0.05  game.getplayer().setscale(playerscale)
User avatar
Lauren Denman
 
Posts: 3382
Joined: Fri Jun 16, 2006 10:29 am

Post » Tue Nov 20, 2012 7:40 am

I wrote this script and tested it with a growth rate of + 0.1 per kill. In third person it seemed to scale the player quite fluidly.
Spoiler

Scriptname DA08EbonyMassAbsorptionScript extends activemagiceffect{The ebony blade will now cause its wielder to grow larger and more intimidating with each kill}Actor Property Wielder Autofloat CurrentScalefloat NewScaleEvent OnEffectStart(Actor akTarget, Actor akCaster)Wielder = akCaster		  ;now we know who is wielding Ebony Blade   ;Debug.Notification("Wielder is" + akCaster)EndEventEvent OnDying(Actor akKiller)		;In theory this should happen earlier than an OnDeath Event. Can't be a bad thing										;very short effect duration. If this event is firing during this effect we can be pretty sure Wielder killed this victimCurrentScale = Wielder.GetScale()  If (CurrentScale < 3.0)			   ;maximum allowed scale. 3 is HUMONGOUS. I would recommend a cap of under 2. ~1.5   NewScale = CurrentScale + 0.05			  ;rate of growth/kill	Wielder.SetScale(NewScale)	;Debug.Notification(akKiller + "killed with the Ebony Blade")  endifEndEvent
User avatar
Jade MacSpade
 
Posts: 3432
Joined: Thu Jul 20, 2006 9:53 pm

Post » Tue Nov 20, 2012 7:10 pm

I wrote this script and tested it with a growth rate of + 0.1 per kill. In third person it seemed to scale the player quite fluidly.
Spoiler

Scriptname DA08EbonyMassAbsorptionScript extends activemagiceffect{The ebony blade will now cause its wielder to grow larger and more intimidating with each kill}Actor Property Wielder Autofloat CurrentScalefloat NewScaleEvent OnEffectStart(Actor akTarget, Actor akCaster)Wielder = akCaster		  ;now we know who is wielding Ebony Blade   ;Debug.Notification("Wielder is" + akCaster)EndEventEvent OnDying(Actor akKiller)		;In theory this should happen earlier than an OnDeath Event. Can't be a bad thing										;very short effect duration. If this event is firing during this effect we can be pretty sure Wielder killed this victimCurrentScale = Wielder.GetScale()  If (CurrentScale > 3.0)			   ;maximum allowed scale. 3 is HUMONGOUS. I would recommend a cap of under 2. ~1.5   NewScale = CurrentScale + 0.05			  ;rate of growth/kill	Wielder.SetScale(NewScale)	;Debug.Notification(akKiller + "killed with the Ebony Blade")  endifEndEvent

I-I-I... don't know what to say. I feel so utterly useless because looking at that I feel like I did virtually nothing. I'll go and throw this on the blade. I... can't express my gratitude enough Antares, thank you. I'll be back as soon as I test this out, though considering you made it and not me, it should work flawlessly.
User avatar
Kelsey Hall
 
Posts: 3355
Joined: Sat Dec 16, 2006 8:10 pm

Post » Tue Nov 20, 2012 6:31 am

Aw :blush: . Don't feel like that. The script you posted above actually saved me quite a bit of time even though it ended up being a pretty easy script to write. Don't worry, I had zero programming/scripting knowledge myself before Oblivion came along and I taught myself that language from scratch. Now I'm doing more or less the same with Papyrus :tongue:

Mate, we are all here to help. Foster goodwill where you can :smile:. It will be you helping other users soon enough. :tops:

Definitely let me know if something is off in the functionality though. I didn't test with your rate of growth so that might produce some unexpected behaviour (rounding).

*EDIT: Typo in my script. Editing posts tends to morph these characters '>' and '<' into &--#62; and &--#60;. I've fixed my above post.
User avatar
Kyra
 
Posts: 3365
Joined: Mon Jan 29, 2007 8:24 am

Post » Tue Nov 20, 2012 7:04 pm

This has given me a pretty cool idea for another application.

Imagine a pet wolf/bear cub etc follwer/companion that you raised from infancy. With each kill it matures and grows stronger. Eventually your pet becomes far more fearsome and larger than its wild counterparts.

If I wasn't so busy with Mzandahrk I'd get to making it right now.
User avatar
Doniesha World
 
Posts: 3437
Joined: Sun Jan 07, 2007 5:12 pm

Post » Tue Nov 20, 2012 5:32 pm

RRAGH, the Creation Kit is being strange. Usually I can just go and attach a magic effect right away but now it's giving me grief and refusing to apply the script(go figure since I'm actually trying to do something really cool this time).

I've attached the script to a magic effect which I've then added into the enchantment on the Blade. Is this not correct?

That pet idea also sounds really neat, with the scale going from that of a baby to an advlt over your adventures, it'd make for a really immersive pet.
User avatar
Chris BEvan
 
Posts: 3359
Joined: Mon Jul 02, 2007 4:40 pm

Next

Return to V - Skyrim