Data Realms Fan Forums
http://forums.datarealms.com/

How To Make This ???
http://forums.datarealms.com/viewtopic.php?f=1&t=18633
Page 1 of 1

Author:  MrC121989 [ Thu Apr 29, 2010 8:31 pm ]
Post subject:  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 ?

Author:  lafe [ Thu Apr 29, 2010 9:18 pm ]
Post subject:  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.
Attachment:
ADD2INVENTORY.rar [278 Bytes]
Downloaded 336 times

just extract and add to your crate.
please give me some credit when you release this

Author:  CCnewplayer [ Thu Apr 29, 2010 9:43 pm ]
Post subject:  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.

Author:  MrC121989 [ Thu Apr 29, 2010 9:44 pm ]
Post subject:  Re: How To Make This ???

Yes i know how to attach scripts, thx guys.

Author:  TorrentHKU [ Thu Apr 29, 2010 9:52 pm ]
Post subject:  Re: How To Make This ???

CCnewplayer wrote:
ScriptPath:MyMod.rte/LuaFile.lua

Fatal problem. It should be
Code:
ScriptPath = MyMod.rte/LuaFile.lua

Author:  CCnewplayer [ Thu Apr 29, 2010 9:59 pm ]
Post subject:  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


:P sorry forgot this.

Author:  MrC121989 [ Thu Apr 29, 2010 10:15 pm ]
Post subject:  Re: How To Make This ???

Sorry to bother you, but the script is broken :P
Everything starts without problems, but the crate is empty.
I even tried to attach it without changing anything in the script, still dont work.

Author:  maart3n [ Fri Apr 30, 2010 12:13 am ]
Post subject:  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.

Author:  MrC121989 [ Fri Apr 30, 2010 12:34 am ]
Post subject:  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.

Author:  CCnewplayer [ Fri Apr 30, 2010 12:54 am ]
Post subject:  Re: How To Make This ???

CC never let me attach lua scripts in vanilla guys. :sad:

Author:  lafe [ Fri Apr 30, 2010 1:20 am ]
Post subject:  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

Author:  MrC121989 [ Fri Apr 30, 2010 8:42 am ]
Post subject:  Re: How To Make This ???

Everything works fine now, thx Lafe.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/