Forum

> > CS2D > Scripts > Sound on equip for all or ?
Forums overviewCS2D overview Scripts overviewLog in to reply

English Sound on equip for all or ?

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

old Re: Sound on equip for all or ?

Alistaire
User Off Offline

Quote
user Rainoth has written
Nvm. I learned the timers myself. Still need to make some simple hook/function that isn't long to strip players armor. Most understandable way is probably best..


So you find 1 millisecond too long?

-

Also, you should addhook('walkover', 'AA_walkover'), just noticed.

old Re: Sound on equip for all or ?

Rainoth
Moderator Off Offline

Quote
user Alistaire has written
Also, you should addhook('walkover', 'AA_walkover'), just noticed.


Not the milisecond but the whole code.
And this is what probably made me confused. I'll try to understand what parts of your code mean what.

old Re: Sound on equip for all or ?

Alistaire
User Off Offline

Quote
user Rainoth has written
And this is what probably made me confused. I'll try to understand what parts of your code mean what.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
addhook('walkover', 'AA_walkover')

//call armoursound(id) /after/ your equip stuff in prolly the move hook
function AA_armoursound(id)
	//save current armour
	local prev = player(id, 'armor')

	//set armour to another one
	parse('setarmor '..id..' 201')

	//set it back to the previous one (prev)
	parse('setarmor '..id..' '..prev)
end

//Checks whether the player has the script's armour
function AA_checkarmour(id)
	//if the armourtable[id] exists 
	if armourtable[id] > 0 then

		//return 1 (true)
		return 1;
	//if the player /doesn't/ wear script armour
	else

		//return 0 (false)
		return 0;
	end
end

function AA_walkover(id, iid)
	//if the item you walk over is an armour (those iid's are armours)
	if iid == 57 or iid == 58 or (iid >= 79 and iid <= 84) then

		//check for armour. If there's script armour, return 1 (leave stuff on ground)
		return AA_checkarmour(id);
	end
end

old Re: Sound on equip for all or ?

Deleted User

Quote
user Alistaire has written
user Infinite Rain has written
@user Alistaire:
Aren't the '--' supposed to be comments?


Sorry I'm learning Java and // is a comment there.
Lol, yeah, I once even used [] as a table assigner after learning the BlitzMax.

ok, I'm going to stop off topic.

old Re: Sound on equip for all or ?

Rainoth
Moderator Off Offline

Quote
The part I don't understand is "armourtable" Do I have to make something like that or I just put in variables of my armors powers ? (like "ice","flash","health" etc etc.)

So I should make lots of IFs ?
1
2
3
if ice[id] > 0 then
if flash[id] > 0 then
if health[id] > 0 then
And on and on till it checks if I have any kind of special armor ? Also. If player has any special armor he won't equip stealth suit/kevlar & helm or he won't equip it at all (even if he doesn't have any armor) ?

Edit : I'll mark this as unread cause I don't really want to make another post (or I should ?). Anyway I'll know for the future. What I want is to know if it's possible to check if player has weapons. Not just in hand but like at all.
What I have in mind is to show image if player has a weapon and show another if he doesn't but I don't know what word checks if player has any weapons cause I'm sure "weapon" stands for a weapon that player is holding at the moment..
edited 1×, last 07.03.13 03:32:28 pm

old Re: Sound on equip for all or ?

Alistaire
User Off Offline

Quote
user Rainoth has written
Edit : I'll mark this as unread cause I don't really want to make another post (or I should ?). Anyway I'll know for the future. What I want is to know if it's possible to check if player has weapons. Not just in hand but like at all.
What I have in mind is to show image if player has a weapon and show another if he doesn't but I don't know what word checks if player has any weapons cause I'm sure "weapon" stands for a weapon that player is holding at the moment..


1
2
3
4
5
6
7
local a = playerweapons(id)

if a[2] then
	--your image for a player with weapon
else
	--"" "" "" "" "" "" without weapon
end

I don't know anything about your code and you're really unspecific, so this might work.

old Re: Sound on equip for all or ?

Rainoth
Moderator Off Offline

Quote
user Alistaire has written
1
2
3
4
5
6
7
local a = playerweapons(id)

if a[2] then
	--your image for a player with weapon
else
	--"" "" "" "" "" "" without weapon
end

I don't know anything about your code and you're really unspecific, so this might work.


Tried to be as specific as possible
Anyways. is this correct ?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
local a = playerweapons(id)
if a[2] then
for i=1,32,1 do
id=image("gfx/sprites/text.bmp",0,0,100+i)
imagecolor(id,255,255,255)
imageblend(id,1)
imagealpha(id,1)
else
"53" "50" "other weapon id.."
id=image("gfx/sprites/text2.bmp",0,0,100+i)
imagecolor(id,255,255,255)
imageblend(id,1)
imagealpha(id,1)
	--"" "" "" "" "" "" without weapon
end
end
Don't know how to use images so I took this from sample >.< This is probably quite messed up since you probably didn't understand what I meant (sorry for that)

Should there be "freeimage" somewhere or not ?
Also it should have second hook If I'm correct so it would update whenever player gets a weapon or loses it..

old Re: Sound on equip for all or ?

Alistaire
User Off Offline

Quote
user Rainoth has written
Tried to be as specific as possible
Anyways. is this correct ?


Dude that's the worst code for images I've ever seen. Remove all the rgb and opacity crap, that's meant for when you actually want to change something about the image.
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview