Forum

> > CS2D > Scripts > Throwing Machete Script
Forums overviewCS2D overview Scripts overviewLog in to reply

English Throwing Machete Script

34 replies
Page
To the start Previous 1 2 Next To the start

old Throwing Machete Script

JJ5x5
User Off Offline

Quote
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!

old Re: Throwing Machete Script

SRAN
User Off Offline

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

old Re: Throwing Machete Script

DannyDeth
User Off Offline

Quote
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.

old Re: Throwing Machete Script

JJ5x5
User Off Offline

Quote
DannyDeth has written
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

old Re: Throwing Machete Script

EngiN33R
Moderator Off Offline

Quote
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.

old Re: Throwing Machete Script

BrahOrkah
BANNED Off Offline

Quote
DannyDeth has written
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..

old Re: Throwing Machete Script

DannyDeth
User Off Offline

Quote
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.

old Re: Throwing Machete Script

EngiN33R
Moderator Off Offline

Quote
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 >

old Re: Throwing Machete Script

DannyDeth
User Off Offline

Quote
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:
More >


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.
edited 2×, last 08.04.11 01:59:40 pm

old Re: Throwing Machete Script

EngiN33R
Moderator Off Offline

Quote
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...

old Re: Throwing Machete Script

DannyDeth
User Off Offline

Quote
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.

old Re: Throwing Machete Script

JJ5x5
User Off Offline

Quote
DannyDeth has written
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:
More >


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.

old Re: Throwing Machete Script

BrahOrkah
BANNED Off Offline

Quote
My approach to it:

Spoiler >


copy and paste into server.lua
might edit and work with tween_move
edited 2×, last 12.04.11 01:41:11 pm
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview