View unanswered posts | View active topics It is currently Tue Apr 23, 2024 6:54 pm



Reply to topic  [ 12 posts ] 
 How To Make This ??? 
Author Message
User avatar

Joined: Wed Feb 10, 2010 12:41 pm
Posts: 182
Location: OMG where am i ?
Reply with quote
Post 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
Profile
User avatar

Joined: Sat Mar 28, 2009 2:33 pm
Posts: 718
Reply with quote
Post 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 333 times

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


Thu Apr 29, 2010 9:18 pm
Profile
User avatar

Joined: Wed Feb 24, 2010 11:00 pm
Posts: 255
Location: Unknow
Reply with quote
Post 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
Profile
User avatar

Joined: Wed Feb 10, 2010 12:41 pm
Posts: 182
Location: OMG where am i ?
Reply with quote
Post Re: How To Make This ???
Yes i know how to attach scripts, thx guys.


Thu Apr 29, 2010 9:44 pm
Profile
Loose Canon
User avatar

Joined: Sun Mar 29, 2009 11:07 pm
Posts: 2992
Location: --------------->
Reply with quote
Post 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
Profile WWW
User avatar

Joined: Wed Feb 24, 2010 11:00 pm
Posts: 255
Location: Unknow
Reply with quote
Post 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.


Thu Apr 29, 2010 9:59 pm
Profile
User avatar

Joined: Wed Feb 10, 2010 12:41 pm
Posts: 182
Location: OMG where am i ?
Reply with quote
Post 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.


Thu Apr 29, 2010 10:15 pm
Profile
User avatar

Joined: Tue Dec 23, 2008 8:04 pm
Posts: 1545
Reply with quote
Post 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
Profile
User avatar

Joined: Wed Feb 10, 2010 12:41 pm
Posts: 182
Location: OMG where am i ?
Reply with quote
Post 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
Profile
User avatar

Joined: Wed Feb 24, 2010 11:00 pm
Posts: 255
Location: Unknow
Reply with quote
Post Re: How To Make This ???
CC never let me attach lua scripts in vanilla guys. :sad:


Fri Apr 30, 2010 12:54 am
Profile
User avatar

Joined: Sat Mar 28, 2009 2:33 pm
Posts: 718
Reply with quote
Post 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
Profile
User avatar

Joined: Wed Feb 10, 2010 12:41 pm
Posts: 182
Location: OMG where am i ?
Reply with quote
Post Re: How To Make This ???
Everything works fine now, thx Lafe.


Fri Apr 30, 2010 8:42 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 12 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.061s | 18 Queries | GZIP : Off ]