Jump to content

Could use guidance from experienced modders for an ambitious project.


Recommended Posts

Hey all, I'm gong to try and keep this as short and straightforward as possible. Unfortunately while I know what it is I want to accomplish I'm uncertain of the how and have already started encountering problems that I can't seem to solve.

 

So in essence what I want to do is add some new powers into Fallout 4, Now I know this has been done before with mods like "Mutant Powers" etc. However, I was hoping to do things a little differently, as such I don't want these powers (which are essentially spells) to overwrite any of the equip slots for Throwable, Weapons, or Armours. Instead my aim was to use Aid items that the player can assign to favourite and then just fire them off, while still being able to use any equipped weapons.

 

This method should work fine for the powers that target "self"; such as buffs and cloaks, theoretically AOEs centred on the player could be activated in this manner too. It starts to get a little more complicated when I want to move on to powers that target other actors, now from my understanding of papyrus and the CK in general it seems like the way to do this would be with scripts that cast these powers when the aid item is used. This is where I'm getting really stuck.

 

For my first targeted power (Cryo Blast) the player would use the relevant Aid item, after which the item would be added back into their inventory, they would play some kind of anim, and the spell would be cast in the direction they're facing.

 

Here is the script I tried writing (it complies with no errors and I assigned all of the relevant properties in CK however it appears to have no effect when used) I have added the "; comments" to try and provide a little more detail and insight into the problem, they obviously were not in the original script(s) I wrote:

 

Scriptname SHSS_CryoBlastActivatorScript extends activemagiceffect

Idle Property CharacterWeaponGrenadeThrow Auto const
Potion Property SHSS_CryoBlastSpellActivator Auto const
Spell Property SHSS_CryoBlastSpell Auto const

Event Oneffectstart (actor akTarget, actor akCaster)

If(akTarget == Game.GetPlayer()) ;1
akTarget.additem(SHSS_CryoBlastSpellActivator, 1, true) ;2

utility.wait(0.01) ;3
akTarget.PlayIdle(CharacterWeaponGrenadeThrow) ;4
SHSS_CryoBlastSpell.Cast(akTarget) ;5

EndIf

EndEvent
;1 I added this "if" condition after the first attempt failed and I assumed the game wasn't recognizing me as a player for some reason, prior to that I was using "Game.GetPlayer()." on each line, I have also attempted to swap akTarget for akCaster.

;2 this just doesn't do anything, I really don't get it, I have tried the effect with just this line and nothing else and it still will not add the item, which is wierd as I've used mods that have this same line of code and they worked as intended in my game.

;3 I don't know if this is 100% needed but the other "playidle" scripts I've seen all seem to use it so I figured I'd better do so too (I have fiddled with the timer slightly too ranging from 0.01-1.0, to try and allow more time for the item to be added before playing the animation).

;4 I know that grenadethrow isn't an idle but I thought I would try anyway, I've also tried other anims such as pointforward and jumpland, still doesn't seem to do anything in game.
;5 I think I get why this doesn't work but I'm not certain. My theory is that it's because the spell in question is designed to target another actor whereas the chem the player is using targets "self" however I could be wrong.

Another Idea I've had is to place an activator at the player and have them trigger it through scripts, this activator then "forces" the player to use the specified anim, and fires the associated spell in the direction that the player is facing, however I feel like there's something I'm still missing. Currently my success rate with FO4 papyrus is like 50-50 so help in that area are greatly appreciated, but any other ideas or suggestions you guys may have on the ck side of things that might make things easier would be welcome too.
Link to comment
Share on other sites

It looks like you're on the right track and your script should be working as intended. Try putting a Debug.Notification("Effect Start") to make sure the script is firing. Also keep in mind that the player, or actors in general can't use every idle in the game. They have to have the idle in their race's behavior graph. For playing idle you might also have to add in a check for first or third person.

Link to comment
Share on other sites

 

 

;5 I think I get why this doesn't work but I'm not certain. My theory is that it's because the spell in question is designed to target another actor whereas the chem the player is using targets "self" however I could be wrong.

 

That's probable. Take a look at how Berry Mentats highlights living targets works. Basically it uses a cloak to convert a "self" effect in to an "aimed" effect.

 

BerryMentats (potion, self) -> DetectLifeChem (magic effect, self) -> DetectLifeCloackChemSpell (spell, aimed) -> DetectLifeCloakChemEffect (magic effect, aimed)

 

In the aimed effect akTarget and akCaster should be the proper actors.

Link to comment
Share on other sites

Hello again guys, thought I'd post a quick update. I don't know if the script was just corrupted or something. But I just deleted then rebuilt the effect, potion, and script. Now I have the "AddItem" and "PlayIdle" lines working in game, the "Cast" still does nothing, but progress is progress.

 

 

 

That's probable. Take a look at how Berry Mentats highlights living targets works. Basically it uses a cloak to convert a "self" effect in to an "aimed" effect.

 

BerryMentats (potion, self) -> DetectLifeChem (magic effect, self) -> DetectLifeCloackChemSpell (spell, aimed) -> DetectLifeCloakChemEffect (magic effect, aimed)

 

In the aimed effect akTarget and akCaster should be the proper actors.

 

Funnily enough I'm pretty sure that I'm following a similar path to the berry mentats: "Cryo Blast Power (Potion/Self) --> Cryo Blast pot effect (Effect/Self) --> Cryo Blast Spell (Spell/Aimed) --> Cryo Blast Effect (Effect/Aimed). I hadn't actually looked into the Berry Mentats though, but that could be useful.

 

What do you all reckon about using activators if the spell doesn't fire from script?

ie: Potion: onEffectStart -> placeatme = myactivator. Activator: onLoad -> cast = myspell.

 

I get the feeling that method is going to be easier said than done though...

Link to comment
Share on other sites

Make sure you Cryo Blast Effect has a projectile. Aimed spells won't work without one.

Yeah, it does, figured I'd double check it just in case and everything appears to be as it should. it's also worth noting I can use console commands in game to force the spell to be cast, and I get the correct projectile and effect etc. so as far as I can tell my spell and my chem are both working just not together.

Link to comment
Share on other sites

Hmmm, I dunno then. Maybe it's cause you're playing an idle that the spell doesn't want to cast. Try casting the spell first before playing the idle.

That's worked. Thank you. it's a little buggy still (the spell will only work in 3rd person with no fine aim, hits noticeably to the left of the crosshairs, and fires off before anim starts).

For the anims I reckon a slight tweaking of the code may sort that out.

I'm unsure what to do about the 3rd person limitation at this moment.

The targeting kind of makes sense, after all the player is essentially hurling a spell from their left hand; not ideal for the player when trying to aim but it's hardly the biggest problem.

Unfortunately I'll be away from my pc for a couple of days now, so won't be able to implement anything new until the weekend. I'll still be about on mobile and checking in on the forums if anyone wants to make a suggestion or whatever. Thanks again. Bye for now.

Link to comment
Share on other sites

Since you can't cast the spell while in idle, maybe you could drop a marker and cast the spell from that instead:

 

Scriptname SHSS_CryoBlastActivatorScript extends activemagiceffect

Idle Property CharacterWeaponGrenadeThrow Auto const
Potion Property SHSS_CryoBlastSpellActivator Auto const
Spell Property SHSS_CryoBlastSpell Auto const
Static Property XMarker Auto

Event Oneffectstart (actor akTarget, actor akCaster)

   If(akTarget == Game.GetPlayer()) ;1
      akTarget.additem(SHSS_CryoBlastSpellActivator, 1, true) ;2

      utility.wait(0.01) ;3
      ObjectReference Marker = akTarget.PlaceAtme(XMarker)
      akTarget.PlayIdle(CharacterWeaponGrenadeThrow) ;4
      SHSS_CryoBlastSpell.Cast(Marker) ;5
      Utility.Wait(1)
      Marker.Disable()
      Marker.Delete()

   EndIf

EndEvent
Link to comment
Share on other sites

 

Since you can't cast the spell while in idle, maybe you could drop a marker and cast the spell from that instead

 

I think that's what I was referring when I kept saying activators. I will definitely test this method when I get home, looks interesting.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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