Legacy Development Community Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Legacy Development Community Forum

World of Warcraft Development Forums
 
HomeHome  PortalPortal  GalleryGallery  SearchSearch  Latest imagesLatest images  RegisterRegister  Log in  

 

 Making NPC's sleep/sit

Go down 
+3
invite
aceindy
Slick
7 posters
AuthorMessage
Slick




Number of posts : 95
Age : 43
Localisation : Michigan
Registration date : 2006-12-21

Making NPC's sleep/sit Empty
PostSubject: Making NPC's sleep/sit   Making NPC's sleep/sit EmptyTue Feb 20, 2007 7:22 pm

There are a lot of NPC's in Exodar and Azuremyst that should be laying down or sitting. Is there a way to get them to actually do this? I haven't found any commands in game to allow me to change their standstate and have no idea if I have to write a py script for it.

Any ideas?
Back to top Go down
aceindy
Sherif
aceindy


Number of posts : 305
Registration date : 2006-11-28

Making NPC's sleep/sit Empty
PostSubject: Re: Making NPC's sleep/sit   Making NPC's sleep/sit EmptyTue Feb 20, 2007 7:44 pm

Sure:
Make new script ai / type / humanoid / sleeping.py:
Code:
#by Aceindy

from Ludmilla import *
import consts as co
reload(co)
import const_spellname as spell_name # Import of constants (spell_name)
reload(spell_name) 
from random import *

#------------------------------------------------------------------------------
def OnInitNpc (self):
   
    entry_id = self.GetEntry()
   
    print "OnInitSleep: %s %d" % (self.GetName(), entry_id)
   
    # stop any movements
    self.MovementType (co.STAY_AT_CURRENT_PLACE)
    self.CastSpell(self, spell_name.SPELL_ID_PEON_SLEEPING )
#--- END ---
and register creature_id's in startup_ai.py:
Code:

printLog("|  -> Registering          AI Module Sleep    |" )
import ai.type.humanoid.sleeping
reload (ai.type.humanoid.sleeping)
for i in (16483, 17117, 18812):
    RegisterAIModule (i, "ai.type.humanoid.sleeping", 0)

Oops...i think I finished it allready....just add it, and try some creature_id's

Mind sharing those ID's??


Last edited by on Wed Feb 21, 2007 1:50 am; edited 4 times in total
Back to top Go down
Slick




Number of posts : 95
Age : 43
Localisation : Michigan
Registration date : 2006-12-21

Making NPC's sleep/sit Empty
PostSubject: Re: Making NPC's sleep/sit   Making NPC's sleep/sit EmptyTue Feb 20, 2007 8:05 pm

I sure can provide the ID's! They are the Draenei Survivors that need to be sleeping and a couple others. Let me go ingame and get the #'s for you.

NPC's Sleeping: 16483, 17117, 18812

NPC's Sitting: 18813

Also, where in that script do I change the creature Id?
Back to top Go down
aceindy
Sherif
aceindy


Number of posts : 305
Registration date : 2006-11-28

Making NPC's sleep/sit Empty
PostSubject: Re: Making NPC's sleep/sit   Making NPC's sleep/sit EmptyTue Feb 20, 2007 8:26 pm

Next time, edit your post instead of making a new one...

I filled them in for you , see original post.
Back to top Go down
invite

invite


Number of posts : 39
Age : 40
Registration date : 2006-11-28

Making NPC's sleep/sit Empty
PostSubject: Re: Making NPC's sleep/sit   Making NPC's sleep/sit EmptyWed Feb 21, 2007 12:52 am

nice nice
hard script

try this -)))

Code:
from Ludmilla import *
import consts as co
reload(co)
from random import *




#-----------------------------------------------------------------------------
def OnEnemyDetected (self, attacker):

    pass
   
#-----------------------------------------------------------------------------
def OnAttacked (self, attacker):

    pass

#-----------------------------------------------------------------------------
def OnTakeDamage (self, attacker):

    pass

#-----------------------------------------------------------------------------
def OnThink (self, val):
    self.SetStandState (co.STANDSTATE_SIT)

#-----------------------------------------------------------------------------
def OnInitNpc (self):
    self.MovementType (co.STAY_AT_CURRENT_PLACE)
    self.NextThink(1000, 0)

 #--- END ---


look in const more emote -)))

STANDSTATE_STAND = 0
STANDSTATE_SIT = 1
STANDSTATE_SIT_CHAIR = 2
STANDSTATE_SLEEP = 3
STANDSTATE_SIT_LOW_CHAIR = 4
STANDSTATE_SIT_MEDIUM_CHAIR = 5
STANDSTATE_SIT_HIGH_CHAIR = 6
STANDSTATE_DEAD = 7
STANDSTATE_KNEEL = 8
Back to top Go down
aceindy
Sherif
aceindy


Number of posts : 305
Registration date : 2006-11-28

Making NPC's sleep/sit Empty
PostSubject: Re: Making NPC's sleep/sit   Making NPC's sleep/sit EmptyWed Feb 21, 2007 1:43 am

I think you can skip the NextThink...once he's sitting, he will remain sitting, no need to update every 1000ms...

Which makes it:
Make new script ai / type / humanoid / sitting.py:
Code:
from Ludmilla import *
import consts as co
reload(co)
from random import *

#-----------------------------------------------------------------------------
def OnEnemyDetected (self, attacker):
    pass
#-----------------------------------------------------------------------------
def OnAttacked (self, attacker):
        pass
#-----------------------------------------------------------------------------
def OnTakeDamage (self, attacker):
        pass
#-----------------------------------------------------------------------------
def OnThink (self, val):
        pass
#-----------------------------------------------------------------------------
def OnInitNpc (self):
        self.MovementType (co.STAY_AT_CURRENT_PLACE)
        self.SetStandState (co.STANDSTATE_SIT)
#--- END ---
and accompaning init in startup_ai.py:
Code:

printLog("|  -> Registering          AI Module Sitting  |" )
    import ai.type.humanoid.sitting
    reload (ai.type.humanoid.sitting)
    for i in (18813):
    RegisterAIModule (i, "ai.type.humanoid.sitting", 0)

PS..for sleeping I use spell; it will show "Zzzzz" above sleeping NPC.
If you do not require that, use same script as sitting.
Back to top Go down
aceindy
Sherif
aceindy


Number of posts : 305
Registration date : 2006-11-28

Making NPC's sleep/sit Empty
PostSubject: Re: Making NPC's sleep/sit   Making NPC's sleep/sit EmptyWed Feb 21, 2007 3:39 am

I see that it involved starting NPC's of Draenei start Area, so I have removed the "Zzzz". Also tested and added it to SVN :-)

https://opensvn.csie.org/traccgi/kobold_py/changeset/274/

Good thinking !!!
Back to top Go down
Slick




Number of posts : 95
Age : 43
Localisation : Michigan
Registration date : 2006-12-21

Making NPC's sleep/sit Empty
PostSubject: Re: Making NPC's sleep/sit   Making NPC's sleep/sit EmptyWed Feb 21, 2007 8:25 am

That is great work guys! Glad to see I could help out at least a little in this community. I must say, I love the work that is being done and am glad that I can do my part.

I'll post any updates that I might find for any other NPC's that need this kind of interaction.
Back to top Go down
MemoryM
Addict



Number of posts : 261
Registration date : 2006-12-28

Making NPC's sleep/sit Empty
PostSubject: Re: Making NPC's sleep/sit   Making NPC's sleep/sit EmptyWed Feb 21, 2007 9:28 pm

i can share so much IDs of npcs wich has emotes in bli$$ but the disadvantege
is that the script works for id and not for guids , it would be usful if it will be included in V4 by using Creatures.sql like adding a new colum for emotes.


Last edited by on Wed Feb 21, 2007 9:58 pm; edited 1 time in total
Back to top Go down
Dimen
Addict
Dimen


Number of posts : 202
Registration date : 2006-11-28

Making NPC's sleep/sit Empty
PostSubject: Re: Making NPC's sleep/sit   Making NPC's sleep/sit EmptyWed Feb 21, 2007 9:46 pm

MemoryM wrote:
i can sare so much IDs of npcs wich has emotes in bli$$ but the disadvantege
is that the script works for id and not for guids , it would be usful if it will be included in V4 by using Creatures.sql like adding a new colum for emotes.
I agree, less scripts, less lagg Wink
better that you PM MasterM in EMUpedia for that suggestion
Back to top Go down
Slick




Number of posts : 95
Age : 43
Localisation : Michigan
Registration date : 2006-12-21

Making NPC's sleep/sit Empty
PostSubject: Re: Making NPC's sleep/sit   Making NPC's sleep/sit EmptyThu Feb 22, 2007 8:20 pm

Another NPC that needs to be laying down is 17508
Back to top Go down
aceindy
Sherif
aceindy


Number of posts : 305
Registration date : 2006-11-28

Making NPC's sleep/sit Empty
PostSubject: Re: Making NPC's sleep/sit   Making NPC's sleep/sit EmptyFri Feb 23, 2007 12:11 am

Dimen wrote:
I agree, less scripts, less lagg Wink
better that you PM MasterM in EMUpedia for that suggestion
Totaly agree on that, but....it also depends a bit on what the script is supposed to do.
This particular script is activated once during OnInitNPC, and it ain't doing anything during gameplay;)

Also added kneeling.py for Mourning Draenei (16807), see svn
Back to top Go down
MemoryM
Addict



Number of posts : 261
Registration date : 2006-12-28

Making NPC's sleep/sit Empty
PostSubject: Re: Making NPC's sleep/sit   Making NPC's sleep/sit EmptyFri Feb 23, 2007 1:26 am

aceindy wrote:
Dimen wrote:
I agree, less scripts, less lagg Wink
better that you PM MasterM in EMUpedia for that suggestion
Totaly agree on that, but....it also depends a bit on what the script is supposed to do.
This particular script is activated once during OnInitNPC, and it ain't doing anything during gameplay;)

Also added kneeling.py for Mourning Draenei (16807), see svn

well last time i suggest to made a way for random respawn models of npc through creatures_templ.sql he said that i can do that by editing the tables through a python script by using his commands. (unit.SetUpdateFieldValue(XXX, modelId)
my guss he's gonna tell me that again...i'll PM him and i'll see what he's thinking and i'll tell you , so we would know if we should work on those scripts.
Back to top Go down
Ataraxis

Ataraxis


Number of posts : 22
Registration date : 2007-03-13

Making NPC's sleep/sit Empty
PostSubject: Re: Making NPC's sleep/sit   Making NPC's sleep/sit EmptyFri May 25, 2007 9:28 am

How should a script for a NPC to carry a weapon and shield should look like... I searched in here but couldn't find it. Some of my guards have nice little checkered boxes instead of shields, and some don't have any weapons at all. Tried to spawn Stormwind City Guards, for example, the models already in the game, which have shields and weapons, but the ones I spawned carry no shield or weapon.

I am totally unskilled in writing python scripts, so any help, or pointers are appreciated. Thanks.
Back to top Go down
aceindy
Sherif
aceindy


Number of posts : 305
Registration date : 2006-11-28

Making NPC's sleep/sit Empty
PostSubject: Re: Making NPC's sleep/sit   Making NPC's sleep/sit EmptyFri May 25, 2007 9:45 am

Code:
   self.Equip(0, 3, 7428, 218169346)   
Will have to try a bit, as I don't know whole syntax :-/
Back to top Go down
Ataraxis

Ataraxis


Number of posts : 22
Registration date : 2007-03-13

Making NPC's sleep/sit Empty
PostSubject: Re: Making NPC's sleep/sit   Making NPC's sleep/sit EmptyFri May 25, 2007 10:07 am

aceindy wrote:
Code:
   self.Equip(0, 3, 7428, 218169346)   
Will have to try a bit, as I don't know whole syntax :-/


I wish I could say "I don't know the whole syntax" it would mean I have at least a slight idea about it Smile Thanks for help bounce
Back to top Go down
aceindy
Sherif
aceindy


Number of posts : 305
Registration date : 2006-11-28

Making NPC's sleep/sit Empty
PostSubject: Re: Making NPC's sleep/sit   Making NPC's sleep/sit EmptyFri May 25, 2007 11:16 am

It is normaly used in AI / def OnIntNPC
Code:
    def OnInitNpc (Aclass,self):
        self.Equip(0, 3, 7428, 218169346)
Back to top Go down
Ataraxis

Ataraxis


Number of posts : 22
Registration date : 2007-03-13

Making NPC's sleep/sit Empty
PostSubject: Re: Making NPC's sleep/sit   Making NPC's sleep/sit EmptyFri May 25, 2007 12:12 pm

aceindy wrote:
It is normaly used in AI / def OnIntNPC
Code:
    def OnInitNpc (Aclass,self):
        self.Equip(0, 3, 7428, 218169346)

confused Looking.... still looking some more... can't figure it out Shocked
Back to top Go down
Iceman
Developer
Iceman


Number of posts : 462
Registration date : 2006-11-28

Making NPC's sleep/sit Empty
PostSubject: Re: Making NPC's sleep/sit   Making NPC's sleep/sit EmptyFri May 25, 2007 9:33 pm

did u put that in script of peon?
Back to top Go down
Sponsored content





Making NPC's sleep/sit Empty
PostSubject: Re: Making NPC's sleep/sit   Making NPC's sleep/sit Empty

Back to top Go down
 
Making NPC's sleep/sit
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Legacy Development Community Forum :: Kobold Legacy-
Jump to: