Forum

> > CS2D > Scripts > Creating Image Over NPC
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Creating Image Over NPC

6 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Creating Image Over NPC

KaBooMa
User Off Offline

Zitieren
alright...i think im using threads to much...anyways my goal here! i wanna make a image over a npc and have it disappear and all kinds of cool stuff haha so heres my code

Spoiler >


and heres my problem...ok so this is scanning over all the npcs generated randomly in a map i have...it says...if its type is 30 which is zombie right? or wrong? then its going to repos. the image i have for the id to its x and y and rotation...but im getting a error and its not repositioning all the images..error is number expected, got nil...where its reposing the image...i know that nil is...nothing...and i just seen that its saying NPC[npc] is nil...can anyone tell me why its doing this? i have it so when it spawns a npc..it sets a image at the x and y and r of the npc and NPC[npc (which the generator sets as it goes too using for 1,100 or something..)] am i doing a noob mistake again? haha would love some help shared

EDIT: i see my mistake...but i cant find any work around at all any help guys...the npcs id and image id will not be the same and therefor..im out of ideas...can anyone help at all?

alt Re: Creating Image Over NPC

Vectarrio
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
function NPCImage()
	local npct=object(0,"table")
	for i = 1,#npct do
		if object(npct[i],'type') == 30 then
			imagepos(NPC[npct[i]],object(npct[i],'x'),object(npct[i],'y'),object(npct[i],'rot'))
		end
	end
end
does it work?

alt Re: Creating Image Over NPC

kalis
User Off Offline

Zitieren
i think
type of zombie not = 30 =.= , ID have? in editor ?
! : zombie
2 : Headcrab
3 : snrak
4 : vortigant
5 : soldeir

i dont think i'm right !

alt Re: Creating Image Over NPC

Cure Pikachu
User Off Offline

Zitieren
user kalis hat geschrieben
i think
type of zombie not = 30 =.= , ID have? in editor ?
! : zombie
2 : Headcrab
3 : snrak
4 : vortigant
5 : soldeir

i dont think i'm right !

NPCs are dynamic objects, so they share the same type ID (30). Those IDs is for their looks, I assume.

alt Re: Creating Image Over NPC

KaBooMa
User Off Offline

Zitieren
oh ok i see pika ok so i tryed vectars code and it gave me the same thing -.- is there a way maybe that i can see if its a 'zombie' not a all over dynamic object..because its saying this because there is dynamic objects in the map and they dont have a NPC[npc] set to them any idea
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht