Jump to content

Deleted56253002User

Account closed
  • Posts

    33
  • Joined

  • Last visited

Posts posted by Deleted56253002User

  1. Wow! It worked finally! The soldier now equips AND unequips his weapon based on if the player has their weapon equipped instantly. The part of the script which made all the difference was registering the animation events and creating an event based on those animations, which were "weaponDraw" and "weaponSheathe".

     

    RegisterForAnimationEvent(Commander, "weaponDraw")

    RegisterForAnimationEvent(Commander, "weaponSheathe")

    ________________________________________________________________________________________

     

    Event OnAnimationEvent(ObjectReference akSource, string asEventName)

    if asEventName == "weaponDraw"
    Soldier.EvaluatePackage()
    endif

     

    Event OnAnimationEvent(ObjectReference akSource, string asEventName)

    if asEventName == "weaponSheathe"
    Soldier.EvaluatePackage()
    endif

     

    Thanks so much for the help, much is appreciated!

  2. So it seems like I got it to work partially thanks to the EvaluatePackage().

     

    The package that enables soldiers to attack enemies and draw their weapons happens almost instantaneously.

     

    However, the package that disables soldiers and forces them to sheathe their weapons seems to lag behind.

     

    Here's the script, and here's a video demonstration:

     

    Scriptname questTestingScript extends Quest
    Actor Property Commander Auto
    Actor Property Soldier1 Auto
    Actor Property Soldier2 Auto
    Actor Property Soldier3 Auto
    Actor Property Soldier4 Auto
    Actor Property Soldier5 Auto
    Actor Property Soldier6 Auto
    Actor Property Soldier7 Auto
    Actor Property Soldier8 Auto
    Actor Property Soldier9 Auto
    Actor Property Soldier10 Auto
    Actor Property Soldier11 Auto
    Actor Property Soldier12 Auto
    Actor Property Soldier13 Auto
    Actor Property Soldier14 Auto
    Actor Property Soldier15 Auto
    Actor Property Soldier16 Auto
    Event OnInit()
    Debug.MessageBox("The Quest Script is Running")
    RegisterForUpdate(1.0)
    EndEvent
    Event OnUpdate()
    if Commander.IsWeaponDrawn()
    Soldier1.EvaluatePackage()
    Soldier2.EvaluatePackage()
    Soldier3.EvaluatePackage()
    Soldier4.EvaluatePackage()
    Soldier5.EvaluatePackage()
    Soldier6.EvaluatePackage()
    Soldier7.EvaluatePackage()
    Soldier8.EvaluatePackage()
    Soldier9.EvaluatePackage()
    Soldier10.EvaluatePackage()
    Soldier11.EvaluatePackage()
    Soldier12.EvaluatePackage()
    Soldier13.EvaluatePackage()
    Soldier14.EvaluatePackage()
    Soldier15.EvaluatePackage()
    Soldier16.EvaluatePackage()
    endIf
    EndEvent
    I'm wondering if there's a more efficient way to go about this besides creating an actor property for every single NPC. If there were 50-100 NPCs running this script, how much is it going to impact performance than say if the script was designed differently? I tried playing around with other events in general, but couldn't quite get around to making any of them work, particular those with parameters such as these:
    Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)
    if akBaseObject as Weapon
    Debug.Trace("This actor just equipped a weapon!")
    endIf
    endEvent

     

  3. Whats up everybody.

     

    I'm currently working on a major civil war mod that adds thousands of roaming NPCs traveling in Skyrim in groups from 5-22 soldiers. One of the elements that I've added to these groups of patrolling civil war soldiers is an AI package tells the soldiers to retreat back to HQ if soldier X, Y, and Z is dead. This works as intended generally, but many times there is a noticeable inconsistent lag and the "Retreat" AI package will usually take over anywhere from 5-15 seconds after the conditions are met, which in many cases the battle is already lost and in some cases the battle happens so fast that the soldiers don't even attempt to retreat at all, causing un-necessary casualties. I want to know if there is a way to speed it up so that they retreat almost immediately once conditions are met rather than several seconds later when its too late.

     

    The other thing I'm currently working on is the ability to command a group of 7-22 friendly CW soldiers (provided you are in the army). I simply made the "Leader" of the group of 7-22 as the potential follower of the player, and had the other 6-21 soldiers following the "Leader" through a follow AI package. The idea is that once the player asks the "Leader" to follow him, the "Leader's" soldiers will also follow as well. I made two follow packages with the conditions as follows:

     

     

     

    1. Soldiers will IGNORE combat if "Leader" has their weapon sheathed

    (When the player has their weapon sheathed, so will the follower,/"Leader" and the idea is that it also passes onto the rest of the soldiers following the "Leader", basically a command to follow and not engage soldiers, and maintain tightly packed formation. The idea is if the player and his faction come across an enemy in superior numbers and positions, this can allow the player and his army to fallback and retreat to safer/favorable ground and organize, since by default NPCs will never back down from a fight once they detect the enemy, often leading to suicide and un-necessary casualties.)

     

    2. Soldiers will NOT IGNORE combat if "Leader" has their weapon drawn

    (When the player draws their weapon, the follower/"Leader" will also draw their weapon, prompting the rest of the soldiers to draw their weapon and attack anything that is a threat, basically a command to start attacking. Lets say you are leading a group of 15 sword/shield legionnaires charging 15 enemy Stormcloaks, you would want them to run the "ignore combat" package first so that they DON'T break formation and DON'T scatter and maintain the tightly packed formation so that once you are close, you can draw the weapon (ordering soldiers to attack) and the advantageous positions + focused fire will win you the battle.)

     

    The problem is the same as described up above, the AI Packages don't take effect until 5-15 seconds after the conditions are met, which is causing a lot of these issues to occur and making it seem like the soldiers have terrible military discipline and the slowest of reaction speeds. I'd like to know if there is a way to increase the speed at which the game checks AI Package conditions and makes them take effect immediately once conditions are satisfied. I'd also be curious if there is a way to script something like this, it would be cool if once you "Blocked", your followers/fellow soldiers will also block as well as with attacking and bashing of shields, it would make the battle more tactical/strategic and feel like you are leading a disciplined army. To get a better picture of what I'm trying to achieve, check this video out, its from another game but if you could lead the Imperial Legion like this, it would be pretty awesome. I don't have much scripting experience at all but I'd be eager to learn if this is possible.

  4. Is there a way to prevent NPCs from moving out of an area when in combat? I am modding forts now, and I want the archers to stay put inside their defensive walls and towers, and not for them move out of their forts where they'll be at a disadvantage.

     

    I am thinking about using AI packages and Idle markers as a first step, any ideas?

×
×
  • Create New...