Blade & Sorcery
0 of 0

File information

Last updated

Original upload

Created by

Basalt

Uploaded by

BasilBasalt

Virus scan

Safe to use

Tags for this mod

About this mod

Smite your enemies down!

Permissions and credits
HOW TO USE: Find "Smiting" in Misc. Equip as hat. Press left trigger to smite.


This is V1, once custom spell support is here, I'll make a better, cleaned up version


This is also the first script I've written myself, big thanks to Max Hyper for helping me through the first few scripts.





SOURCE CODE:


using BS;
using UnityEngine;
using UnityEditor;

namespace Crucifix

{

    public class CrucifixScript : MonoBehaviour
    {
        Item item;

        public void Awake()
        {
            item = this.GetComponent<Item>();
        }
       
        public void Update()
        {
            bool triggerPressed = PlayerControl.handLeft.usePressed;
                    
                    if (triggerPressed == true)
               {
                        item.definition.GetCustomReference("Sound").GetComponent<AudioSource>().Play();
                        item.definition.GetCustomReference("Animation").GetComponent<Animation>().Play();
                        item.definition.GetCustomReference("Particles").GetComponent<ParticleSystem>().Play();
                        StartCoroutine("Explosion");
               }
            
        }

        System.Collections.IEnumerator Explosion()

        {

            yield return new WaitForSeconds(3);

            foreach (Creature npc in Creature.list)
            {
                if (npc != Creature.player)
                {
                    float distNPC = Vector3.Distance(npc.ragdoll.GetPart(HumanBodyBones.Chest).transf.position, item.transform.position);
                    if (distNPC < 5)
                    {
                       
                        npc.ragdoll.SliceHead();
                        npc.ragdoll.SliceFoots();
                        npc.ragdoll.SliceHands();
                        npc.ragdoll.SliceLowerArms();
                        npc.ragdoll.SliceLowerLegs();
                        npc.ragdoll.SliceUpperArms();
                        npc.ragdoll.SliceUpperLegs();
                        npc.health.Kill();

                    }
                }
            }
        }
    }
}
   

As you can tell, this was originally going to be a weapon, a crucifix in particular, but as the end of development, i decided it would be way cooler to just be used separately.