Author |
Message |
MrC121989
Joined: Wed Feb 10, 2010 12:41 pm Posts: 182 Location: OMG where am i ?
|
How To Make This ???
Hello, i'm new here. Anyways. I'm making a mod for CC, i've done majority of it but i need help making something. What i'm trying to do is make a dropcrate when landed gives one random weapon from preset of weapons that i added to crates cargo. I know how to add guns in crates cargo: AddInventory = HDFirearm CopyOf = Pistol GoldValue = 0 AddInventory = HDFirearm CopyOf = Rifle GoldValue = 0 But is there a way to make only one randomly choosen to drop out of the crate ?
|
Thu Apr 29, 2010 8:31 pm |
|
|
lafe
Joined: Sat Mar 28, 2009 2:33 pm Posts: 718
|
Re: How To Make This ???
MrC121989 wrote: Hello, i'm new here. Anyways. I'm making a mod for CC, i've done majority of it but i need help making something. What i'm trying to do is make a dropcrate when landed gives one random weapon from preset of weapons that i added to crates cargo. I know how to add guns in crates cargo: AddInventory = HDFirearm CopyOf = Pistol GoldValue = 0 AddInventory = HDFirearm CopyOf = Rifle GoldValue = 0 But is there a way to make only one randomly choosen to drop out of the crate ? hello and welcome to the forum ahh, this, my freind, would require some [simple] lua. just extract and add to your crate. please give me some credit when you release this
|
Thu Apr 29, 2010 9:18 pm |
|
|
CCnewplayer
Joined: Wed Feb 24, 2010 11:00 pm Posts: 255 Location: Unknow
|
Re: How To Make This ???
Welcome , you need to attach lafe's lua file with crate , just write this:
ScriptPath:MyMod.rte/LuaFile.lua
you can attach this below the description.
|
Thu Apr 29, 2010 9:43 pm |
|
|
MrC121989
Joined: Wed Feb 10, 2010 12:41 pm Posts: 182 Location: OMG where am i ?
|
Re: How To Make This ???
Yes i know how to attach scripts, thx guys.
|
Thu Apr 29, 2010 9:44 pm |
|
|
TorrentHKU
Loose Canon
Joined: Sun Mar 29, 2009 11:07 pm Posts: 2992 Location: --------------->
|
Re: How To Make This ???
CCnewplayer wrote: ScriptPath:MyMod.rte/LuaFile.lua Fatal problem. It should be Code: ScriptPath = MyMod.rte/LuaFile.lua
|
Thu Apr 29, 2010 9:52 pm |
|
|
CCnewplayer
Joined: Wed Feb 24, 2010 11:00 pm Posts: 255 Location: Unknow
|
Re: How To Make This ???
Hyperkultra wrote: CCnewplayer wrote: ScriptPath:MyMod.rte/LuaFile.lua Fatal problem. It should be Code: ScriptPath = MyMod.rte/LuaFile.lua sorry forgot this.
|
Thu Apr 29, 2010 9:59 pm |
|
|
MrC121989
Joined: Wed Feb 10, 2010 12:41 pm Posts: 182 Location: OMG where am i ?
|
Re: How To Make This ???
Sorry to bother you, but the script is broken Everything starts without problems, but the crate is empty. I even tried to attach it without changing anything in the script, still dont work.
|
Thu Apr 29, 2010 10:15 pm |
|
|
maart3n
Joined: Tue Dec 23, 2008 8:04 pm Posts: 1545
|
Re: How To Make This ???
But lafe's script only works with the coalition shotgun, auto pistol and auto shotgun.
Otherwise I can't see why it would be broken.
|
Fri Apr 30, 2010 12:13 am |
|
|
MrC121989
Joined: Wed Feb 10, 2010 12:41 pm Posts: 182 Location: OMG where am i ?
|
Re: How To Make This ???
Like i said i tried to change weapons and module in script to one from my mod it didnt worked, then i tried to leave it as it is, still no effect. Theres must be something wrong. Why i think the problem is in script is because if i did something wrong in my crate.ini file, game would probably crash on loading screen. I know little to nothing about lua scripting, hope someone who have experiance with it can sort it out soon. Theres probably some little mistake that Lafe made when he was typing the script.
|
Fri Apr 30, 2010 12:34 am |
|
|
CCnewplayer
Joined: Wed Feb 24, 2010 11:00 pm Posts: 255 Location: Unknow
|
Re: How To Make This ???
CC never let me attach lua scripts in vanilla guys.
|
Fri Apr 30, 2010 12:54 am |
|
|
lafe
Joined: Sat Mar 28, 2009 2:33 pm Posts: 718
|
Re: How To Make This ???
yeah, its probably the script. i forgot to mention that it was highly untested. here, ill try to fix it.
edit; replace the lua code with this.
function Create(self) if self.Health > 0 then --List of things to add self.WepS = { "Auto Pistol", "Shotgun", "Auto Shotgun" }; --add a object from the list self:AddInventoryItem(CreateHDFirearm(self.WepS[math.random(#self.WepS)],"Coalition.rte")); end end
|
Fri Apr 30, 2010 1:20 am |
|
|
MrC121989
Joined: Wed Feb 10, 2010 12:41 pm Posts: 182 Location: OMG where am i ?
|
Re: How To Make This ???
Everything works fine now, thx Lafe.
|
Fri Apr 30, 2010 8:42 am |
|
|
|