Jump to content

Need help with Oncombat script


Maleagant

Recommended Posts

This script is supposed to force the Follower actor to Cast the Werewolfchange spell at the beginning of combat. (Yes I know this is a once a day power, useing it as a test spell (to make sure the script works) before I modify it to a lesser power for multiple uses on the Follower).

 

 

Here's my script:

 

 

ScriptName activateSelfOnCombatBegin extends Actor
{Script that lives on an actor that simply activates itself on Combat Begin}

import game
import debug

auto State waiting
Event OnCombatStateChanged(Actor actorRef, int combatState)
	if combatState != 0 ; 0 = not in combat, so if the state isn't 0, they entered combat
		gotoState("allDone")
		activate(Self)
	endIf
endEvent
endState

State allDone
;do nothing
endState

SPELL Property WerewolfChange  Auto  

Event OnCombat (Kythiraamanan)

	Werewolfchange.cast(Self, Self)
endEvent

 

 

 

I am receiving this error when compiling:

 

Compiling "activateSelfOnCombatBegin"...

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\activateSelfOnCombatBegin.psc(22,29): missing ID at ')'

No output generated for activateSelfOnCombatBegin, compilation failed.

 

Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on activateSelfOnCombatBegin

 

Any help would be apreciated (or a script if anyone knows one that works like this)

 

Thanks :D

Edited by Maleagant
Link to comment
Share on other sites

My second attempt:

 

ScriptName activateSelfOnCombatBegin extends Actor
{Script that lives on an actor that simply activates itself on Combat Begin}

import game
import debug

auto State waiting
Event OnCombatStateChanged(Actor actorRef, int combatState)
	if combatState != 0 ; 0 = not in combat, so if the state isn't 0, they entered combat
		gotoState("allDone")
		activate(Self)
	endIf
endEvent
endState

State allDone
;do nothing
endState

SPELL Property WerewolfChange  Auto  

Event OncombatStateChanged(sskythiraamanan akTarget, 0 aeCombatState)

if (akTarget == Game.GetPlayer())
	if (aeCombatState == 1)
		Werewolfchange.Cast(Kythiraamanan())
	endif
endif

EndEvent

 

 

Gives this error:

 

Compiling "activateSelfOnCombatBegin"...

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\activateSelfOnCombatBegin.psc(22,53): no viable alternative at input '0'

No output generated for activateSelfOnCombatBegin, compilation failed.

Link to comment
Share on other sites

I do not know where you got that script, but there are lots of things wrong with it.

 

Why do you have states in your script when you're not using them for anything? You have a command telling your script to go to one state, but no command telling it to go back to the previous state. What is 'sskythiraamanan' and 'Kythiraamanan'? Why are you trying to have the actor activate itself instead of casting the transform spell like you wanted?

 

Anyway, I would use a script like this:

 

Scriptname Example extends Actor

SPELL Property WerewolfChange Auto

Event OnCombatStateChanged(Actor actorRef, int combatState)

if (combatState == 1)	;started combat
	WerewolfChange.Cast(Self)
elseif (combatState == 0)	;left combat
	DispelSpell(WerewolfChange)
endif

EndEvent

Link to comment
Share on other sites

I'm not A scripter but this may work

 

So instead of

Event OnCombatStateChanged(Actor actorRef, int combatState)
               if combatState != 0 ; 0 = not in combat, so if the state isn't 0, they entered combat

try

Event OnCombatStateChanged(Actor actorRef, int combatState)
               if (Follower.GetCombatState() != 0)  ; 0 = not in combat, so if the state isn't 0, they entered combat

Replace the word follower with your follower's id/name tough(not sure which one is needed)

And if THAT doesn't work try this

Event OnCombatStateChanged(Actor actorRef, int combatState)
               if aeCombatState != 0 ; 0 = not in combat, so if the state isn't 0, they entered combat

Edit:Ohh well I'm too late fg109's script should be perfect tough.

Edited by RandomlyAwesome
Link to comment
Share on other sites

I do not know where you got that script, but there are lots of things wrong with it.

 

Why do you have states in your script when you're not using them for anything? You have a command telling your script to go to one state, but no command telling it to go back to the previous state. What is 'sskythiraamanan' and 'Kythiraamanan'? Why are you trying to have the actor activate itself instead of casting the transform spell like you wanted?

 

Anyway, I would use a script like this:

 

Scriptname Example extends Actor

SPELL Property WerewolfChange Auto

Event OnCombatStateChanged(Actor actorRef, int combatState)

if (combatState == 1)	;started combat
	WerewolfChange.Cast(Self)
elseif (combatState == 0)	;left combat
	DispelSpell(WerewolfChange)
endif

EndEvent

 

I tried this out, it works, but there is a slight issue, She will change into a werewolf when she enters combat, But she will not change back after leaving it. Any ideas? (By the way I will be giveing you full credit for this in the Mod since you've helped me solve the issue if we can actually get this to work).

Link to comment
Share on other sites

Maybe there is a separate spell that handles changing back to a humanoid. Ive never looked at the werewolf spells myself so that could be bunk.

 

It looks like she actually dispels it, but she remains a werewolf race, May need to somehow add a function that saves her race before the transformation and then sets her race back to herself after combat ends.

 

(Like Douge does with his Skeever Fevor quest on youtube only he uses a single shot quest, whereas were trying to make this continuous every time thing.)

 

And unfortunately the papyrus script commands work differently on NPC's Vs Quest Alias's (Tried just modifying his set race script but to no avail) :(

Edited by Maleagant
Link to comment
Share on other sites

  • Recently Browsing   0 members

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