Forum

> > CS2D > Scripts > How do you spawn an NPC on a specific tile#?
Forums overviewCS2D overview Scripts overviewLog in to reply

English How do you spawn an NPC on a specific tile#?

8 replies
To the start Previous 1 Next To the start

old How do you spawn an NPC on a specific tile#?

olivebates
User Off Offline

Quote
Hey there, new to lua here.

So, I want it so theres a zombie that spawns on a spcific tile# (i.e. tile 113) with 100 life.

These are the 3 things I need to know
How to edit a specific tile.
How to spawn an NPC at a specific position.
and How to set the life of that specific NPC.

EDIT: If you were wondering, I want to make my own wave mod.

old Re: How do you spawn an NPC on a specific tile#?

Alistaire
User Off Offline

Quote
>_<

Tutorial: How to spawn an NPC

>Method 1#
- Make an Env_NPC
- Edit the settings; set the health to the health you want and the rotation to the rotation you want.
- Change the name to "Wave"
- Copy the entity to every tile you want it
- Place a trigger_start, triggering "Wave start"
- Place a trigger_delay with the ammount of seconds you want to let the NPC's spawn from start of round, and call it "Wave start". Make it trigger "Wave".
- Copy this entity to every tile you want an NPC to spawn in the wave.

old Re: How do you spawn an NPC on a specific tile#?

olivebates
User Off Offline

Quote
Thats mighty nice and all, but I already know this. I want to be able to have a dynamic amount of different npcs I can spawn on the same block (both Vorginaughts and Zombies, headcrabs ect.)

And then I also want to make it so when all the NPCs are dead, then the next wave spawns.

Im gonna have it as an array for each wave, on what npcs to spawn.
edited 1×, last 06.08.11 09:55:10 pm

old Re: How do you spawn an NPC on a specific tile#?

Bowlinghead
User Off Offline

Quote
Its the lua-scripts section, idiot

How do you mean "How to edit a specific tile."?
The Tile psoition has a x- and a y- position.
In the map editor you can see it in the map editor.
Example:
12|52
12=x
52=y

If you need help you can look at the info.txt at first!
You can find the info.txt at "Counter Strike 2D/sys/lua/info.txt".
There are all addhooks with all possible parameters.

I cant help you with this question but I am 100% sure that it is possible what you want!

Edit:
Try it with "spawnnpc <type> <x> <y> <rot>".

old Re: How do you spawn an NPC on a specific tile#?

Apache uwu
User Off Offline

Quote
I think it's by absolute location so you need to multiply the x&y by 32 so you can get the correct tile location.

ex. 12, 52

12*32=384
52*32=1664

Console:
1
spawnnpc 1 384 1664

Lua:
1
parse("spawnnpc 1 384 1664")
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview