Karel2015 Posted May 28, 2016 Author Share Posted May 28, 2016 (edited) Ok, Contrathetix :D I have figured it all out, Except I have 1 slight problem. They won't equip the outfits, and EquipItem it says is not a function. It will add the Outfit to their inventory, but they won't equip it. You now anyway around that ? Scriptname MOSummoner extends ObjectReference Armor Property CommandRadio Auto Const Actor Property Player Auto MiscObject Property Caps Auto Message Property MessageSettlers Auto Message Property MessageMinutemen Auto Message Property MessageAnimals Auto Message Property MessageAbilities Auto Message Property MessageWeapons Auto Message Property MessageOutfits Auto Message Property FirstMessage Auto Spell Property Recruit Auto Spell Property Dismiss Auto Spell Property Fly Auto Spell Property Land Auto LeveledItem Property WeaponHeavy Auto LeveledItem Property WeaponAutomatic Auto LeveledItem Property WeaponShotgun Auto LeveledItem Property WeaponMelee Auto LeveledItem Property OutfitHeavy Auto LeveledItem Property OutfitMedium Auto LeveledItem Property OutfitLight Auto Weapon Property Flare Auto ActorBase Property SettlerM Auto ActorBase Property Settler Auto ActorBase Property SettlerR Auto ActorBase Property SettlerPA Auto ActorBase Property BoSElite Auto ActorBase Property SettlerG Auto Message Property MessageVertibird Auto ActorBase Property MinuteC Auto ActorBase Property MinuteREC Auto ActorBase Property MinuteV Auto ActorBase Property MinuteR Auto ActorBase Property MinuteRangedF Auto ActorBase Property MinuteSO Auto ActorBase Property MinuteO Auto ActorBase Property AnimGroup Auto ActorBase Property AnimArmoredGroup Auto ActorBase Property AnimDogA Auto ActorBase Property AnimCatA Auto ActorBase Property RailRangedF Auto ActorBase Property cat Auto ActorBase Property Dog Auto ActorBase Property VertTravel Auto ActorBase Property VertDef Auto GlobalVariable Property SoldiersRecruited Auto Const Event OnEquipped(Actor akActor) Menu() EndEvent Function Menu() Int iCaps = 0 ; total cost of the purchase Int iButton = FirstMessage.Show() If(iButton == 0) Return ; 0 would make a handy "cancel" button ElseIf(iButton == 1) ObjectReference rPlaced = None ; ---- pick the soldier here ---- iButton = MessageMinutemen.Show() If(iButton == 0) Return ; 0 would make a handy "cancel" button ElseIf(iButton == 1) rPlaced = Player.PlaceAtMe(MinuteSO, 1) iCaps += 1000 ElseIf(iButton == 2) rPlaced = Player.PlaceAtMe(MinuteO, 1) iCaps += 1000 ElseIf(iButton == 3) rPlaced = Player.PlaceAtMe(MinuteR, 1) iCaps += 1000 ElseIf(iButton == 4) rPlaced = Player.PlaceAtMe(MinuteV, 1) iCaps += 1000 ElseIf(iButton == 5) rPlaced = Player.PlaceAtMe(MinuteC, 1) iCaps += 1000 ElseIf(iButton == 6) rPlaced = Player.PlaceAtMe(MinuteREC, 1) iCaps += 1000 EndIf ; ---- soldier pick over ---- Utility.Wait(0.5) ; wait a little maybe? ; ---- pick weapon ---- iButton = MessageWeapons.Show() ; move on to weapon picking If(iButton == 0) Return ElseIf(iButton == 1) rPlaced.AddItem(WeaponHeavy, 1) Utility.Wait(0.5) iCaps += 800 ElseIf(iButton == 2) rPlaced.AddItem(WeaponAutomatic, 1) Utility.Wait(0.5) iCaps += 800 ElseIf(iButton == 3) rPlaced.AddItem(WeaponShotgun, 1) Utility.Wait(0.5) iCaps += 800 ElseIf(iButton == 4) rPlaced.AddItem(WeaponMelee, 1) Utility.Wait(0.5) iCaps += 800 EndIf ; ---- weapon pick over ---- Utility.Wait(0.5) ; --- pick outfit --- iButton = MessageOutfits.Show() If(iButton == 0) Return ElseIf(iButton == 1) rPlaced.AddItem(OutfitHeavy, 1) Utility.Wait(0.5) iCaps += 500 ElseIf(iButton == 2) rPlaced.AddItem(OutfitMedium, 1) Utility.Wait(0.5) iCaps += 500 ElseIf(iButton == 3) rPlaced.AddItem(OutfitLight, 1) Utility.Wait(0.5) iCaps += 500 EndIf ; ---- outfit pick over ---- ElseIf(iButton == 2) ; something other than those soldiers ObjectReference rPlaced2 = None ; ---- pick the soldier here ---- iButton = MessageSettlers.Show() If(iButton == 0) Return ; 0 would make a handy "cancel" button ElseIf(iButton == 1) rPlaced2 = Player.PlaceAtMe(Settler, 1) iCaps += 1000 ElseIf(iButton == 2) rPlaced2 = Player.PlaceAtMe(SettlerM, 1) iCaps += 1000 ElseIf(iButton == 3) rPlaced2 = Player.PlaceAtMe(SettlerR, 1) iCaps += 1000 ElseIf(iButton == 4) rPlaced2 = Player.PlaceAtMe(SettlerPA, 1) iCaps += 1000 ElseIf(iButton == 5) rPlaced2 = Player.PlaceAtMe(SettlerG, 3) iCaps += 1000 EndIf ; ---- soldier pick over ---- Utility.Wait(0.5) ; wait a little maybe? ; ---- pick weapon ---- iButton = MessageWeapons.Show() ; move on to weapon picking If(iButton == 0) Return ElseIf(iButton == 1) rPlaced2.AddItem(WeaponHeavy, 1) Utility.Wait(0.5) iCaps += 800 ElseIf(iButton == 2) rPlaced2.AddItem(WeaponAutomatic, 1) Utility.Wait(0.5) iCaps += 800 ElseIf(iButton == 3) rPlaced2.AddItem(WeaponShotgun, 1) Utility.Wait(0.5) iCaps += 800 ElseIf(iButton == 4) rPlaced2.AddItem(WeaponMelee, 1) Utility.Wait(0.5) iCaps += 800 EndIf ; ---- weapon pick over ---- Utility.Wait(0.5) ; --- pick outfit --- iButton = MessageOutfits.Show() If(iButton == 0) Return ElseIf(iButton == 1) rPlaced2.AddItem(OutfitHeavy, 1) Utility.Wait(0.5) iCaps += 500 ElseIf(iButton == 2) rPlaced2.AddItem(OutfitMedium, 1) Utility.Wait(0.5) iCaps += 500 ElseIf(iButton == 3) rPlaced2.AddItem(OutfitLight, 1) Utility.Wait(0.5) iCaps += 500 EndIf ; ---- outfit pick over ---- ElseIf(iButton == 3) ; something other than those soldiers ObjectReference rPlaced3 = None ; ---- pick the soldier here ---- iButton = MessageAnimals.Show() If(iButton == 0) Return ; 0 would make a handy "cancel" button ElseIf(iButton == 1) rPlaced3 = Player.PlaceAtMe(Cat, 1) iCaps += 1000 ElseIf(iButton == 2) rPlaced3 = Player.PlaceAtMe(Dog, 1) iCaps += 1000 ElseIf(iButton == 3) rPlaced3 = Player.PlaceAtMe(AnimCatA, 1) iCaps += 1000 ElseIf(iButton == 4) rPlaced3 = Player.PlaceAtMe(AnimDogA, 1) iCaps += 1000 ElseIf(iButton == 5) rPlaced3 = Player.PlaceAtMe(AnimGroup, 3) iCaps += 1000 ElseIf(iButton == 6) rPlaced3 = Player.PlaceAtMe(AnimArmoredGroup, 3) iCaps += 1000 EndIf ElseIf(iButton == 4) ; something other than those soldiers ObjectReference rPlaced4 = None ; ---- pick the soldier here ---- iButton = MessageVertibird.Show() If(iButton == 0) Return ; 0 would make a handy "cancel" button ElseIf(iButton == 1) rPlaced4 = Player.PlaceAtMe(Cat, 1) iCaps += 1000 ElseIf(iButton == 2) rPlaced4 = Player.PlaceAtMe(Dog, 1) iCaps += 1000 ElseIf(iButton == 3) rPlaced4 = Player.PlaceAtMe(AnimCatA, 1) iCaps += 1000 ElseIf(iButton == 4) rPlaced4 = Player.PlaceAtMe(AnimDogA, 1) iCaps += 1000 ElseIf(iButton == 5) rPlaced4 = Player.PlaceAtMe(AnimGroup, 3) iCaps += 1000 ElseIf(iButton == 6) rPlaced4 = Player.PlaceAtMe(AnimArmoredGroup, 3) iCaps += 1000 EndIf ElseIf(iButton == 5) ; something other than those soldiers ; ---- pick the soldier here ---- iButton = MessageAbilities.Show() If(iButton == 0) Return ; 0 would make a handy "cancel" button ElseIf(iButton == 1) SoldiersRecruited.Mod(6) ElseIf(iButton == 2) Player.AddSpell(Recruit) Player.AddSpell(Dismiss) ElseIf(iButton == 3) Player.Additem(Flare, 10) EndIf Player.RemoveItem(Caps, iCaps, False) ; remove whole price at the end Player.RemoveItem(CommandRadio, 1) Player.AddItem(CommandRadio, 1) EndIf EndFunction Yeah I decided to use your formatting as it is a lot easier to work with :D lol Edited May 28, 2016 by Karel2015 Link to comment Share on other sites More sharing options...
Karel2015 Posted May 29, 2016 Author Share Posted May 29, 2016 I've also tried this with no avail: ; ---- soldier pick over ---- Utility.Wait(0.5) ; wait a little maybe? ; ---- pick weapon ---- iButton = MessageWeapons.Show() ; move on to weapon picking If(iButton == 0) Return ElseIf(iButton == 1) rPlaced.AddItem(WeaponHeavy, 1) (rPlaced as Actor).EquipItem(WeaponHeavy) Utility.Wait(0.5) iCaps += 800 ElseIf(iButton == 2) rPlaced.AddItem(WeaponAutomatic, 1) (rPlaced as Actor).EquipItem(WeaponAutomatic) Utility.Wait(0.5) iCaps += 800 ElseIf(iButton == 3) rPlaced.AddItem(WeaponShotgun, 1) (rPlaced as Actor).EquipItem(WeaponShotgun) Utility.Wait(0.5) iCaps += 800 ElseIf(iButton == 4) rPlaced.AddItem(WeaponMelee, 1) (rPlaced as Actor).EquipItem(WeaponMelee) Utility.Wait(0.5) iCaps += 800 EndIf ; ---- weapon pick over ---- Utility.Wait(0.5) ; --- pick outfit --- iButton = MessageOutfits.Show() If(iButton == 0) Return ElseIf(iButton == 1) rPlaced.AddItem(OutfitHeavy, 1) (rPlaced as Actor).EquipItem(OutfitHeavy) Utility.Wait(0.5) iCaps += 500 ElseIf(iButton == 2) rPlaced.AddItem(OutfitMedium, 1) (rPlaced as Actor).EquipItem(OutfitMedium) Utility.Wait(0.5) iCaps += 500 ElseIf(iButton == 3) rPlaced.AddItem(OutfitLight, 1) (rPlaced as Actor).EquipItem(OutfitLight) Utility.Wait(0.5) iCaps += 500 EndIf Link to comment Share on other sites More sharing options...
Surilindur Posted May 29, 2016 Share Posted May 29, 2016 Now that is tricky. EquipItem is a member of Actor script, and I have no idea how you can cast an ObjectReference as Actor. You can cast an Actor as ObjectReference, though, but I am not sure if it works the other way round. If you want to equip items, you need to somehow get an Actor out of the ObjectReference, and I have no idea how you can do that if simple casting fails. :P Maybe the wiki has something useful, because I have never done it that way. Link to comment Share on other sites More sharing options...
Reneer Posted May 29, 2016 Share Posted May 29, 2016 The issue I noticed was that you are using PlaceAtMe instead of PlaceActorAtMe(ActorBase akActorToPlace, int aiLevelMod = 4, EncounterZone akZone = None). PlaceAtMe returns an Objectreference while PlaceActorAtMe returns an Actor. So if you simply change all your PlaceAtMe calls to PlaceActorAtMe calls, everything should work. Link to comment Share on other sites More sharing options...
Surilindur Posted May 29, 2016 Share Posted May 29, 2016 Exactly what Reneer said, I completely forgot there was that one. Silly me. Thank you, Reneer. :blush: http://www.creationkit.com/fallout4/index.php?title=PlaceActorAtMe_-_ObjectReference Link to comment Share on other sites More sharing options...
Reneer Posted May 29, 2016 Share Posted May 29, 2016 Exactly what Reneer said, I completely forgot there was that one. Silly me. Thank you, Reneer. :blush: http://www.creationkit.com/fallout4/index.php?title=PlaceActorAtMe_-_ObjectReferenceNo problem, happy to help. :) Link to comment Share on other sites More sharing options...
Karel2015 Posted May 29, 2016 Author Share Posted May 29, 2016 (edited) That's what this is for: ObjectReference rPlaced = None rPlaced.AddItem(WeaponHeavy, 1) (rPlaced as Actor).EquipItem(WeaponHeavy) \\Problem is the script is an ObjectReference Extension, So it won't let me use many of the Actor Functions\\ I actually figured out the problem, I'm a dope lmao. I was linking in the outfits / weapons as Leveled Items lists, which won't work properly with EquipItem, Converting them to individual Weapon / Armor references seems to solved the problem for now. Edited May 29, 2016 by Karel2015 Link to comment Share on other sites More sharing options...
Recommended Posts