Jump to content

Scripting a kill


dfac364

Recommended Posts

I am trying to write a script that will force the player to use a specific and unique weapon in order to kill the boss in the end, i have tried comming at this problem every way i can think of and ive got nothing, any ideas?
Link to comment
Share on other sites

In Oblivion where there were Begin GameMode blocks, you could put an object script on the boss that would instantly kill him if HasMagicEffect *Some really strange effect never ordinarily used on enemies in combat* == 1. So you would have a special sword with some weird enchantment like a fortify mysticism on hit. This is the type of spell no one would ever cast on an enemy by accident, prematurely killing the boss.

 

In Skyrim, you would need to figure out a different trigger to use rather than Begin GameMode constant monitoring.

Link to comment
Share on other sites

You could put a script on the weapon that sets the NPC to essential or non-essential in the OnEquipped and OnUnequipped events. Or if you want to make sure that a follower doesn't kill the boss when you're equipped with the weapon, put a script on the boss with an OnHit event that checks his/her health. If health is lower than 0, and the weapon that hit him/her is the unique weapon, set the boss to unessential and kill him/her.
Link to comment
Share on other sites

Simple. Make the NPC Invinicible so that he cannot die. Next code a script that removes Invincible tag upon being hit if player has X weapon equiped.

Here's a quick code that I threw together and tested. It works. Have fun! Oh, also give me Kudos if this helps you. It's under my name and avatar on the left of this post. Thanks

 

 

 

Function SetInvulnerable(bool abInvulnerable = true) native

 

ActorBase property TheBoss Auto

Weapon property WeaponThatKillsBoss Auto

 

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)

if (akAggressor == game.getPlayer()) && (akSource == WeaponThatKillsBoss)

TheBoss.SetInvulnerable(false)

else

TheBoss.SetInvulnerable(true)

endif

EndEvent

Link to comment
Share on other sites

put the above code on the NPC, or use this code instead. Put it on the weapon itself.

 

 

Function SetInvulnerable(bool abInvulnerable = true) native

 

ActorBase property TheBoss Auto

 

Event OnEquipped(Actor akActor)

if (akActor == Game.GetPlayer())

TheBoss.SetInvulnerable(false)

EndEvent

 

Event OnUnequipped(Actor akActor)

if (akActor == Game.GetPlayer())

TheBoss.SetInvulnerable(true)

endIf

endEvent

Link to comment
Share on other sites

Thank you very much to everyone who answered,

@DeadlyCobraXXX you have completely saved me lol i was trying to make these scripts and a hundred similar ones for almost two days but im still learning and i had no idea i needed the Function line and for some reason it never occured to me that i should identify the player as an akactor, i was trying to use an alias property

Link to comment
Share on other sites

  • Recently Browsing   0 members

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