jayhud91 Posted August 9, 2022 Share Posted August 9, 2022 So it goes without saying im new to scripting any pointers or a point in the right direction would be greatly appreciated .Ok I've been at this for roughly 4-5 days and I'm still coming up with nada I know there are some talented people in here that will get a laugh out of this but uhh......trying to spawn Kaylee (ig_kaylee hash: 0xA7810923) as a bodygaurd that follows you around. and so far i've spawned her once in my garage (thought i had succeeded) , crashed more times then i care to mention. I haven't quite figured out the menu toggle quite yet or how to add different models to select (will try to workout later) so far ive come up with this. local Companion = {} Companion = menu.add_parent("Your Companion") function Companion.tick() local playerPed = PLAYER.PLAYER_PED_ID() local player = PLAYER.GET_PLAYER_PED(playerPed) local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed) if(PLAYER.IS_PLAYER_ONLINE() and playerExists) then if(get_key_pressed(74)) then local veh = PED.GET_VEHICLE_PED_IS_IN(playerPed,true) local CompanionskinID = GAMEPLAY.GET_HASH_KEY("ig_kaylee") local coords = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 5.0, 0.0); STREAMING.REQUEST_MODEL(CompanionskinID) local Company = PED.CREATE_PED( 26,CompanionskinID,coords.x, coords.y, coords.z,0,false,true) local group = PLAYER.GET_PLAYER_GROUP(PLAYER.PLAYER_ID()); PED.SET_PED_AS_GROUP_MEMBER(Company, group); AI.TASK_COMBAT_HATED_TARGETS_AROUND_PED(Company, 5000, 0); PED.SET_PED_KEEP_TASK(Company, true); WEAPON.GIVE_DELAYED_WEAPON_TO_PED(Company, GAMEPLAY.GET_HASH_KEY("weapon_specialcarbine"), 5, true); ENTITY.SET_ENTITY_INVINCIBLE(Company, true); end end end return Companion Not sure what im missing or if this is even close Used the d2stcode snippets DIS2RBED'S LUA Documentation & Minimal script. Quote Link to comment Share on other sites More sharing options...
MedveD Posted August 9, 2022 Share Posted August 9, 2022 35 минут назад, jayhud91 сказал: local player = PLAYER.GET_PLAYER_PED(playerPed) Why do you need this line? it is not used, but it can break the script and for the fact that you called it "player" And you definitely looked at D2 Api? "PLAYER.IS_PLAYER_ONLINE" is not in the documentation Quote Link to comment Share on other sites More sharing options...
MedveD Posted August 9, 2022 Share Posted August 9, 2022 You can go to server in discord and I could help in creating this script Quote Link to comment Share on other sites More sharing options...
jayhud91 Posted August 9, 2022 Author Share Posted August 9, 2022 Was unsure if needed it or not have been looking at other peoples cloning and ped spawn coding and it was always there. wasn't sure if if was redundant or not. I'll message ou on discord. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.