English Lua Scripts/Questions/Help

89 replies
Goto Page
To the start Previous 1 2 3 4 5 Next To the start
02.03.14 08:07:48 pm
Up
DC
Admin
Offline Off
It's "just" 99 because you never need a higher amount under "normal" circumstances for a "normal" weapon (considering that normal weapons are only used max a few times per round and that a match normally doesn't have that many rounds). 99 is already a very high value which should never be required. So yes, you would somehow have to script your own counter if you need an even higher amount.

You may also reconsider how your weapon works (this would be the better and cleaner solution obviously!). Maybe you can give like 10 shots per use or something like that. Highly depends on the weapon and how it works of course.
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
02.03.14 08:12:43 pm
Up
Nem
User
Offline Off
user DC has written:
It's "just" 99 because you never need a higher amount under "normal" circumstances for a "normal" weapon (considering that normal weapons are only used max a few times per round and that a match normally doesn't have that many rounds). 99 is already a very high value which should never be required. So yes, you would somehow have to script your own counter if you need an even higher amount.

You may also reconsider how your weapon works (this would be the better and cleaner solution obviously!). Maybe you can give like 10 shots per use or something like that. Highly depends on the weapon and how it works of course.

Well yea, i guess so. Still, that would be better for thing that we doing right now.

Yep. I just wanted a machinegun with 200 ammo acting like normal one, so it wouldnt work for him the way it should.
Anyway, thanks for making this one clear
03.03.14 08:24:58 pm
Up
Lekken
User
Offline Off
Is it possible to write\read variables from a file? I used
Code:
1
local file = io.open("path/file", "w \ r")
in mission_start(), but got an error "attempt to call field 'open' (a nil value)".
04.03.14 12:44:25 pm
Up
DC
Admin
Offline Off
I don't recommend to perform any file IO operations in Carnage Contest scripts.
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
04.03.14 01:54:07 pm
Up
MikuAuahDark
User
Offline Off
user Lekken has written:
Is it possible to write\read variables from a file? I used
Code:
1
local file = io.open("path/file", "w \ r")
in mission_start(), but got an error "attempt to call field 'open' (a nil value)".


io libraries(and other like os, etc.) is disabled in Carnage Contest.
file cs2d LuaJIT for Dedicated Server (13) JIT POWER! | Know your Lua errors! | Part of LÖVE development team since 11.3
04.03.14 05:36:28 pm
Up
Avo
User
Offline Off
@user MikuAuahDark & user DC: Why & why?
Trust me, I'm an engineer | user DC approved file cs2d Super extra mod for CS2D (64), yeah!
04.03.14 05:45:03 pm
Up
Nem
User
Offline Off
user DC has written:
I don't recommend to perform any file IO operations in Carnage Contest scripts.

Why?
CS2D allows you to dofile, and even saving your data somewhere (was it in tibia?), why CC does not allow this?
It would really help to write/read to/from file. REALLY help.

user MikuAuahDark has written:
io libraries(and other like os, etc.) is disabled in Carnage Contest.

I'm afraid not. One of my script uses os.time thingy (Blazzing guy made it for me a really long time ago when i didnt know how to do timers) and it works, although DC said it wouldnt, or it is not recomended, really long time ago, so i do not properly remember.
04.03.14 06:04:22 pm
Up
Vectarrio
User
Offline Off
Changelog of version 0.0.2.5 explains it:
Quote:
CHANGED Lua IO functions disabled (potential security vulnerability)
CHANGED Lua OS.execute function disabled (potential security vulnerability)
04.03.14 06:06:52 pm
Up
DC
Admin
Offline Off
CS2D scripts are running on the server only and they are not transferred automatically (except for map scripts). CC scripts run everywhere. You could easily write and distribute CC weapons which completely destroy the entire system when they are loaded.
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
04.03.14 07:41:39 pm
Up
Nem
User
Offline Off
user DC has written:
CS2D scripts are running on the server only and they are not transferred automatically (except for map scripts). CC scripts run everywhere. You could easily write and distribute CC weapons which completely destroy the entire system when they are loaded.

So it is not possible in CC to store custom values in a file? (in-game variables resets after you close the game)
Maybe will allow to read and write file in mission folder only?

EDIT (2016.07.09): Is it possible to have a 'negative' effect on the screen?
I think CC doesnt have that ability ._.
edited 4×, last 09.07.16 12:44:00 pm
To the start Previous 1 2 3 4 5 Next To the start