Forum

> > CS2D > Scripts > my classes script |need help
Forums overviewCS2D overview Scripts overviewLog in to reply

English my classes script |need help

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

old my classes script |need help

boyzinthewoodz
User Off Offline

Quote
typea = 1
rota = 0

addhook("attack","npcyx")
function npcyx(id)

if (weapon==86) then
parse("spawnnpc "..typea.." "..x.." "..y.." "..rota)
end
end


sorry i am still a noob in lua.
what i did wrong =( ?
edited 1×, last 07.03.11 10:54:14 pm

old Re: my classes script |need help

boyzinthewoodz
User Off Offline

Quote
your right but they have to? well i added it. still dont work.
More >


after a gut bomb i want that there a npc (zombie) spawns

do i need to change "weapon" in "if (weapon==86) then"
? cuz somebody told me i cant use weapon for this.
i dont get error messages.

old Re: my classes script |need help

boyzinthewoodz
User Off Offline

Quote
More >


ok but still nothing.

i just wonder why this works and mine not >.>

More >

old Re: my classes script |need help

J4x
User Off Offline

Quote
@Mnm, because the sceond one has the parameter x and y, so they have a value, and you code i wrong, because when you use
1
player(id,"value")
you have to add " " to that value, so you code fixed will be:
1
2
3
4
5
6
7
8
9
typea = 1
rota = 0

addhook("attack","npcyx")
function npcyx(id)
     if (weapon==86) then
      parse("spawnnpc "..typea.." "..player(id,"tilex").." "..player(id,"tiley").." "..rota)
end
end
edited 1×, last 07.03.11 09:16:02 pm

old Re: my classes script |need help

boyzinthewoodz
User Off Offline

Quote
nothing works =(
More >

old Re: my classes script |need help

J4x
User Off Offline

Quote
Ok, then try this
1
2
3
4
5
6
addhook("projectile","npcyx")
function npcyx(id,weapon,x,y)
if weapon == 86 then
parse("spawnnpc 1 "..player(id,"x").." "..player(id,"y").." "..0)
end
end

old Re: my classes script |need help

Starkkz
Moderator Off Offline

Quote
god, that's something very easy to do..

1
2
3
4
5
6
addhook("projectile","npcyx")
function npcyx(id,weapon,x,y)
	if weapon == 86 then
		parse("spawnnpc 1 "..x.." "..y.." "..player(id,"rot"))
	end
end

You may not put "..0) when you're gonna put a number.. just put 0")

old Re: my classes script |need help

boyzinthewoodz
User Off Offline

Quote
linkin parks dont work and starkks i wrote this now:
More >


right?
because it dont work. i didnt get error message but npc still dont appear. but now i have i idea why it maybe dont work... i have gut bomb on 10000. i set it now on 0 and i try all your scripts again to see if 1 works. i think the gutbomb killed the zombie lol...
_______________________________________

well still dont work and if i use this
More >

i get ERROR: spawnobject - position is out of map bounds!
i get the same error when i use this
More >


nothing works. i thougt to spawn a npc after gut bomb is possible =(
edited 2×, last 07.03.11 10:11:35 pm

old Re: my classes script |need help

J4x
User Off Offline

Quote
Its possible, try with
1
2
3
4
5
6
7
8
addhook("projectile","npcyx")
function npcyx(id,weapon,x,y)
	local x = player(id,"x") +1
	local y = player(id,"y") +1
	if weapon == 86 then
parse("spawnnpc 1 "..x.." "..y.." 1")
end
end

old Re: my classes script |need help

boyzinthewoodz
User Off Offline

Quote
More >

i get errors
More >

old Re: my classes script |need help

Starkkz
Moderator Off Offline

Quote
I know what goes wrong, this npc can be spawned just by tiles, not pixels.

1
2
3
4
5
6
addhook("projectile","npcyx")
function npcyx(id,weapon,x,y)
	if weapon == 86 then
		parse("spawnnpc 1 "..math.floor(x/32).." "..math.floor(y/32).." "..player(id,"rot"))
	end
end

old Re: my classes script |need help

J4x
User Off Offline

Quote
@Starks, so if i change
1
player(id,"x") +1
by
1
player(id,"tylex") +1
and
1
player(id,"y") +1
by
1
player(id,"tiley") +1
the code will be fixed?

old Re: my classes script |need help

TimeQuesT
User Off Offline

Quote
when i understood you right you want to spawn a npc at the impact position of the gut-bomb ?

More >



FN_Linkin Park has written
Its possible, try with
1
2
3
4
5
6
7
8
addhook("projectile","npcyx")
function npcyx(id,weapon,x,y)
	local x = player(id,"x") +1
	local y = player(id,"y") +1
	if weapon == 86 then
parse("spawnnpc 1 "..x.." "..y.." 1")
end
end


change to-->

1
2
3
4
5
6
7
8
addhook("projectile","npcyx")
function npcyx(id,weapon,x,y)
local xx = math.floor(x/32)
local yy = math.floor(y/32)
if weapon == 86 then
parse("spawnnpc 1 "..xx.." "..yy.." 1")
end
end

old Re: my classes script |need help

boyzinthewoodz
User Off Offline

Quote
this works:
More >


and this works:
More >


thank you all!!! omg really it works!!!
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview