Jump to content

Ninjaluxray7685

Members
  • Posts

    9
  • Joined

  • Last visited

Posts posted by Ninjaluxray7685

  1. so here is the new script but i keep running in to this issue

    (23,53): mismatched input 'enchCount' expecting INTEGER

    Spoiler

    Scriptname BladeOfChanceScript extends ObjectReference

    ; Properties
    FormList Property EnchList Auto
    Weapon Property BladeOfChance Auto

    Event OnItemCrafted(Form akBaseItem, ObjectReference akItem)
        if akBaseItem == BladeOfChance
            ; Determine the number of effects
            int effectCount = 0
            int roll = Utility.RandomInt(1, 20)
            if roll == 20
                effectCount = 3
            elseif roll >= 17
                effectCount = 2
            elseif roll >= 9
                effectCount = 1
            endif

            ; Prepare a list of available enchantments
            EnchList.Revert()
            int enchCount = EnchList.GetSize()
            Enchantment[] enchantments = new Enchantment[enchCount]

            ; Populate enchantments array
            int index = 0
            while index < enchCount
                Enchantment ench = EnchList.GetAt(index) as Enchantment
                if ench != None
                    enchantments[index] = ench
                endif
                index += 1
            endWhile

            ; Apply effects to the weapon
            Weapon weaponItem = akItem as Weapon
            if weaponItem != None
                ; Remove existing enchantments (not directly possible in Skyrim, so this is for illustrative purposes)
                ; Note: Skyrim does not provide direct methods to clear enchantments, so consider alternatives.

                ; Initialize enchantment details
                Enchantment selectedEnchantment = None
                MagicEffect[] effects = new MagicEffect[3] ; Placeholder for effects
                float[] magnitudes = new float[3] ; Placeholder for magnitudes
                int[] areas = new int[3] ; Placeholder for areas
                int[] durations = new int[3] ; Placeholder for durations

                ; Apply the selected number of effects
                int appliedCount = 0
                while appliedCount < effectCount
                    int enchantIndex = Utility.RandomInt(0, enchCount - 1)
                    selectedEnchantment = enchantments[enchantIndex]

                    if selectedEnchantment != None
                        ; Add effect to arrays (assuming valid MagicEffect objects and values)
                        ; This part is simplified. You need to define the actual effects, magnitudes, etc.
                        effects[appliedCount] = selectedEnchantment.GetMagicEffect() ; Placeholder function
                        magnitudes[appliedCount] = 10.0 ; Placeholder value
                        areas[appliedCount] = 0 ; Placeholder value
                        durations[appliedCount] = 0 ; Placeholder value
                        appliedCount += 1
                    endif
                endwhile

                ; Create and apply the enchantment with multiple effects
                if appliedCount > 0
                    ; CreateEnchantment is not a real function. Placeholder for your method of applying the effects.
                    ; weaponItem.CreateEnchantment(0.0, effects, magnitudes, areas, durations) ; Placeholder function
                endif
            endif
        endif
    EndEvent
     

     

  2. 12 hours ago, IsharaMeradin said:

    I'll be honest, I'm a little lost on what it is you are trying to do with that last script.  If you provide a bit more information on what you want to have happen, I could see if I can theory craft some code for it.

    Core Concept:

    • You want the Blade of Chance to have random enchantments every time it is crafted or initialized.
    • A D20 roll is used to decide how many enchantments will be applied to the weapon, with a chance for either 0, 1, 2, or 3 enchantments.

    Details of the Randomization:

    1. D20 Roll System:

      • You roll a 20-sided die (using the function Utility.RandomInt(1, 20)), and based on the result of that roll, the number of enchantments to be applied is decided.
      • You have divided the D20 roll into 4 groups:
        • Group 1 (3 enchantments): If the roll is 8, the weapon gets 3 random enchantments.
        • Group 2 (2 enchantments): If the roll is 2, 9, 14, the weapon gets 2 random enchantments.
        • Group 3 (1 enchantment): If the roll is 1, 3, 4, 5, 6, 10, 11, 18, the weapon gets 1 random enchantment.
        • Group 4 (no enchantment): If the roll is 7, 12, 13, 15, 16, 17, 19, 20, no enchantments are applied.
    2. Array of Enchantments:

      • You have created an array of 11 base enchantments (such as Fire, Frost, Shock, Absorb Health, etc.) that the script will choose from.
      • The script shuffles this array to randomize the selection of enchantments.
    3. Shuffling the Array:

      • The script randomly rearranges the elements in the array so that the enchantments are not always in the same order.
    4. Applying Enchantments:

      • Based on the result of the D20 roll, the script applies the appropriate number of enchantments from the shuffled array to the Blade of Chance.
      • If 1 enchantment is to be applied, the first element of the shuffled array is used.
      • If 2 enchantments are to be applied, the first two elements of the shuffled array are used, and so on.

    Desired Outcome:

    The weapon's enchantments will vary each time it is crafted, making each version of the Blade of Chance unique. Depending on the D20 roll:

    • The player may get a powerful version of the blade with 3 enchantments.
    • They might get a weaker version with only 1 or 2 enchantments.
    • Or they might get an unenchanted version (if the roll lands in Group 4).

    This randomness aligns with the "chance" theme of the weapon, giving it a different power level and functionality each time it is acquired.

  3. so i fixed the script thank you by the way but now i have a new issue i am trying to compile a script for the weaker blade where crafting has a chance to apply a 1, 2, or 3 random enchantments here is the script i am deciding to use the base enchantments provided by the game so i dont have to make new ones i hope but i am getting this and do not know what this means 
     

    Spoiler

    Scriptname BladeOfChanceCraftScript extends ObjectReference

    ; Base Enchantment properties
    Enchantment Property FireDamageEnchantment Auto
    Enchantment Property FrostDamageEnchantment Auto
    Enchantment Property ShockDamageEnchantment Auto
    Enchantment Property AbsorbHealthEnchantment Auto
    Enchantment Property BanishEnchantment Auto
    Enchantment Property ParalyzeEnchantment Auto
    Enchantment Property MagickaAbsorbEnchantment Auto
    Enchantment Property StaminaAbsorbEnchantment Auto
    Enchantment Property TurnUndeadEnchantment Auto
    Enchantment Property FearEnchantment Auto
    Enchantment Property SoulTrapEnchantment Auto

    Weapon Property BladeOfChance Auto ; Reference to the Blade of Chance

    Event OnInit()
        ; Ensure the script is for the correct weapon
        if Self == BladeOfChance
            ; Array of possible enchantments
            Enchantment[] enchantments = new Enchantment[11]
            enchantments[0] = FireDamageEnchantment
            enchantments[1] = FrostDamageEnchantment
            enchantments[2] = ShockDamageEnchantment
            enchantments[3] = AbsorbHealthEnchantment
            enchantments[4] = BanishEnchantment
            enchantments[5] = ParalyzeEnchantment
            enchantments[6] = MagickaAbsorbEnchantment
            enchantments[7] = StaminaAbsorbEnchantment
            enchantments[8] = TurnUndeadEnchantment
            enchantments[9] = FearEnchantment
            enchantments[10] = SoulTrapEnchantment
            
            ; Random number to decide the number of enchantments
            int roll = Utility.RandomInt(1, 20)
            int numEnchantments = 0
            
            ; Determine how many enchantments to apply based on the roll
            if roll == 8
                ; Group 1: 3 random enchantments
                numEnchantments = 3
            elseif roll == 2 || roll == 9 || roll == 14
                ; Group 2: 2 random enchantments
                numEnchantments = 2
            elseif roll == 1 || roll == 3 || roll == 4 || roll == 5 || roll == 6 || roll == 10 || roll == 11 || roll == 18
                ; Group 3: 1 random enchantment
                numEnchantments = 1
            else
                ; Group 4: no enchantment
                numEnchantments = 0
            endif
            
            ; Shuffle the array for randomness
            int length = 11 ; The length of the array
            int i = 0
            int j = 0
            Enchantment temp
            
            while i < length
                j = Utility.RandomInt(0, length - 1)
                ; Swap elements at indices i and j
                temp = enchantments
                enchantments = enchantments[j]
                enchantments[j] = temp
                i += 1
            endwhile
            
            ; Apply enchantments to the weapon
            int k = 0
            
            while k < numEnchantments
                if k == 0
                    Self.SetEnchantment(enchantments[k])
                else
                    Self.AddEnchantment(enchantments[k])
                endif
                k += 1
            endwhile
        endif
    EndEvent
     


     

     

     

     

    Errors Breakdown

    Error at Line 55, Column 8: no viable alternative at input 'int'

    Explanation: This error typically indicates a problem with how the int keyword or variable declarations are used in the script. Papyrus might be expecting a different syntax or context.

    Error at Line 55, Column 19: required (...)+ loop did not match anything at input '='

    Explanation: This error often occurs if there is a syntax issue with how variables are assigned or if there is an error with loop constructs.

     

  4. so i have been letting chatgpt teach me how to script because i couldn't find a video to teach me how to create a 1-20 chance roll system for a object to simulate rolling a d20 but for what ever reason its failing the save with a error 

    here is my script and screenshot of my work can some one please help me im getting annoyed trying to make this work error i get is "ApplySpell is not a function or does not exist" or when i change applyspell > cast i get "Cast is not a function or does not exist"

    Spoiler

    Scriptname SaintCastTreasureScript extends ObjectReference

    MiscObject Property SaintCastTreasure Auto ; Reference to the Saint Cast Treasure item
    Weapon Property BladeOfDestiny Auto ; Reference to the Blade of Destiny
    Spell Property StunEffect Auto ; Reference to the Stun spell/effect
    Spell Property FearEffect Auto ; Reference to the Fear spell/effect
    Spell Property CritFailEffect Auto ; Reference to the Crit Fail effect (e.g., summon a Dremora)
    Spell Property BoostEffect Auto ; Reference to the temporary stat boost effect
    Spell Property InstantKillEffect Auto ; Reference to the Instant Kill effect
    Message Property MsgCritFail Auto ; Reference to the Crit Fail message box
    Message Property MsgStun Auto ; Reference to the Stun message box
    Message Property MsgFear Auto ; Reference to the Fear message box
    Message Property MsgBoost Auto ; Reference to the Boost message box
    Message Property MsgInstantKill Auto ; Reference to the Instant Kill message box
    Message Property MsgDrainMagickaStamina Auto ; Reference to the Drain Magicka and Stamina message box
    Form Property Gold001 Auto ; Reference to the gold item
    Form Property DragonBone Auto ; Reference to the Dragon Bone item
    Form Property DaedraHeart Auto ; Reference to the Daedra Heart item
    Form Property DragonScales Auto ; Reference to the Dragon Scales item

    Event OnEquipped(Actor akActor)
        ; Only run the script if the player interacts with the Saint Cast Treasure
        if akActor == Game.GetPlayer()
            int rollResult = Utility.RandomInt(1, 20)
            
            ; Handle the different roll outcomes
            if rollResult == 1
                MsgCritFail.Show()
                akActor.Cast(CritFailEffect, akActor) ; Apply Crit Fail Effect (e.g., summon a Dremora)
            elseif rollResult >= 2 && rollResult <= 6
                MsgDrainMagickaStamina.Show()
                akActor.DamageActorValue("Magicka", 50)
                akActor.DamageActorValue("Stamina", 50)
            elseif rollResult >= 7 && rollResult <= 11
                MsgStun.Show()
                akActor.Cast(StunEffect, akActor) ; Apply Stun Effect directly to the actor
            elseif rollResult >= 12 && rollResult <= 17
                MsgFear.Show()
                akActor.Cast(FearEffect, akActor) ; Apply Fear Effect directly to the actor
            elseif rollResult >= 18 && rollResult <= 19
                MsgBoost.Show()
                akActor.Cast(BoostEffect, akActor) ; Apply Boost Effect directly to the actor
            elseif rollResult == 20
                MsgInstantKill.Show()
                akActor.Cast(InstantKillEffect, akActor) ; Apply Instant Kill Effect directly to the actor
                ; Add rewards to the player
                Game.GetPlayer().AddItem(Gold001, 250)
                Game.GetPlayer().AddItem(DragonBone, 1)
                Game.GetPlayer().AddItem(DaedraHeart, 1)
                Game.GetPlayer().AddItem(DragonScales, 3)
            endif
        endif
    EndEvent
     

    Screenshot2024-09-02060244.thumb.png.09bd31747f0f061223b2f93c8572f656.png

  5. yea so i didn't know how to properly add a title so i just copy my stream title.

    So an introduction you already know my name clearly i love f2p games like warframe, maple story, closers, master duel, the first descendent... however i love rpg games legends of the seven stars, Skyrim, Pokémon, Zelda, etc.

    i first got in to mod through oldrim and the "relics of hyrule mod a zelda dlc mod" once my poor self finally got a upto date gaming pc and se/ae i wanted to make my own mod so i created two handed sword from my favorite overlord in the nis games zetta 

    in the mean time as i am still learning designing my own weapons i want to learn how to port and help keep alive mods that can climb out of the grasp of oldrim community  i hope that the nexus community will help teach me to learn everything i need to know so i can create great mods that has inspired me to make this post today  thank you

×
×
  • Create New...