Jump to content
ℹ️ Intermittent Download History issues ×

Nekito

Members
  • Posts

    11
  • Joined

  • Last visited

Posts posted by Nekito

  1. Hello everyone

     

    I have been playing around with npcs spawning commands, their attitudes and spawntrees, and tried to implement a custom exec function to spawn an entity on horse, like the 'Rider' spawn case.

    Here is the code

     

    exec function spawnen(path : string, optional quantity : int, optional distance : float, optional isHostile : bool, optional wantimmortal : bool, optional level : int )
    {
    var ent : CEntity;
    var horse : CEntity;
    var pos, cameraDir, player, posFin, normal, posTemp : Vector;
    var rot : EulerAngles;
    var i, sign : int;
    var s,r,x,y : float;
    var template : CEntityTemplate;
    var horseTemplate : CEntityTemplate;
    var horseTag : array<name>;
    var resourcePath : string;
    var l_aiTree : CAIHorseDoNothingAction;
    var templateCSV : C2dArray;
    quantity = Max(quantity, 1);
    
    
    rot = thePlayer.GetWorldRotation(); 
    rot.Yaw += 180; 
    
    
    
    
    
    
    cameraDir = theCamera.GetCameraDirection();
    
    
    if( distance == 0 ) distance = 3; 
    cameraDir.X *= distance; 
    cameraDir.Y *= distance;
    
    
    
    
    player = thePlayer.GetWorldPosition();
    
    
    
    
    pos = cameraDir + player; 
    pos.Z = player.Z;
    
    
    
    
    posFin.Z = pos.Z; 
    s = quantity / 0.2; 
    r = SqrtF(s/Pi());
    
    
    
    
    template = (CEntityTemplate)LoadResource(path,true);
    
    
    if ( path == "quests\sidequests\novigrad\quest_files\sq312_ves\characters\sq312_commando_melee_rider.w2ent" ) 
    horseTemplate = (CEntityTemplate)LoadResource('horse');
    
    
      
    
    
    for(i=0; i<quantity; i+=1)
    { 
    x = RandF() * r; 
    y = RandF() * (r - x); 
    
    
    if(RandRange(2)) 
    sign = 1;
    else
    sign = -1;
    
    
    posFin.X = pos.X + sign * x; 
    
    
    if(RandRange(2)) 
    sign = 1;
    else
    sign = -1;
    
    
    posFin.Y = pos.Y + sign * y; 
    
    
    
    
    if(theGame.GetWorld().StaticTrace( posFin + Vector(0,0,5), posFin - Vector(0,0,5), posTemp, normal ))
    {
    posFin = posTemp;
    }
    
    
    
    
    ent = theGame.CreateEntity(template, posFin, rot, true, false, false, PM_Persist );
    
    
    
    
    if ( horseTemplate )
    {
    horseTag.PushBack('enemy_horse');
    horse = theGame.CreateEntity(horseTemplate, posFin, rot,true,false,false,PM_DontPersist,horseTag);
    l_aiTree = new CAIHorseDoNothingAction in ent;
    l_aiTree.OnCreated();
    ((CActor)ent).ForceAIBehavior( l_aiTree, BTAP_AboveEmergency2, 'AI_Rider_Load_Forced' );
    ((CActor)ent).SignalGameplayEventParamInt( 'RidingManagerMountHorse', MT_instant | MT_fromScript );
    }
    
    
    if( isHostile )
    {
    ((CActor)ent).SetTemporaryAttitudeGroup( 'monsters', AGP_Default );
    }
    
    
    
    
                    if( wantimmortal )
    { 
                    ((CActor)ent).SetImmortalityMode(AIM_Immortal, AIC_Default);
                    }
                    else
                    {
                    ((CActor)ent).ForceVulnerable();
                    }
    
    
                    if ( level != 0 )
    {
    ((CNewNPC)ent).SetLevel( level );
    }
    
    
    }
    }
    

    Unfortunately, it just spawns a horse and an npc nearby. It must be something to do with AIBehaviour line

     

    If anyone has any ideas, please let me know

     

  2. By the way, how can I change outfits?

    I open the outfits section then open one of the outfits the window of items included in this outfit appears but I cant add any things there.

    Maybe its only my problem?

  3. Thanks!

    But I have already tried to change outfits and armorsets in leveled items but they appear nude always and when I open the armor set next time all the armor I add just disappear!

    I am using a mod armor by the way

    Maybe you know what the problem is?

  4. I'd like to change equipment for stormcloaks for example make them use daedric armor

    So can anyone tell me how to do this?

    There was a mod Faction armor overhaul so there stormcloaks wore steel armor

    Help please

  5. hmm...I installed the last patch and I have LOTR music installed but it only replaces vanilla music and can't affect the whole music system

    I googled it but didn't find anything, only that high ranking armor makes music stop sometimes

×
×
  • Create New...