Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Lua Scripts/Questions/Help

6.770 Antworten
Seite
Zum Anfang Vorherige 1 276 77 78338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Zitieren
the second thing can't work and doesn't make sense. the hooks don't even pass the same parameters to the function etc. moreover Lua does not allow to define functions that way afaik.

you have to use some (global) variables to realize that idea.

for example you could create a table array with 32 entries (one for each player. have a look at the ut sounds sample). set the values to 0 at the beginning. you use this array for the timers/countdown!

when someone attacks you set the corresponding array field to 1. (which means: timer is active!)

the second hook checks all array fields. nothing happens if a field is 0 (inactive) but if it is >0 (=active) it will increase the field until it reaches the value 15. if it has reached 15 you set it to 0 again and equip the weapon.

OR you wait for the next release of CS2D which provides super useful timer functions. (no, I don't know when it will be released!)

alt Re: Lua Scripts/Questions/Help

KimKat
GAME BANNED Off Offline

Zitieren
mortyr22 hat geschrieben
i has error in need to give machete to all bots but i cant remove knive!
I know how to remove the knife, and then if it comes back at times I know how to remove it using one select hook and two spawn hooks.

This script is taken from my Star Wars 2D script, so you'll have to modify it a bit to your needs but it'll definitly fix the knife problem.
Link <

alt Re: Lua Scripts/Questions/Help

BetaM
User Off Offline

Zitieren
KimKat hat geschrieben
mortyr22 hat geschrieben
i has error in need to give machete to all bots but i cant remove knive!
I know how to remove the knife, and then if it comes back at times I know how to remove it using one select hook and two spawn hooks.


When the knife "comes back" it means that the game removes the normal knife, and replaces it with a copy that has no secondary attack, and it's icon is staying in a place. That happens in the always hook. (whe you select another weapon the replaced knife disappears until your next spawn.

alt Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Zitieren
the knife is automatically equipped to avoid that there are players without melee weapon. each player in cs2d always needs at least one melee weapon.

first equip the machete and afterwards strip the knife. however I'm not sure if this is going to work properly with bots.

alt Re: Lua Scripts/Questions/Help

KimKat
GAME BANNED Off Offline

Zitieren
Well I tried the script with bots and online and my script works properly, even though the script is not perfectly shaped in lua and my script could be developed into a shorter and lighter script (I don't have those skills).

My script removes knife at spawn and if you as player try to select the knife it strips it (if it happens to show up which it does at times).

My script is the solution on how to remove the knife although not completely. It's easier to remove the Machete from a player because it doesn't show up again.

alt Re: Lua Scripts/Questions/Help

NozliW
User Off Offline

Zitieren
is it possible to remove from the map a thrown gas grenade ?
@Anyone but mostly Blazzingxx
how to make menus (like shop or classes) that are unlockable ?

alt Re: Lua Scripts/Questions/Help

Heartless Soldier
User Off Offline

Zitieren
Hey im making a Left 4 Death mod where the Boomer's vomit is a flashbang. In l4d when a boomer vomits somebody, his name gets violet, but in cs2d i want to make something that when a boomer flash somebody his names change to [Blinded]XXX(the name).

Is it possible to make an action when somebody is flashed?

thanks and good luck

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
-WiLSoN- hat geschrieben
@CmDark
It is possible, Blazzingxx made it on his SH script,thats why my question goes mostly for him


You can make it using your brain and ifs in your script.

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
N-B-K hat geschrieben
Spoiler >

It's possible, I already make flashing damage script for ZP.
But it's not finished becouse you get hurt even behind wall.


@-WiLSoN-
Unlocking feature is easy, in SH 1.2 all unlocking takes about 10 lines.

@Adamexxo-FraG
Idea looks like that:
1
2
3
4
-- Menu for T
if (player(id,"team") == 1) then
	menu(p,menu_buttons)
end

alt Re: Lua Scripts/Questions/Help

Arne
User Off Offline

Zitieren
I was just wondering if you could make alua command that chose the way you looked after what class u choose
for example: If you choose Heavy you become seal team etc.
I would really appreciate any help

alt Re: Lua Scripts/Questions/Help

BetaM
User Off Offline

Zitieren
Can someone check if this is ok? I have no opportunity to test it (need at least 2 players).
Spoiler >

(I mean if challenger/challenging is really the id of the player, and not nil)

EDIT: Nevermind. It works.

alt Re: Lua Scripts/Questions/Help

Heartless Soldier
User Off Offline

Zitieren
Blazzingxx hat geschrieben
N-B-K hat geschrieben
Spoiler >

It's possible, I already make flashing damage script for ZP.
But it's not finished becouse you get hurt even behind wall.


@-WiLSoN-
Unlocking feature is easy, in SH 1.2 all unlocking takes about 10 lines.

@Adamexxo-FraG
Idea looks like that:
1
2
3
4
-- Menu for T
if (player(id,"team") == 1) then
	menu(p,menu_buttons)
end


First thank u for the function to remove files.
Second can u help me with the code? xDD, no problem if flashbangs hurt u behind wall, if u give me some code i will put your credits of course :D.


good luck

alt Re: Lua Scripts/Questions/Help

NozliW
User Off Offline

Zitieren
Can someone help me with this ?
Spoiler >

I want to make that when the player attacks it heals him and when hits a teammate it heals the teammate but when the weapon is shooted the weapon is striped and equiped after 15 seconds

alt Re: Lua Scripts/Questions/Help

playa slaya
COMMUNITY BANNED Off Offline

Zitieren
1
2
3
4
-- insted of "timer = 0" you need
timer = initArray(32)
-- and when you change/increase the value
timer[id]=1

alt Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Zitieren
A mod i made,

heres the link to the awesome video of the mod

=P

http://www.youtube.com/watch?v=rBrmQvEEvk4

if it says not processed yet(sorry)
Zum Anfang Vorherige 1 276 77 78338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht