Jump to content

Need a script? Maybe I can help.


fg109

Recommended Posts

Script is compiling without errors now but not taking effect in game, this may have nothing to with the actual script though so maybe this isn't the right place for it. Right now I have the script applied to a magic effect that's related to a perk, I think the problem is somewhere in there, like how its being called or something.
Link to comment
Share on other sites

  • Replies 272
  • Created
  • Last Reply

Top Posters In This Topic

Ooone more question. (still getting grief over your last advice. It still doesn't think the faction is defined. Will try again tomorrow to make absolutely sure...)

 

Is there any way you can script the exact damage of the spell? Aka: the damage = creature/player's current max health -1? So the damage would change for one spell dependant on who the boss was targeting?

 

 

EDIT: Gonna just try from scratch - this is getting really annoying. Thanks for your help thusfar. Will follow everything to the letter and see if it works, but the above question still stands, because I'd like to know if this is possible?

Edited by avenger404
Link to comment
Share on other sites

@ChampionOfHircine

 

Just do exactly what I did in the video.

 

 

@cooltrickle

 

You misplaced the RemoveSpell function.

 

 

@Phnx

 

There is no such thing as an OnGameStart event... I don't have fore's idles, so I don't know whether or not what I tell you will work.

 

The game already plays idles when the player isn't moving. Why not add fore's idles to the possible idles it can play? Go to:

 

GamePlay -> Animations... -> Actors\Characters\Behaviors\0_Master.hkx -> ActionIdle -> NPCIdleRoot -> NonCombatIdles

 

and add the idles to the IdlePlayerRoot.

 

If that doesn't work, then I guess you can try scripting. Instead of using a quest script, I would use a magic effect script. This is because you can put conditions on a magic effect to determine when it will run, so you can copy all the conditions that were on the IdlePlayerRoot. So use this for the magic effect script:

 

 

Scriptname PlayRandomIdle extends ActiveMagicEffect

Idle Property MyFNISspellc1  Auto  
Idle Property MyFNISspellc2  Auto  

Event OnEffectStart(Actor akTarget, Actor akCaster)
int RandomPercent = Utility.RandomInt(0, 99)
if (RandomPercent < 50)
	akTarget.PlayIdle(MyFNISspellc1)
else
	akTarget.PlayIdle(MyFNISspellc2)
endif
EndEvent

 

 

and add the magic effect to an ability, and the ability to the player.

 

 

@AwesomeSkyrimDude

 

Sorry, didn't know you intended to use the script for an ability. So change the script so that it extends "ActiveMagicEffect" instead of "ReferenceAlias", and "OnEffectStart(Actor akTarget, Actor akCaster)" instead of "OnInit()" and "akTarget" instead of "GetActorReference()".

 

 

@avenger404

 

You can script the damage of a spell like that, but then remember not to give the spell any magnitude, or at least don't have it as a value modifier with assoc. item health.

 

This is because the script is applied on top of anything done by the effect itself, so having any actual effects on the spell might kill the actor.

 

Scriptname Example extends ActiveMagicEffect

Event OnEffectStart(Actor akTarget, Actor akCaster)
float Damage = akTarget.GetActorValue("Health") - 1
akTarget.DamageActorValue("Health", Damage)
EndEvent

Edited by fg109
Link to comment
Share on other sites

@fg109 I probably should have mentioned it at the start. Anyhow I now get these messages: "(5,13)no viable alternative at input '('

(5,28): required (...)+ loop did not match anything at input ','

(5,44): required (...)+ loop did not match anything at input ')'"

 

Edit:Fixed those errors, get none now but still doesn't seem to be taking effect in game.

Edited by AwesomeSkyrimDude
Link to comment
Share on other sites

I try to check if an Item has a keyword:

 

State running
Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)	
	if (akBaseItem.HasKeyword(WeapTypeSword) )
	endIf 
EndEvent
EndState

 

 

But it says "type mismatch on parameter 1 (did you forget a cast?)" The problem might be the following, I get a Form but need a Function if I understand rightly:

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)

bool Function HasKeyword(Keyword akKeyword) native

So how do I get the Form to a Function?

 

Edit: Ok, I got it solved myself, so no help is needed (for now). I had to use a Property for the Keyword "WeapTypeSword".

Edited by Leeira
Link to comment
Share on other sites

@AwesomeSkyrimDude

 

Try adding some debug messages to the script in order to figure out what's happening:

 

 

Scriptname Example extends ActiveMagicEffect

Bool Blocking
Float BlockStartTime

Event OnEffectStart(Actor akTarget, Actor akCaster)
Debug.Notification("Custom ability has become active.")
RegisterForAnimationEvent(akTarget, "BlockStart")
RegisterForAnimationEvent(akTarget, "BlockStop")
EndEvent

Event OnAnimationEvent(ObjectReference akSource, String asEventName)
if (asEventName == "BlockStart")
	Debug.Notification("Player has started blocking.")
	BlockStartTime = Utility.GetCurrentRealTime()
	Blocking = True
elseif (asEventName == "BlockStop")
	Debug.Notification("Player has stopped blocking.")
	Blocking = False
endif
EndEvent

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
if (akSource as Weapon) && !((akAggressor as Actor).GetEquippedItemType(0) == 7)
	Debug.Notification("Player was hit by a melee weapon.")
	if (Blocking)
		float BlockTime = Utility.GetCurrentRealTime() - BlockStartTime ;time in menu is counted
		if (BlockTime < 0.25)
			Debug.Notification("Attempting to disarm assailant.")
			(akAggressor as Actor).UnequipItem(akSource)
			(akAggressor as Actor).DropObject(akSource)
		elseif (BlockTime < 1.0)
			Debug.Notification("Attempting to stagger assailant.")
			Debug.SendAnimationEvent(akAggressor, "StaggerStart")
		else
			Debug.Notification("No effect because player was blocking for over 1 second.")
		endif
	endif
endif
EndEvent

 

 

 

@avenger404

 

The script I gave you doesn't require and properties. I have no problems making a spell work with it. Are you sure you did everything correctly? Maybe try changing the effect archetype to script and see if that helps.

Link to comment
Share on other sites

@AwesomeSkyrimDude

 

Yes, it could do with how you're applying it. The way it is now, it's meant to be attached to the magic effect of an ability (so constant effect, targeting self). Do you have that correct? If you do and it's still not working, forget about the perk for now and just add the ability to the player directly to check if it works.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...