English Lua Scripts/Questions/Help

89 replies
Goto Page
To the start Previous 1 2 3 4 5 Next To the start
29.08.11 10:32:33 am
Up
Vectarrio
User
Offline Off
user Loooser has written:
is there a way to make a ai/bot hud position a weapon?

you can set weapon_x and weapon_y and weapon_position in the AI script, though bot can be cheater with that (cause that's manipulating with weapon's script!)
29.08.11 10:58:01 am
Up
Loooser
User
Offline Off
thx vectar
IMG:http://i45.tinypic.com/saus1e.jpg
29.08.11 03:07:25 pm
Up
Vectarrio
User
Offline Off
anyway, for that you should check some collisions, 'cuz I made bot set turrets, and that bot puts it into a wall outside radius! (that's possible for A.I. cuz they can change wpn variables, as I said in previous post)
29.08.11 03:53:51 pm
Up
Loooser
User
Offline Off
good to know
IMG:http://i45.tinypic.com/saus1e.jpg
24.09.11 10:36:54 pm
Up
Nemesis
User
Offline Off
How to get how many players alive atm ?
i tried
Code:
1
tostring(playertable(0.0))

but failed
Havent worked with tables yet.
24.09.11 10:45:58 pm
Up
Loooser
User
Offline Off
It should work like that

Code:
1
numberoflivingplayers=#playertable(0,1)
the variable numberoflivingplayers is the number of players
IMG:http://i45.tinypic.com/saus1e.jpg
25.09.11 12:58:16 am
Up
DC
Admin
Offline Off
http://www.carnagecontest.com/help_cmds.php?cat=player#cmd_playertable

nearly correct, just wrong parameters. second (include dead players) must be 0 of course.
Code:
1
numberoflivingplayers=#playertable(0,0)
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
25.09.11 08:04:56 am
Up
Nemesis
User
Offline Off
I messed with that variable yesterday, but i thought its wrong because of an error.
Thanks. Now iam coming back to n++ and CC
28.10.11 06:59:54 pm
Up
Unknown_Soldier
User
Offline Off
To avoid creating another thread, I want to request something here, someone knows how to make a simple vertical laser moving to the right (always the same speed), that appears on x=0 when the player x<50? instant kill the player on contact (yes, it's for a mission)
Should I come back and make one last map for CS2D?
28.10.11 07:24:28 pm
Up
Loooser
User
Offline Off
have a look at the original laser.lua
IMG:http://i45.tinypic.com/saus1e.jpg
30.10.11 08:29:43 am
Up
Nemesis
User
Offline Off
How can i check if nubmer can divide to 50 and be integer, i mean like "5" not "5.2147535" ?

EDIT:
woops, nevermind, Wikipedia ftw, lol.
I found answer in that russian page http://en.wikipedia.org/wiki/Modulo_operation english have answer too.
I didnt have idea to found it there o-o'
30.10.11 08:39:25 am
Up
Vectarrio
User
Offline Off
@user Nemesis:
value mod 50

edit: I didn't see you edited your post
30.01.12 02:26:46 pm
Up
VADemon
User
Offline Off
Spoiler >

Found it, thanks
edited 1×, last 30.01.12 02:39:49 pm
14.04.13 01:29:50 pm
Up
Nemesis
User
Offline Off
Can anyone please give me an expample of object which will fall down with constant speed for mission? Cant make "sy" work

P.S. Attention! The last action in this thread happened 434 days ago. Please do only answer if it still makes sense!


P.S.S. What? Cooldown is higher then 200!
14.04.13 04:22:57 pm
Up
DC
Admin
Offline Off
Why don't you just modify an object script like the shield generator ? It doesn't fall with constant speed but it should be quite easy to adjust that.
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
08.07.13 12:27:53 am
Up
Nemesis
User
Offline Off
It's me again (lol)
Can anyone help me please?
For example, i have image1.png...image8.png, how can i make them be "animated" like it's image1.png and next second its image2.png and so until image8.png?
I thought about timer and array, but i do not know how to make and operate array, so i'll try something with timer for a while.
Any help will be appreciated with cookies

Edit: Lurkin' in PM folder gave me a little help, 01.10.11 when user Holzchopf gave me a lesson about arrays, so i now have a picture in my mind how to realize it using array and a timer. (maybe)
P.S. Damn, im so stupid in lua

Edit2: Well, i figured out that i dont need an array

Edit3: I figured out how to do it, but when it goes to certain frame it goes wild like shit and look stupid I mean it goes a bit offset, whats the problem? Maybe i should use BMP instead of PNG?
edited 4×, last 08.07.13 01:16:12 am
08.07.13 01:24:00 am
Up
DC
Admin
Offline Off
user Holzchopf's file cc Nyan Cat (27) uses animation. Take a look at this. It's now included in CC by default so you don't even have to download ot. Or also the original rat / hitler / osama / santa scripts (but those all have just 2 frames)
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
08.07.13 01:37:44 am
Up
Nemesis
User
Offline Off
user DC has written:
user Holzchopf's file cc Nyan Cat (27) uses animation. Take a look at this. It's now included in CC by default so you don't even have to download ot. Or also the original rat / hitler / osama / santa scripts (but those all have just 2 frames)

Why didnt i thought of this...i like the way he did it with "for" (just dont know how is this called in english, lol >_>) but i already managed to make one with timer and its pretty cool
By the way thanks for responding \o/
Here you go: cookies
P.S. I also figured the reason why it gone wild like shit, it wasn't smooth enough, i simply multiplied timer by 2 and added math.ceil. Goddamn thing works perfectly.
P.S.S. Sorry for posting before trying to solve, my bad

30.01.14 EDIT:
Well, it's me again, and again there is something that makes my brain hurt because i don't know how to solve that.
Is there any way to make object act like foreground image? I mean image would not collide in any known way with player. I tried cc cmd collision, but it just wont work the way i wanted - player get stuck in object even with player ignore.
And the second question, how to make that object "see" player only when there is no map between them?
edited 1×, last 30.01.14 08:46:07 pm
31.01.14 03:41:14 pm
Up
DC
Admin
Offline Off
You can only create an object which doesn't collide with anything at all by setting no collision image in cc cmd addobject.

Having an object which doesn't collide with players but does collide with other stuff is actually not possible I guess. Maybe with a tricky hack but I can't think of one. Of course you can still react to collisions by using the cc cmd collision command but you can't make projectiles etc. collide with it as if there was a rigid collision object (at least not in a universal and clean way).

For the seeing stuff: Take a look at the script of the sentry gun. It only shoots if there is no terrain between it and the player it aims at. It's basically a loop with a cc cmd collision command in it. But be aware that such checks are slow. You shouldn't perform them too often.
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
02.03.14 07:42:02 pm
Up
Nemesis
User
Offline Off
http://www.carnagecontest.com/help_missions.php
Quote:
5 is the amount for this weapon. It must be 0-99. Don't specify this value if you want an infinite amount (which is the default). Note that you always have to specify a cooldown if you want to specify an amount as well (otherwise Carnage Contest will think that your amount is the value for the cooldown)

Why just 99? ._.
If there any solution for this if i actually need 1000?
So i need to write custom script for ammo and check it instead of using that one?
To the start Previous 1 2 3 4 5 Next To the start