Thread: AI Spawning.

Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    OvKL's Avatar
    Join Date
    Jul 2013
    Gender
    male
    Posts
    24
    Reputation
    10
    Thanks
    2
    My Mood
    Inspired

    AI Spawning.

    Found this script that Spawns AI, All credit goes to creator.
    I am aware that this is on UC as said above All credit goes to creator.

    Code:
    function FollowUnit()
    
    local new_objective
    
    local valid_criminals = {}
    for pl_key, pl_record in pairs( managers.groupai:state():all_player_criminals() ) do
    if pl_record.status ~= "dead" then
    table.insert( valid_criminals, pl_key )
    end
    end
    
    if #valid_criminals > 0 then
    local follow_unit = managers.groupai:state():all_player_criminals()[ valid_criminals[ math.random( #valid_criminals ) ] ].unit -- pick a random player
    new_objective = { 
    type = "follow",
    follow_unit = follow_unit,
    scan = true,
    is_default = true
    }
    end
    return new_objective
    end
    
    
    function SpawnMob()
    
    local spawn_point = managers.network:game():get_next_spawn_point()
    
    local spawn_pos = spawn_point.pos_rot[1]
    local spawn_rot = spawn_point.pos_rot[2]
    
    local unit_name = Idstring( "units/payday2/characters/ene_spook_1/ene_spook_1" )
    local myobjective = FollowUnit()
    
    local spawn_ai = { 
    init_state = "idle",
    objective = myobjective
    }
    
    local unit = World:spawn_unit( unit_name, spawn_pos, spawn_rot )
    
    unit:movement():set_character_anim_variables()
    
    
    end
    If you want to spawn a different Ai, replace 'Spook' with AI Name.

    AI List:
    "units/payday2/characters/ene_biker_1/ene_biker_1",
    "units/payday2/characters/ene_biker_2/ene_biker_2",
    "units/payday2/characters/ene_biker_3/ene_biker_3",
    "units/payday2/characters/ene_biker_4/ene_biker_4",
    "units/payday2/characters/ene_bulldozer_1/ene_bulldozer_1",
    "units/payday2/characters/ene_cop_1/ene_cop_1",
    "units/payday2/characters/ene_cop_2/ene_cop_2",
    "units/payday2/characters/ene_cop_3/ene_cop_3",
    "units/payday2/characters/ene_cop_4/ene_cop_4",
    "units/payday2/characters/ene_fbi_1/ene_fbi_1",
    "units/payday2/characters/ene_fbi_2/ene_fbi_2",
    "units/payday2/characters/ene_fbi_3/ene_fbi_3",
    "units/payday2/characters/ene_fbi_heavy_1/ene_fbi_heavy_1",
    "units/payday2/characters/ene_fbi_swat_1/ene_fbi_swat_1",
    "units/payday2/characters/ene_fbi_swat_2/ene_fbi_swat_2",
    "units/payday2/characters/ene_gang_black_1/ene_gang_black_1",
    "units/payday2/characters/ene_gang_black_2/ene_gang_black_2",
    "units/payday2/characters/ene_gang_black_3/ene_gang_black_3",
    "units/payday2/characters/ene_gang_black_4/ene_gang_black_4",
    "units/payday2/characters/ene_gang_mexican_1/ene_gang_mexican_1",
    "units/payday2/characters/ene_gang_mexican_2/ene_gang_mexican_2",
    "units/payday2/characters/ene_gang_mexican_3/ene_gang_mexican_3",
    "units/payday2/characters/ene_gang_mexican_4/ene_gang_mexican_4",
    "units/payday2/characters/ene_gang_russian_1/ene_gang_russian_1",
    "units/payday2/characters/ene_gang_russian_2/ene_gang_russian_2",
    "units/payday2/characters/ene_gang_russian_3/ene_gang_russian_3",
    "units/payday2/characters/ene_gang_russian_4/ene_gang_russian_4",
    "units/payday2/characters/ene_gang_russian_5/ene_gang_russian_5",
    "units/payday2/characters/ene_secret_service_1/ene_secret_service_1",
    "units/payday2/characters/ene_secret_service_2/ene_secret_service_2",
    "units/payday2/characters/ene_security_1/ene_security_1",
    "units/payday2/characters/ene_security_2/ene_security_2",
    "units/payday2/characters/ene_security_3/ene_security_3",
    "units/payday2/characters/ene_shield_1/ene_shield_1",
    "units/payday2/characters/ene_shield_2/ene_shield_2",
    "units/payday2/characters/ene_sniper_1/ene_sniper_1",
    "units/payday2/characters/ene_sniper_2/ene_sniper_2",
    "units/payday2/characters/ene_spook_1/ene_spook_1",
    "units/payday2/characters/ene_swat_1/ene_swat_1",
    "units/payday2/characters/ene_swat_2/ene_swat_2",
    "units/payday2/characters/ene_swat_heavy_1/ene_swat_heavy_1",
    "units/payday2/characters/ene_tazer_1/ene_tazer_1",
    "units/payday2/characters/ene_biker_escape/ene_biker_escape",
    }

  2. #2
    jreynolds552's Avatar
    Join Date
    Jul 2011
    Gender
    male
    Location
    UK
    Posts
    40
    Reputation
    10
    Thanks
    244
    My Mood
    Amused
    I change the "Spook" to "units/payday2/characters/ene_swat_heavy_1/ene_swat_heavy_1" and then save and press del, It doesn't change the character ai.
    To live is to suffer, but to survive is to find meaning in the suffering.

  3. #3
    FenixFire's Avatar
    Join Date
    Aug 2013
    Gender
    male
    Posts
    13
    Reputation
    10
    Thanks
    0
    Would this work Online?

  4. #4
    OvKL's Avatar
    Join Date
    Jul 2013
    Gender
    male
    Posts
    24
    Reputation
    10
    Thanks
    2
    My Mood
    Inspired
    Quote Originally Posted by jreynolds552 View Post
    I change the "Spook" to "units/payday2/characters/ene_swat_heavy_1/ene_swat_heavy_1" and then save and press del, It doesn't change the character ai.
    Dont press delete, just save the file and hit insert when you're in a game.

    @FenixFire yes it works Online. If you want I Can provide screenshots.

    Since people dont think this works here is some screenshots.

    Attached Thumbnails Attached Thumbnails
    4kcKm.jpg  

    Last edited by OvKL; 09-05-2013 at 09:43 PM.

  5. #5
    Win32's Avatar
    Join Date
    Aug 2013
    Gender
    male
    Posts
    12
    Reputation
    10
    Thanks
    0
    It doesnt work for me...I copied everything from first post and no spawn.
    Do i need to update dll? I have one with delete fuction to spawn ai...

  6. #6
    jreynolds552's Avatar
    Join Date
    Jul 2011
    Gender
    male
    Location
    UK
    Posts
    40
    Reputation
    10
    Thanks
    244
    My Mood
    Amused
    Yea it must be an updated DLL I know if that this must be the correct code but just not the correct DLL. Im going to try another DLL then edit this post if it works.
    To live is to suffer, but to survive is to find meaning in the suffering.

  7. #7
    OvKL's Avatar
    Join Date
    Jul 2013
    Gender
    male
    Posts
    24
    Reputation
    10
    Thanks
    2
    My Mood
    Inspired
    @Win32
    @jreynolds552

    I'm using the old .Dll works fine.

  8. #8
    FORGETME86's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Posts
    19
    Reputation
    10
    Thanks
    11
    Can you copy and paste the code for the bulldozer because i tried it and it does not work

  9. #9
    OvKL's Avatar
    Join Date
    Jul 2013
    Gender
    male
    Posts
    24
    Reputation
    10
    Thanks
    2
    My Mood
    Inspired
    Quote Originally Posted by FORGETME86 View Post
    Can you copy and paste the code for the bulldozer because i tried it and it does not work
    Here is all my scripts.
    Code:
    -- Message on screen
    if managers.hud then
    	managers.hud:show_hint( { text = "" } )
    end
    
    -- debug menu
    if managers.menu then
            managers.menu:set_debug_menu_enabled(true)
    end
    
    
    
    -- Infinite ammo clip
    if not _fireWep then _fireWep = NewRaycastWeaponBase.fire end
    function NewRaycastWeaponBase:fire( from_pos, direction, dmg_mul, shoot_player, spread_mul, autohit_mul, suppr_mul, target_unit )
        _fireWep( self, from_pos, direction, dmg_mul, shoot_player, spread_mul, autohit_mul, suppr_mul, target_unit )
        
        if managers.player:player_unit() == self._setup.user_unit then
            self.set_ammo(self, 1.0)
        end
    end
    
     function FollowUnit()
    
    local new_objective
    
    local valid_criminals = {}
    for pl_key, pl_record in pairs( managers.groupai:state():all_player_criminals() ) do
    if pl_record.status ~= "dead" then
    table.insert( valid_criminals, pl_key )
    end
    end
    
    if #valid_criminals > 0 then
    local follow_unit = managers.groupai:state():all_player_criminals()[ valid_criminals[ math.random( #valid_criminals ) ] ].unit -- pick a random player
    new_objective = { 
    type = "follow",
    follow_unit = follow_unit,
    scan = true,
    is_default = true
    }
    end
    return new_objective
    end
    
    
    function SpawnMob()
    
    local spawn_point = managers.network:game():get_next_spawn_point()
    
    local spawn_pos = spawn_point.pos_rot[1]
    local spawn_rot = spawn_point.pos_rot[2]
    
    local unit_name = Idstring( "units/payday2/characters/ene_bulldozer_1/ene_bulldozer_1" )
    local myobjective = FollowUnit()
    
    local spawn_ai = { 
    init_state = "idle",
    objective = myobjective
    }
    
    local unit = World:spawn_unit( unit_name, spawn_pos, spawn_rot )
    
    unit:movement():set_character_anim_variables()
    
    
    end
    
    
    if Network:is_server() then
    SpawnMob()
    managers.hud:show_hint( { text = " " } )
    end

  10. #10
    Win32's Avatar
    Join Date
    Aug 2013
    Gender
    male
    Posts
    12
    Reputation
    10
    Thanks
    0
    Man, you could tell me that they are anemy and i have to be a host...
    Last edited by Win32; 09-07-2013 at 04:35 AM.

  11. #11
    OvKL's Avatar
    Join Date
    Jul 2013
    Gender
    male
    Posts
    24
    Reputation
    10
    Thanks
    2
    My Mood
    Inspired
    Quote Originally Posted by Win32 View Post
    Man, you could tell me that they are anemy and i have to be a host...
    LMAO, I'm so sorry. How the fuck did i forget.

  12. #12
    jreynolds552's Avatar
    Join Date
    Jul 2011
    Gender
    male
    Location
    UK
    Posts
    40
    Reputation
    10
    Thanks
    244
    My Mood
    Amused
    Your code works great for me I must not have had debug menu or something, thanks.
    Last edited by jreynolds552; 09-07-2013 at 05:47 AM. Reason: Fixed
    To live is to suffer, but to survive is to find meaning in the suffering.

  13. #13
    OvKL's Avatar
    Join Date
    Jul 2013
    Gender
    male
    Posts
    24
    Reputation
    10
    Thanks
    2
    My Mood
    Inspired
    Quote Originally Posted by jreynolds552 View Post
    Your code works great for me I must not have had debug menu or something, thanks.
    Thanks mate.

    As i said above, It's not my code, All credit to creator.

    Enjoy.

  14. #14
    cheeeeeese's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Posts
    5
    Reputation
    10
    Thanks
    0
    are they supposed to spawn at the ally spawn point? cause every time i run the script it just spawns an enemy beside the van, how could i get them to spawn somewhere else

  15. #15
    klawz's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Posts
    57
    Reputation
    10
    Thanks
    3
    My Mood
    Cool
    THIS CODE ONLY WORKS IF YOU'RE HOST

    I'm not sure why, but that's the way it was designed.

Page 1 of 2 12 LastLast

Similar Threads

  1. How to may spawn on all bases
    By Naeron in forum WarRock - International Hacks
    Replies: 8
    Last Post: 05-13-2007, 07:44 PM
  2. [Trade]Insta Spawn & Unlim Stamina Adresses for....
    By EndRiT in forum WarRock - International Hacks
    Replies: 4
    Last Post: 04-15-2007, 06:57 AM
  3. [request]spawn kill
    By MaskedFox in forum WarRock - International Hacks
    Replies: 9
    Last Post: 03-20-2007, 09:21 PM
  4. Spawn on enemy base
    By analog70 in forum WarRock - International Hacks
    Replies: 36
    Last Post: 03-18-2007, 04:17 AM
  5. [RELEASE] Xauen Sniper Spawn
    By retrac in forum WarRock - International Hacks
    Replies: 4
    Last Post: 02-19-2007, 04:05 PM