Forum

> > CS2D > Maps/Editor > NPC Range and Weapon
Forums overviewCS2D overview Maps/Editor overviewLog in to reply

English NPC Range and Weapon

4 replies
To the start Previous 1 Next To the start

old NPC Range and Weapon

CrazyPenguin
User Off Offline

Quote
With trigger_if can I change NPC's range and weapon and how ?

I find their range quite short and they need a better weapon




EDIT

I should explore more before asking questions...anyway I found out the way to edit range I just edit the npc.lua file but still I don't know how to change the weapon

Is it also possible to not make them run towards you and just stay in place and shoot from distance ?

Here is the entire npc code
Spoiler >
edited 2×, last 02.01.18 08:07:51 pm

old Re: NPC Range and Weapon

Pagyra
User Off Offline

Quote
My CS2D standarд NPCs info:
IMG:https://unrealsoftware.de/u_scr/u87cd_4d93a32fs1.jpg?t=1435937120

--------
1 - Zombie (weapons id 249)
2 - Headcrab (weapons id 249)
3 - Snark (weapons id 249)
4 - Vortigaunt (weapons id 249)
5 - Soldier (weapons id 248)
Standart aim range is 11 tiles
All npc can be moved as images - use imagepos for move it, but there is some problem.

Hooks of attack for different NPCs

Zombie:
target~=0
countdown=-50
rotvar=40

Headcrab:
target~=0
countdown=-20
rotvar=20

Snark
target~=0
countdown=-15
rotvar=20

Vortigaunt
For melee attack
target~=0
countdown=-50
rotvar=40

For range attack
target~=0
countdown=-50
upgrade=40?
upgrade=1 - It see its target and charge blast
upgrade=0 - Attack moment

Soldier
countdown=7
target~=0

Returns a value of NPCs:

exists: boolean, 1(true) if object with this ID exists, 0(false) otherwise - if not exists.
typename: name of the type of this object
type: internal type ID of this NPC (1-5 meanings depending on type)
health: health value
mode: current mode (depending on type) - unknown
team: team of NPC
player: player - returns npc ID
x: current x position on map (in pixels)
y: current y position on map (in pixels)
rot: current rotation angle (in degrees)
tilex: current x position on map (in tiles)
tiley: current y position on map (in tiles)
countdown: countdown variable (cycle of countdown from values specifically for this NPC to 10) if -50 then attack moment
rootrot: original rotation(angle at spawn)
idle: idle value - unknown - sometimes this value changes when npc move
rotvar: rotation variable (this value changes in melee attack)
target: current target - returns player id (and 0 if there is no target)
upgrade: upgrade value (countdown between shots for NPC)
entity: boolean, true if object is spawned by entity, false otherwise if object is spawned by lua
entityx: x-coordinate (tile) of entity which spawned this object
entityy: y-coordinate (tile) of entity which spawned this object

Moreover there is:
object(0,"table"): a Lua table with all dynamic object IDs

Using the object table to list the IDs of all objects
local objectlist=object(0,"table")
for _,id in pairs(objectlist) do
print(id)
end
edited 2×, last 03.01.18 01:49:39 pm

old Re: NPC Range and Weapon

Yates
Reviewer Off Offline

Quote
You should probably change that to something like "Thank you)))" before you get banned for a short post
To the start Previous 1 Next To the start
Log in to reply Maps/Editor overviewCS2D overviewForums overview