Forum

> > CS2D > Maps/Editor > Ammoin/Ammo
Forums overviewCS2D overview Maps/Editor overviewLog in to reply

English Ammoin/Ammo

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

old Re: Ammoin/Ammo

Mora
User Off Offline

Quote
@user Alistaire: anyway will be easy than every time place the trigger_if for every weapon you've placed on the map?
There is nothing hard to replace the item id, anyway, less triggers..

old Re: Ammoin/Ammo

Alistaire
User Off Offline

Quote
You could make an actual Lua script, make it hook to cs2d lua hook triggerentity, add a trigger like "script_setammo 30 0" to each Env_Item you want to change ammo on then in the hook check the entity(x, y, "trigger") for the REGEX occurence of "script_setammo (.-) (.-)" and set the variables "ammoin" and "ammo" to those values, go through item(0, "table") to find all items with x and y positions supplied by the hook, item(itemID, "dropped") and itemtype supplied by entity(x, y, "intn") {where n is the value of the itemtype supplied by the entity, I'm not sure which it is to be honest}, and cs2d cmd setammo with the itemID returned by this loop, the value 0, the ammoin variable and the ammo variable.

This way all you have to do is add "script_setammo 30 0" in the Trigger name field of the entity to change its ammo count.

And because I'm lazy I won't give you the script, I bet someone else has more free time on their hands atm so they might give it.

-------

To autorun this script you can even put it in your maps folder and rename it to *mapname*.lua

old Re: Ammoin/Ammo

Mora
User Off Offline

Quote
user Alistaire has written
And because I'm lazy I won't give you the script

Hey hey, do not spend your time. I didn't even ask.
/hey wait, did you already spend it to teach me. Thanks
user Alistaire has written
You could make an actual Lua script

Not all the ppls know lua. They should learn it(or they can just come to us.de and take the help they need)
//also ik about mapname.lua thingy
To the start Previous 1 2 Next To the start
Log in to reply Maps/Editor overviewCS2D overviewForums overview