English Creating Image Over NPC

6 replies
Goto Page
To the start Previous 1 Next To the start
06.07.11 10:17:51 am
Up
KaBooMa
User
Offline Off
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?
06.07.11 10:42:22 am
Up
Vectarrio
User
Offline Off
Code:
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?
06.07.11 10:43:19 am
Up
kalis
User
Offline Off
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 !
06.07.11 10:52:43 am
Up
Cure Pikachu
User
Offline Off
user kalis has written:
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.
IMG:https://i.imgur.com/uUrye71.png
IMG:https://i.imgur.com/xpsyQRX.png
06.07.11 10:59:22 am
Up
Infinite Rain
Reviewer
Offline Off
yeah pikanoob and vectar is right
A thousand may fall at your side, ten thousand at your right hand, but it will not come near you. You will only look with your eyes and see the recompense of the wicked. - Psalm 91:7-8 ESV
06.07.11 11:01:08 am
Up
KaBooMa
User
Offline Off
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
06.07.11 03:06:40 pm
Up
Vectarrio
User
Offline Off
can you give full error line (I mean console's one)?
and did you create the image before posing it? (by image command)
To the start Previous 1 Next To the start