Forum

> > CS2D > Scripts > Parse equip
Forums overviewCS2D overview Scripts overviewLog in to reply

English Parse equip

6 replies
To the start Previous 1 Next To the start

old Parse equip

Haereikon
User Off Offline

Quote
I got the Fun Zombie Mode script from Bolt_PL .

The Fun Zombie Mode script gives you random weapons and perks every round, to make the game interesting .


Every perk is listed on perks={"x","y","k"} at the beginning of the script and every perk "power" is listed at the middle of the script with a if

if perks[perk]=="x" then
(perk effects)

When i try to make a custom perk, it works very well with √ speedmods and √ setmaxhealth, but when i do parse("equip "..id.." (itemid)"), every perk AFTER my custom script don't work...

Original Script:


Spoiler >


What i want to do in perk area (equip player)
Spoiler >




As a very newbie lua scripter, i'm sure i did something wrong... Can you guys help me ? •
edited 2×, last 09.08.12 05:06:38 am

old Re: Parse equip

VADemon
User Off Offline

Quote
DO NOT USE EQUIP ON SPAWN!!!
It was said several times here!
cs2d lua hook spawn has return that gives player specified items
1
2
3
4
5
6
addhook("spawn","spawn")
function spawn()
local items={4,2,6,3,8,12,15,20}
return items
end
end
PS: should/must work when returning a table

old Re: Parse equip

Haereikon
User Off Offline

Quote
I don't know how to make a table return work very well... Then i'm trying to learn it via spawnequip sample...

Tables i make works only when i turn off that script


If it isn't push too hard, would you explain to me please?

That's what i though it was:


Beginning of the script
1
2
nemesismode={}
nemesismode.items="5,10,26,40"

then, when the player gets the Nemesis perk i would put :

1
2
3
4
5
if player perks[perk]=="nemesis" then
...(After messages and Health/Speed mods)
addhook("spawn","spawnnemesis")
function spawnnemesis ()
return nemesismode.items;

What am i doing wrong ?



(Also, thanks for the help )
edited 2×, last 10.08.12 02:55:30 am

old Re: Parse equip

VADemon
User Off Offline

Quote
Hm, sorry it doesn't work with tables.
Try to return:
1
return unpack(table_with_items)
Should work

old Re: Parse equip

omg
User Off Offline

Quote
um...either show more of the script, or add end after the return >.> theres no reason why returning that shouldnt work

also, i highly recommend u do all ur thinking inside a single spawn hook because ur less likely to get errors

demon, attempting to return a table when it requires a string will lead to an error. duh

old Re: Parse equip

Haereikon
User Off Offline

Quote
Sadly, i couldn' t make the equip spawn once again, as basically nothing happens (I think because of some conflict with the original script equip spawn, because every new round, the server gives you a new equipment).

I think i will leave this idea from now, i'll try to learn a bit more of Lua scripting


Thanks a lot for the help
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview