Jump to content

Deleted56253002User

Account closed
  • Posts

    33
  • Joined

  • Last visited

Posts posted by Deleted56253002User

  1. I am familiar with logic when it comes to scripting, especially since it comes with parenthesis. However, I am at a point where I must use CK conditions for certain things to function and I am a bit puzzled with how AND/OR works with complex conditions in CK. Here is what I have in mind script wise for easier understanding:

     

    For a magic effect to take place I want the following conditions to be met first:

     

    a || b || c || d || e || (f && (g || h || (i && j)))
    After running the function through a boolean algebra calculator I found online, here is the result:
    a OR b OR c OR d OR e OR (f AND g) OR (f AND h) OR (f AND i AND j)
    Based on this, I am assuming that this should be the order in which the conditions are placed? (see below)
    a OR
    b OR
    c OR
    f AND
    g OR
    f AND
    h OR
    f AND
    i AND
    j AND
    Is this correct? I am guessing that the first 3 conditions (a-c) are correct but where there were parenthesis in the original statements are what's confusing me as well as the fact that OR takes precedence over AND.
    Any help would be greatly appreciated!
  2. Probably do need to use reference aliases.

     

    I'm wondering if it would be possible to have something like LeadA, LeadB, LeadD and LeadE each at an offset from the player / commander (who would be LeadC). For those that follow, give them a modified variation of the follower package and have them follow a specific lead. Thus any gaps in the following ranks would auto-fill as replacements are added. Only the leads would then need to be specifically replaced.

    I had the idea where a script could check whether if a soldier in the first column first row is dead, then a new soldier in the next row would replace that actor variable. However, I am having some trouble figuring out how trying to register an NPC death event since I don't want these if statements to run regularly on an update but when an NPC dies for performance issues. In the script I have experimented with these events:

     

    "Event OnDeath(Actor akKiller)"

    "Event OnDeath(Actor akKiller)"

    "Event OnStoryKillActor(ObjectReference akVictim, ObjectReference akKiller, Location akLocation, int aiCrimeStatus, int aiRelationshipRank)"

    On a new test mod to figure out how these events worked, I created a new quest, added a new script to that quest, and filled them out as follows. For testing purposes to see if the script was working correctly, it was setup so that if a certain actor property died, the player would die:
    Scriptname testingDeathEvents extends Quest
    Actor Property PlayerRef Auto
    Actor Property AlvorREF Auto
    Actor Property GerdurREF Auto
    Event OnStoryKillActor(ObjectReference akVictim, ObjectReference akKiller, Location akLocation, int aiCrimeStatus, int aiRelationshipRank)
    if akVictim == GerdurREF
    PlayerRef.Kill()
    elseif akVictim == AlvorREF
    PlayerRef.Kill()
    endIf
    endEvent
    Went to Riverwood, killed Gerdur and Alvor hoping to see the player die and the script to function correctly, but it didn't work. Do death events need to run on individual actor references and/or alias references to function correctly or is there a way for them to work within the quest script?
  3. I've had some success with my formation scripts I had mentioned in earlier posts. However, there is one issue I am running into: chokepoints. When a large formation of soldiers come across a bridge or a town, their pathfinding is all messed up. Originally my plan was to create X-Markers and place them all over bridges and use them as a proxy to compare the formation leader's distance to the marker (if they are close to the marker ie. the bridge, the formations will stop). However, there are far too many bridges throughout Skyrim and comparing distance of over 10+ bridges seems like an inefficient and slow option.

     

    I was wondering if there are any other methods to detect whether an NPC has encountered a bridge. I have one idea but I am not exactly sure how to execute it. It involves locations. Maybe I could create a single "ChokepointLocation" where I make each bridge part of this singular location and determine whether the formation leader NPC is in this "ChokepointLocation" or not to determine whether the formation script should fire or not.

     

    Take for example, WhiterunLocation, it covers part of Whiterun's walled exterior entrance but also near the Honningbrew Meadery and the two bridges nearby (it would seem that WhiterunLocation covers multiple separated areas. If there is a way to create a new location and mark each bridge or chokepoint under the same location, I think I wouldn't need to create individual locations/xmarkers and could operate under a single location and speed up the process, however I am unsure as to how the game creators managed to specify certain areas/geometry of a map or cell to be marked as a certain location, and if someone could point me towards the right direction or add some new ideas as to how to accomplish this I would really appreciate it.

     

    I suspect some of the primitive boxes in CK may have something to do with this?

     

    Also, could another option be attaching scripts to trigger volume's? So once an NPC enters a bridge a script fires that stops the formation script?

     

     

     

     

    Edit: It seems like locations are tied to a cell, and you can't add additional locations to a cell without changing the original location, which means you'll have to do a bunch of linking, so locations are out of the question.

     

    However, I have gone through and discovered trigger boxes. Perhaps I can create a script where if the formation leader enters a trigger volume, they are added to a "Chokepoint Faction" which then is removed once they leave the trigger volume, and the formation script could check whether or not the formation leader is in the "Chokepoint Faction" or not to determine whether they should go into formation or not.

     

     

    Edit: Through testing I have come up a solution I will have to test. The solution is to add a dummy item to object references which have specific keyword related to the formation leaders every time that they enter the trigger box, and removing them every time they leave the trigger box. The formation script will then check whether the formation leaders have this dummy object in their inventory, and if so, their formations will cease. A much better solution that the approach of adding a ton of X markers everywhere.

     

    Edit: The solution had worked! Hoorah!

  4. For all 20+ actors, I am checking for each actor if they have a bow equipped,and if so, they will perform X, otherwise they will perform Y. Wondering since I have already written an if statement for each actor already if this is worthwhile. The time to check takes at least a second or more in most cases, wondering if arrays can speed this process up so it takes less than a second or instant if possible.
  5. For all 20+ actors, I am checking for each actor if they have a bow equipped,and if so, they will perform X, otherwise they will perform Y. Wondering since I have already written an if statement for each actor already if this is worthwhile. The time to check takes at least a second or more in most cases, wondering if arrays can speed this process up so it takes less than a second or instant if possible.
  6. AHA!

    I got it to finally work well! Now every single large patrol I come across (16 men - 22 men) now goes into combat formations and fights smart and intelligently, without any issues with scripts and latency issues.

     

    I did exactly what was described above. I made a master controller script which detected the commander, and once they were detected, their respective quest would start, triggering the rest of the formation and AI scripting, and their respective quest/script would end once they were un-loaded from the cell. This is much more efficient than having everything evaluated at once.

     

    Thanks to everyone who has helped make this a possibility, people had been wondering if battle formations could be possible in Skyrim and now it has become a reality!

  7. So could another option be to create a master controller quest which detects certain commander NPCs that are loaded around the player, and when it detects those NPCs, it starts another quest associated with that platoon of soldiers with its own scripts, and that quest and script will stop should the commander NPC is unloaded and not around the player anymore? That way it will only load certain scripts that it has to and only has the commander and quest properties?
  8.  

    I'm guessing that you are referring to this post:
    There are a lot of things that are wrong here, but i will just meantion the most importants.
    1) You should always take in account that players won't just have your mod, but they could have hundreds of mods, with hundreds of heavy scripted quests, abilities, scenes, weapons, spells, followers.... etc.
    Which is a strong reason that someone would use a combat/war mod like yours to test/see their stuff in action.
    For example: I would play your mod just to see my X-Beyond droid, which carries a 1200+ line combat script, decimate an entire army all by her self, and to see repeatedly some of her cool abilities which fire only under certain conditions and when she is in a critical state.
    2) You are doing something that the game engine is not made for, and you are dpoing it on a large scale. Just because something can be done it doesn't mean that it safe to do it.
    Don't you think that over the 10 years of Skyrim life a lot of experienced modders had the idea to do something similar in the past, but they were never further developed, there must be a reason behind it...
    I personally have removed from my mod a large combat scene like this for a bunch of reasons, but mainly for the 'No Consistency' on all systems.
    3) You are pulling every 1 sec, and you have a large amount of scripts doing the same thing.
    You are giving the system a reason to have a stroke...
    4) And a bunch of other things...
    Your mod is becoming a recipe for ctds, freezes and corruption.
    All "Register" functions have the drawback that can corrupt the save file under certain conditions.
    The optimized way to do this is to have 1 "Master Controller" script to handle your troops formation + script pulling, this means to have only 1 script 'Registering' instead of a 100, this does have the disadvantage that there will be different actors responses according to the amount of actors and the system the script is in + the amount of other active scripts at that given point (weaker sys vs strong sys), but it's a million times safer, more stable and reliable than to have a bunch of individual scripts firing.
    And do all this in "targeted combat scenes" and to not exaggerate beyond what the game engine is build for, taking always in account the consistency of "Scene's Execution" in ALL systems not only on your system with your 'load order', but on ALL PCs with ALL possible mods set ups.
    You need to always have in the back of your mind the word "Optimization", and do your things with the least possible amount of system resources.

     

     

    When you mean one "Master Controller", do you mean creating one quest with it's own Reference Aliases that will pair matching actors into the script and thereby eliminating the need for adding thousands of actor properties? So lets say you come across 50 actors in combat, the script will automatically fill X number of those actors into the pool of reference aliases given certain conditionings, and the script will run? Then when combat is over, we could reset those reference aliases that could be filled with different actors for the next combat scene?

     

    I'll also look into using events than update, like combat state changed, OnHit, or when an actor has started an attack (can't recall the name of this event).

     

    So I am guessing that the issue here is the sheer amount of actors that the script has to run through along with registering every second will cause problems, so the solution is to find a way to make the same outcome occur just with a script that is flexible and can determine which actors to use on the spot rather than going through a large preselected list of properties and finding an alternative event compared to OnUpdate()?

     

     

    If I recall during City Sieges in the vanilla game, it has dozens of reference aliases relating to citizens (so they had citizen1, citizen2, citizen3...citizen 40, etc.) which they would detect, fill, and disable until the siege was over. So would it be a good idea to follow something similar, except using soldiers as opposed to citizens and a formation script instead of disable().

  9. When it comes to performance, script latency, and functionality, is it better to use one large script that contains all the variables and data for many different scenarios or is it better to have several smaller scripts that fire once certain specific conditions are made?

     

    I recently created a script which adds a proper formation for a group of soldiers. After having initial success with it, I decided to scale up and add an exponentially higher amount of actors to that same script and essentially copied and pasted what I had initially that was working, simply adding these new actors to the script and giving them to run the same function as the initial group in testing. However, I was met with much worse script functionality and very poor script latency when it came to testing.

     

    Should I have created multiple quests that fire their own individual script when a condition is met (ie. when a specified actor is loaded) rather than having one large script for the computer to sift through? Is there a way to make it so that you have a series of scripts that can constantly turn on or off based on conditions that are met? So rather than having on large script running in the background at all times, it is smaller scripts that run temporarily and are disabled when needed. For example, a script for a particular patrol group will run only when it is loaded in the player's cell and will stop once they leave the cell, but can be reactivated once the player is in the same cells as theirs.

     

     

    Note: I started with 22 actors when I was developing the script to function properly, and once things worked well all I did was simply scale up, adding over 900 new actor properties and assigning the same exact function to the new actor properties, but now the actors are not reacting nearly as quick to the script as they should have.

  10. As promised here's the function I have developed to detect the correct speed at which to rotate. I simply plug this function into the afOffsetAngleZ parameter of KeepOffsetFromActor and it requires a constant update check to see if the soldier is in position or not. It determines if the actor's current Z angle is within a certain range and if so, it may rotate if they aren't matching similar Z angles.

     

     

    Float Function GetRotationSpeed(actor Commander, actor SoldierToObtainRotationSpeed)
    float CommanderAngleZ = 0.0
    float LeftBound = 0.0
    float RightBound = 0.0
    float CommanderAngleZHalfway = 0.0
    float ViewConeHalved = 90.0
    float SpeedToRotate = 5.0
    CommanderAngleZ = Commander.GetAngleZ()
    LeftBound = CommanderAngleZ - ViewConeHalved ;Set Initial LeftBound
    RightBound = CommanderAngleZ + ViewConeHalved ;Set Initial RightBound
    CommanderAngleZHalfway= CommanderAngleZ + 180
    if LeftBound < 0
    LeftBound = LeftBound + 360
    endIf
    if RightBound >= 360
    RightBound = RightBound - 360
    endIf
    if CommanderAngleZHalfway>= 360
    CommanderAngleZHalfway = CommanderAngleZHalfway - 360
    endIf
    if (LeftBound > RightBound)
    if (SoldierToObtainRotationSpeed.GetAngleZ()> RightBound)&&(SoldierToObtainRotationSpeed.GetAngleZ()< LeftBound)
    if (SoldierToObtainRotationSpeed.GetAngleZ()>CommanderAngleZHalfway)&&(SoldierToObtainRotationSpeed.GetAngleZ()< LeftBound)
    return 1.0 * SpeedToRotate
    else
    return -1.0 * SpeedToRotate
    endIf
    else
    return 0.0
    endIf
    else ;(RightBound > LeftBound)
    if (SoldierToObtainRotationSpeed.GetAngleZ()< LeftBound)||(SoldierToObtainRotationSpeed.GetAngleZ()> RightBound)
    if (SoldierToObtainRotationSpeed.GetAngleZ()> RightBound)&&(SoldierToObtainRotationSpeed.GetAngleZ()< CommanderAngleZHalfway)
    return -1.0 * SpeedToRotate
    else
    return 1.0 * SpeedToRotate
    endIf
    else
    return 0.0
    endIf
    endIf
    EndFunction
  11. Figured it out. It takes tons of intense math, logic, knowledge of geometry, and persistence, but like I mentioned before it comes down to adjusting the variable afOffsetAngleZ with formulas based on another's actors current angle, and a lot of checking and updating to see whether the squad is out of position or not. I will share some code once I make some further tweaks.

  12. I've tried ClearLookAt, and the actors will look at the assigned NPC if in their sight, but not actually physically rotate their bodies. Right now it seems like the solution is to look at the afOffsetAngleZ variable, which sets the rotational speed of the NPCs. From my testing it seems that when afOffsetAngleZ = 0, the actors won't bother fully rotating at all under normal circumstances until their formation breaks. However, when afOffsetAngleZ > 0, the NPCs in formation begin to rotate their bodies regardless of path or location, with a higher value (ie. 100) making the NPC rotate faster than with a low value (1-5).

     

    I am currently trying to figure out a way that makes it so that this variable (afOffsetAngleZ) will change based on the conditions of the NPC related to the Player, relating to the Z-angles.

    So if the difference between the NPC's angle and the Player's angle is high enough (like when the NPC and Player are facing opposite directions), the afOffsetAngleZ variable could be set to be something high like 20 which would make the NPC rotate. Then when the NPC's angle is relatively close compared to Player's angle (say player is at Z=22 and NPC Z=10), the afOffsetAngleZ = 0 to stop them from rotating. There would be an event that constantly checks to make sure they rotate or stop rotating only when conditions are met.

     

    The tricky part for me is figuring out how to do all the math with all the angles, since I am not sure how the game calculates angles when you subtract the value to an angle that is higher than its original value (ie. 180 degrees - 280 degrees would = -100 degrees, or 260 degrees...which one is the game going to calculate and decide).

     

    Also how to make functions that are efficient so I am not repeating the same code over and over for different NPCs. Perhaps a bool that tells whether NPC is facing Target Actor or not that we can use to determine when the actor should rotate or when they shouldn't.

     

     

    This is literally the last step in making functional shield walls and formations a reality, NPCs will fight in formation correctly AS LONG AS they are facing the NPC, which means a line of shields not facing the same directions unison means some NPCs won't engage at all. I'll see what I can get tonight.

  13. It seems like the afOffsetAngleZ variable dictates the rotational speed of the actor, and not where the actor wants to actual rotate to.

     

    I am looking at the function as a first step:

     

    TranslateTo

    Function TranslateTo(float afX, float afY, float afZ, float afAngleX, float afAngleY, float afAngleZ, float afSpeed, \
    float afMaxRotationSpeed = 0.0) native

     

     

    However, I am only interested in setting the Z rotation values and rotational speed of these actors attached to the formation and no other values. I am a bit confused as to how to enter the parameters for these functions when I want to execute these functions in my script.

     

    EDIT: It looks like this function is bad, it causes actors to run in place. It's probably just for static objects. Guess I got to stick with doing some math to figure out conditions on how to rotate these actors in the afOffsetAngleZ variable.

  14. That sounds like a good idea, will look into it.

     

    Also, I was wondering if there was a way to fix the NPCs that are running backwards with this function on. It seems that if the player faces and moves a certain direction, all the troops seem to run backwards which makes everything awkward and slows them down.

  15. So I was successful in getting the soldiers to assume proper battle formations as we see here:

    https://streamable.com/dwy12k

     

     

    For testing purposes and a first step, I created several actor properties and assigned each one to a position.

     

    However, I know that once certain NPCs die, their position/role in the formation would be empty and not filled. I am curious as to how to make it so that if X soldier dies in XYZ position, a nearby soldier could take his position. I am assuming that in order to do this, I need to create ReferenceAlias proprties rather than actors, and find a way so that when an actor dies, a new actor will replace that same Reference Alias?

  16. So I've been trying to figure out how to create formations for groups of soldiers. The only two mods I have found that do this are: Mixed Unit Tactics and Mercenaries, the former of which does not include source code. It seems like the latter uses some kind of system which calculates some sort of coordinates that tell the followers where to move to, but I am looking at the creation kit scripting references website and can't find any source as to which function I can use to order an NPC to move to a certain coordinate/location, other than moveto(), which teleports the NPC to the location rather than telling them where to actually move to.

  17. I've created a mod which adds 2 javelins to Imperial soldiers (they function similar to scrolls) which they use at the start of battle. However, once they use up their javelins, they will forever be unable to use them until they respawn. Is there a way (preferably script free) so that once say every 24 hours all these soldier's inventories will be reset with the same 2 javelins (or alternatively 2 javelins added to their inventories)?

  18. I am working to get Skyrim Spear Mechanic (DAR Version) to work with Skyrim at War, giving standard legionnaires a spear-shield combo as we see in lore as opposed to only giving them swords. Everything has worked well for the most part, however I found that when I was trying to use mods that would make melee range more realistic, the range of these spears became way too short when compared to their animations (they only hit 1/2 the distance than what their animation would suggest, all other weapons had proper melee ranges that matched animation).

     

    Trying to fix this issue, I tried to increase the range of all spears. However, what happens is the NPC stops using their shields and unequips them in favor of using the 2 handed animation (which is not what I want, I need them to use the 1H animation). Looking at the animation mesh files, I deleted all of the 2H animations, but the issue still persists where the soldiers would ditch their shields. Is there a way to make it so that the NPCs can have proper spear range and be able to retain their shields?

     

    EDIT: It looks like anytime you edit any 1H weapon range of any type that is too high, the NPC will stop using their shields. I think this might be related to shield bash reach vs. weapon reach?

  19. So I created a mod which adds over 1,000-2,000 civil war soldiers to Skyrim. I'd like for them to disappear/be disabled once the war is over, but is there a better way than to manually add each individual soldier as a property and disabling them? Are scripts even required? I heard that Immersive Patrols doesn't use scripts and is able to remove their civil war patrols once the war is over.
×
×
  • Create New...