Forum

> > CS2D > Scripts > Throwing Machete Script
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Throwing Machete Script

34 Antworten
Seite
Zum Anfang Vorherige 1 2 Nächste Zum Anfang

alt Throwing Machete Script

JJ5x5
User Off Offline

Zitieren
Hi, Can some one make a script where you can throw the machete and it will still kill as in like you click the mouse button when your machete is selected and it will throw a DECAL or a picture of a machete that gives a one hit kill like the machete does in meele mode

i was intrested in this because i saw a m achete you can throw in a hero server
so if anyone can make a nice one i will give you full credit in my upcoming server for the machete and maybe even admin

who ever can make a script like this that works and is great
i will give you admin in my server and even acookie

jut give me your us ID•


THANKS!

alt Re: Throwing Machete Script

SRAN
User Off Offline

Zitieren
throwing machete that looks impossible, maybe some kind of he or molotov reskinned into machete so if anybody hits it he dies

alt Re: Throwing Machete Script

DannyDeth
User Off Offline

Zitieren
No, it's possible, Mephiles.
I don't have the time to write the script but here is some theory code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
on mouse-click: {
	if player's weapon is machete: {
		strip player's machete;
		call the function 'throw_machete';
		}
}
function 'throw_machete': {
	variable rot = player's rotation
	for i=1,max amount players {
		varaible distance = distance between throwing player and player who's ID is i
		other_distance = distance between (x: cos(rot)*distance | y: sin(rot)*distance )
		if other_distance < 16 {
			damage player(i)
		}
	}
}
EDIT: And dont think this is Lua. You have to code it yourself. That code it just theory code to show you how to detect a hit. you have to figure out how to draw the machete yourself and then implement all of that code into Lua.

alt Re: Throwing Machete Script

JJ5x5
User Off Offline

Zitieren
DannyDeth hat geschrieben
No, it's possible, Mephiles.
I don't have the time to write the script but here is some theory code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
on mouse-click: {
	if player's weapon is machete: {
		strip player's machete;
		call the function 'throw_machete';
		}
}
function 'throw_machete': {
	variable rot = player's rotation
	for i=1,max amount players {
		varaible distance = distance between throwing player and player who's ID is i
		other_distance = distance between (x: cos(rot)*distance | y: sin(rot)*distance )
		if other_distance < 16 {
			damage player(i)
		}
	}
}
EDIT: And dont think this is Lua. You have to code it yourself. That code it just theory code to show you how to detect a hit. you have to figure out how to draw the machete yourself and then implement all of that code into Lua.
hmm ill try im not that good in making scripts though
well i saw a part of classic super hero witch HAS a throwing machete script but i dont htink its the full script

#addhero : #name = Tarzan : #point = 5 : #level = 10 : #info = Flying Machete : #throw_weapon = sh_machete.png ~ 69 ~ 20 ~ 0 ~ 1 ~ 1 : #item = 69 : #spwn_info =©128128255[INFO] Tarzan - Ability To Throw Machete

alt Re: Throwing Machete Script

EngiN33R
Moderator Off Offline

Zitieren
Well I got working on this, but there's only one thing I lack to complete it - a function to check image position. If someone could write it, I'll be very grateful and I'll complete this script.

alt Re: Throwing Machete Script

BrahOrkah
BANNED Off Offline

Zitieren
DannyDeth hat geschrieben
You don't need the person's cursor position, if you read the theory code above you will see it is dead simple.


Ofcourse you need it. If you want it to land on a certain position that is..

alt Re: Throwing Machete Script

DannyDeth
User Off Offline

Zitieren
Well, think about it.
If you threw a blade, roughly 3KGs in mass, do you think it would land where you originally wanted it to? No. It wouldn't.

alt Re: Throwing Machete Script

EngiN33R
Moderator Off Offline

Zitieren
This throws an image and rotates it perfectly, but doesn't kill - for that I need a function to return an image's position. I tried to make it but unsuccessfully.
Spoiler >

alt Re: Throwing Machete Script

DannyDeth
User Off Offline

Zitieren
You wrote all that code for such a small thing?
Wow.
Let me write some code ( which will literally be half the amount of lines ), I will edit this post with the code in 10-20 minutes.

EDIT:
Mehr >


If there are any bugs, tell me.

EDIT2: And, btw, for those scripters who are wondering why the script looks like what it looks like, it is because I'm using a function from object-orientated programming known inheritance.
2× editiert, zuletzt 08.04.11 13:59:40

alt Re: Throwing Machete Script

EngiN33R
Moderator Off Offline

Zitieren
Oh no please not this I cannot into OOP
EDIT1: Wait, if you set "iid" in the table, how come you call self:iid? I think you should remove the quotes in your code...

alt Re: Throwing Machete Script

DannyDeth
User Off Offline

Zitieren
iid is not set in the table. It is shown to *EXIST*, nothing more.

I do not call iid, anyway. it is used as a variable to sotre the image Id so that I can move/rotate at will.

alt Re: Throwing Machete Script

JJ5x5
User Off Offline

Zitieren
DannyDeth hat geschrieben
You wrote all that code for such a small thing?
Wow.
Let me write some code ( which will literally be half the amount of lines ), I will edit this post with the code in 10-20 minutes.

EDIT:
Mehr >


If there are any bugs, tell me.

EDIT2: And, btw, for those scripters who are wondering why the script looks like what it looks like, it is because I'm using a function from object-orientated programming known inheritance.
sorry but i know this sounds noobish but how do i get this to work i placed the do file thing but i dont know what else to put to make it work.

alt Re: Throwing Machete Script

BrahOrkah
BANNED Off Offline

Zitieren
My approach to it:

Spoiler >


copy and paste into server.lua
might edit and work with tween_move
2× editiert, zuletzt 12.04.11 13:41:11
Zum Anfang Vorherige 1 2 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht