Jump to content

Compiler problem


Eliijahh

Recommended Posts

I'm trying to compile a PSC file from a mod made by another modder, now discontinued.

The script works as it runs flawslessly in the game. I extracted the BSA with OBMM. I would like to compile the source PSC, but everytime I try to use the creation kit with cmd, it finds me countless errors, like (x,y) game undefined, or (x,y) none can't be recognized as a command.

 

I can't understand why.

 

I run the compiler with :

 

papyruscompiler aaaessentialplayerscript -flags=TESV_Papyrus_Flags -output=C:\

 

I didn't use the official creation kit because everytime I try to open the plugin it gives me errors, and when I try to open the script, I can't open it. Can you give me some clues?

 

 

The PSC is the following.

 

Scriptname aaaEssentialPlayerScript extends ReferenceAlias  

int injuries = 0
int count = 0
float injuryrecovertime = 0.0
Spell property aaaGhost auto
Actor deadplayer
FormList property injuryPowers auto
int ghostthreshold = 1
aaaEssentialPlayerQuestScript property essentialQuest auto
Spell property configSpell auto
Armor property ClothesPrisonerTunic auto
Armor property UnPlayableColthesPrisonerTunic auto
float originalHealth = -1.0
Idle property idlestoploose auto
Idle property bleedoutstart auto
Idle property bleedoutstop auto
bool updated = false ; for new version
Quest property warewolfquest auto
ImpactDataSet property bleedImpact auto
MiscObject property Gold001 auto

Event OnInit()
	RegisterForSingleUpdate(1)
EndEvent

Event OnUpdate()
	;GetActorReference().DoCombatSpellApply(testSpell,GetActorReference())
	;GetActorReference().damageav("Health", 20)
	if (!GetActorReference().hasSpell(configSpell))
		GetActorReference().addSpell(configSpell, false)
	endif
	GetActorReference().StartDeferredKill()
	if (essentialQuest.mode != essentialQuest.ESSENTIALMODE)
		ghostthreshold = 1
	elseif (essentialQuest.mode == essentialQuest.ESSENTIALMODE)
		ghostthreshold = -1
	endif
	if (essentialQuest.mode == essentialQuest.HARDCOREMODE)
		; Upgrade fix to ensure those running on really old version hardcoremode are not left on that mode
		essentialQuest.mode = essentialQuest.NORMALMODE
	endif
	if (!updated)
		GetActorReference().SetNoBleedoutRecovery(false)	
		updated = true
	endif
	;if (deadplayer != none && deadplayer.getActorValue("InventoryWeight") <= 0 && deadplayer.isEnabled())
	;	deadplayer.disableNoWait(true)
	;	deadplayer.delete()
	;endif
	updateLogic()
	if (GetActorReference().getActorValue("Health") <= 0 && !getActorReference().isGhost() && !GetActorReference().isInKillMove())
		;Debug.Notification("Health less than 0 update")
		applyDyingLogic();
	endif
EndEvent

bool bleedingOut = false

Function applyDyingLogic()
	GotoState("HandleBleedOut")
	GetActorReference().setGhost(true)
	;GetActorReference().damageav("Health", 9999)
	if (essentialQuest.losemoney == 1)
		int totalgold = GetActorReference().getItemCount(Gold001)
		if (totalgold > 0)
			int goldtoremove = totalgold / 1
			GetActorReference().removeItem(Gold001, goldtoremove)
		endif
	endif
	if (warewolfquest.GetCurrentStageID() < 100 && warewolfquest.isRunning())
		GetActorReference().setGhost(false)
		warewolfquest.SetCurrentStageID(100)
		GotoState("")
		return
	elseif (warewolfquest.isRunning())
		;wait till its shut down
		;Debug.notification("Shutting down warewolf")
		GetActorReference().setGhost(false)
		GotoState("")
		return
	endif
	injuries = injuries + 1
	injuryrecovertime = Utility.getCurrentRealTime()
	GetActorReference().StopCombatAlarm()
	If (isGhostMode())
		setHealthAfterBleedOut(true)
		makeGhost()
	else
		bleedingOut = true
		Game.DisablePlayerControls()
		if (essentialQuest.essentialtype == essentialQuest.FIRSTPERSON)
			GetActorReference().SetUnconscious(true);
			Game.ForceFirstPerson()
			Game.ShakeCamera(none, 0.5, 5)
		else
			Game.ForceThirdPerson()
			GetActorReference().PlayIdle(bleedoutstart)
		endif
	endif
	RegisterForSingleUpdate(0.1)
endFunction

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \
  bool abBashAttack, bool abHitBlocked)
	if (getActorReference().isGhost())
		return
	endif
	if (getActorReference().isInKillMove())
		return
	endif
	;Actor killer = akAggressor as Actor
	;if (killer != none && killer.IsInKillMove())
		;GotoState("HandlingKillMove")
		;Debug.Notification("Kill Move Triggered")
		;GetActorReference().setGhost(true)
		;Game.DisablePlayerControls()
		;while(GetActorReference().IsInKillMove())
		;	Utility.wait(0.25)
		;endwhile
	;	applyDyingLogic();
	if (GetActorReference().getActorValue("Health") <= 0)
		;Debug.Notification("Health less than 0 hit")
		applyDyingLogic();
	endif
EndEvent

Function recoverBleedOut()
	;GetActorReference().getActorBase().setInvulnerable(true)
	;GetActorReference().setGhost(true)
	;setHealthAfterBleedOut(true)
	;Utility.wait(0.05)
	;setHealthAfterBleedOut(false)
	;GetActorReference().damageav("Health", 20)
	;Utility.wait(1.05)
	;Debug.notification("Now Mortal")
	setHealthAfterBleedOut(false)
	if (essentialQuest.essentialtype == essentialQuest.FIRSTPERSON)
		;do nothing
	else
		GetActorReference().PlayIdle(bleedoutstop)
		Utility.wait(2) ; Ensure animation has time to recover player
		Game.ForceFirstPerson()
	endif
	;GetActorReference().getActorBase().setInvulnerable(false)
	;GetActorReference().setGhost(false)
	GetActorReference().setGhost(false)
	Game.EnablePlayerControls()
	GetActorReference().SetUnconscious(false);
	GotoState("")
	addInjury()
	GetActorReference().PlayIdle(idlestoploose)
	;GetActorReference().SetAnimationVariableBool("bIdlePlaying", true)
	;Debug.SendAnimationEvent(GetActorReference(), "IdleStopInstant")
endfunction

State HandlingKillMove
	Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \
	bool abBashAttack, bool abHitBlocked)
		;Do Nothing
	EndEvent
EndState

State HandleBleedOut
	Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \
	bool abBashAttack, bool abHitBlocked)
		;Do Nothing
	EndEvent

	Function updateLogic()
		if (bleedingOut)
			; First death does not auto heal wait 5 seconds then heal player
			count = count + 1
			if (count >= 50)
				recoverBleedOut()
			elseif (essentialQuest.essentialtype == essentialQuest.FIRSTPERSON)
				GetActorReference().PlayImpactEffect(bleedImpact);
			endif
		;elseif (bleedingOut)
		;	; Bug case with essential coming back to life automatically with full health (should not be happening anymore)
		;	recoverBleedOut()
		endif
		RegisterForSingleUpdate(0.1)
	EndFunction
	
	Function applyDyingLogic()
		; do nothing
	endFunction
EndState

Function updateLogic()
	if (injuries > 0)
		if (Utility.getCurrentRealTime() - injuryrecovertime >= 30) ;|| (GetActorReference().getCombatState() == 0 && !bleedingOut))
			; Disable going into ghost mode
			injuries = 0
		endif
	endif
	RegisterForSingleUpdate(1)
EndFunction

function makeGhost()
	injuries = 0
	;Game.EnablePlayerControls()
	GetActorReference().StopCombatAlarm()
	GetActorReference().setGhost(false)
	GetActorReference().DoCombatSpellApply(aaaGhost,GetActorReference())
	if (deadplayer != none && deadplayer.isEnabled())
		if (essentialQuest.ishardcore != essentialQuest.HARDCOREGHOST)
			deadplayer.removeAllItems(GetActorReference(), true, false)
		endif
		deadplayer.disableNoWait(true)
		deadplayer.delete()
	endif
	int i = 0
	;while (i < injuryPowers.getSize())
	;	Spell injury = injuryPowers.getAt(i) as Spell
	;	GetActorReference().dispelSpell(injury)
	;	i = i + 1
	;endwhile
	Actor tmpdeadplayer = GetActorReference().PlaceAtMe(GetActorReference().getActorBase(), 1, true, false) as Actor
	tmpdeadplayer.removeAllItems()
	if (essentialQuest.ishardcore != essentialQuest.EASYGHOST)
		GetActorReference().unequipAll()
	endif
	if (essentialQuest.ishardcore == essentialQuest.HARDCOREGHOST)
		GetActorReference().removeAllItems()
	elseif (essentialQuest.ishardcore == essentialQuest.NORMALGHOST)
		GetActorReference().removeAllItems(tmpdeadplayer, true, false)
	endif
	;tmpdeadplayer.addItem(UnPlayableColthesPrisonerTunic, 1, true)
	;tmpdeadplayer.equipItem(UnPlayableColthesPrisonerTunic, false, true)
	tmpdeadplayer.enableNoWait(true)
	tmpdeadplayer.kill()
	deadplayer = tmpdeadplayer
	if (essentialQuest.ishardcore == essentialQuest.HARDCOREGHOST)
		GetActorReference().addItem(ClothesPrisonerTunic, 1, true)
		GetActorReference().equipItem(ClothesPrisonerTunic, false, true)
	endif
	GoToState("")
	GetActorReference().PlayIdle(idlestoploose)
	;GetActorReference().SetAnimationVariableBool("bIdlePlaying", true)
endfunction

function addInjury()
		if (essentialQuest.mode == essentialQuest.ESSENTIALMODE)
			injuries = 0
		endif
		if (essentialQuest.disableinjuries == 0)
			int chosen = Utility.RandomInt(0, injuryPowers.getSize() - 1)
			Spell injury = injuryPowers.getAt(chosen) as Spell
			GetActorReference().DoCombatSpellApply(injury,GetActorReference())
		endif
endfunction

bool function isGhostMode()
	return (essentialQuest.mode == essentialQuest.GHOSTMODE || (ghostthreshold != -1 && injuries > ghostthreshold))
endfunction

function setHealthAfterBleedOut(bool maxhealth)
		;GetActorReference().ResetHealthAndLimbs()
		float health = GetActorReference().getActorValue("Health")
		if (maxhealth)
			;GetActorReference().damageav("Health", 1) ; So if using console command kill will recover correctly
			GetActorReference().restoreav("Health",GetActorReference().getBaseActorValue("Health"))
		else
			int toheal = (GetActorReference().getBaseActorValue("Health") / 4) as int
			if (health < 0)
				GetActorReference().restoreav("Health", (health * -1) + toheal)
			elseif (health > toheal)
				GetActorReference().damageav("Health", health - toheal)
				GetActorReference().restoreav("Health",1)
			else
				GetActorReference().restoreav("Health", (toheal - health) + 1)
			endif
		endif
		bleedingOut = false
		count = 0
EndFunction

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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