Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Shaiya > Shaiya Private Server
You last visited: Today at 10:20

  • Please register to post and access all features, it's quick, easy and FREE!

 

question about the NPCs

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2013
Posts: 36
Received Thanks: 1
question about the NPCs

Good day! Comrades ...
I have a question about the NPCs ... I can somehow spawn NPCs in a certain place?

I have one idea, and I would like to implement it, but I do not know how.. I need to that after the capture of one of the altar, SPAWN a group of monsters, that I can, and one NPCs, its I cant ..

it is real? NPCs spawn like a monster.
...
yeah, I forgot, I would like to do this with the custom ai



shakalaka_boom is offline  
Old   #2
 
elite*gold: 10
Join Date: Jan 2012
Posts: 1,695
Received Thanks: 5,138
I'm afraid this is impossible.


nubness is offline  
Old   #3
 
elite*gold: 0
Join Date: Feb 2013
Posts: 36
Received Thanks: 1
Quote:
Originally Posted by nubness View Post
I'm afraid this is impossible.
Okay .. as I understand a
custom ai, I can create and delete any monster ..
but I do not understand how can I get the time counter ...
I need that would be after the capture of the altar, he is every hour SPAWN one group of monsters, each 4 hours of other monsters....
and after ~ 6 hours, altar should remove himself, and put the other altar..
I know through AI, can remove a different monster, but whether he will remove himself?

I'm interested in how to make a counter, I have not figured out how.
and a monster will remove the myself? to replace themselves, in other words

something of this possible?
shakalaka_boom is offline  
Old   #4
 
elite*gold: 0
Join Date: Dec 2010
Posts: 660
Received Thanks: 2,979
I assume you are dealing with .lua scripts and not files within AI directory (I also assume your "AI" stands for ... "AI" and not for a name of file or directory but I prefer to clarify it).

nubness did start a thread focused on the .lua script.
among other listed verbs, the 'LuaDeleteMob' one will very likely remove a mob.
regarding scheduled actions, I'm afraid it is not possible; I can't have proof for that but all facts (including lua callbacks) show that the mob actions are actually answers to players actions (and not actions initied by the mob itself).


castor4878 is offline  
Thanks
1 User
Old   #5
 
elite*gold: 0
Join Date: Jul 2010
Posts: 377
Received Thanks: 379
As they said Mob:LuaDeleteMob( MobID, 1, 0.0, 0.0 ) will remove a mob, even himself. (Check how the fake Exiel removes himself after moving away)

For counters I would use something like (not sure of the code logic tho xD):
Code:
myTimer = 0
myCount = 0
...
...
function WhileCombat( dwTime, dwHPPercent, dwAttackedCount )
if ( dwTime >= myTimer ) then
	if ( myCount >= 10 ) then //every 10 minutes
                do_something_here... //perform an action
                myCount = 0
        end
       myCount = MyCount + 1
	myTimer = dwTime + 60000 //each 60 seconds
end

...
end
That is every 60 seconds, add 1 to the counter, when the counter reaches 10, do something and start counting again. Now, counting 6 hours, I don't know...

Of course that will loop only if the mob is being constantly attacked without a reset. As castor said they respond to player actions only, and I dont think we can do a loop on the Init() function.
sominus is offline  
Thanks
2 Users
Old   #6
 
elite*gold: 0
Join Date: Dec 2010
Posts: 660
Received Thanks: 2,979
mob respond to players' actions, that's certain.
but is it actually a blocking point?

the fact that the mob does not generate event when there are no players is definitely something that does not matter ... since there are no players to be involved in this event.

if I rewrite the requirement "after ~ 6 hours, altar should remove himself" as "after ~ 6 hours, any actions on altar remove it", the coding becomes obvious.

Code:
-- -----------------------------
-- AI script for test mob 58 (or any other)
-- -----------------------------

Mob = LuaMob(CMob)

-- -----------------------------
-- instance members

dwDeathTime	= 0

-- -----------------------------

function Init()

-- set death time to current time + 6 hrs
-- (see http://lua-users.org/wiki/OsLibraryTutorial)
--	dwDeathTime = os.time() + 6 * 60 * 60

	-- set delay to 30 sec for tests
	dwDeathTime = os.time() + 30

--	Mob:LuaSay('Mob:Initied', 20)

end

-- -----------------------------

function OnMoveEnd( dwTime )
end

-- -----------------------------

function OnAttacked( dwTime, dwCharID )
	-- this callback is never called by my ps_game
end

-- -----------------------------
-- invoked each time a new aggro / attack occurs

function OnAttackable( dwTime, dwCharID )

	Mob:LuaSay('Mob:OnAttackable', 20)

-- test for new aggro/attack after a reset
	if (os.time() > dwDeathTime) then
		Mob:LuaDeleteMob( 58, 1, 0.0, 0.0 )
	end

end

-- -----------------------------

function OnNormalReset( dwTime )
end

-- -----------------------------

function OnDeath( dwTime, dwAttackedCount )
end

-- -----------------------------

function OnReturnHome( dwTime, dwAttackedCount )
end

-- -----------------------------

function WhileCombat( dwTime, dwHPPercent, dwAttackedCount )

	-- debug feedback
	Mob:LuaSay('in combat at ' .. os.time() .. ' HP: ' .. dwHPPercent .. ' Count: ' .. dwAttackedCount, 20 )

	if (os.time() > dwDeathTime) then
		Mob:LuaDeleteMob( 58, 1, 0.0, 0.0 )
	end

end

with my ps_game the OnAttacked() callback is never invoked, I so don't use in to ckeck status.
the LuaGetMobUID listed there is also not present in my ps_game, I so hard code the mob ID '58' of course one would prefer to dynamically recover the ID of the mob to remove it.

when the mob lost aggro (reset) and returns to home, it resets its HP but all LUA data are kept inchanged, this include our 'dwDeathTime' variable as well as some parameters transmitted to methods (including dwAttackedCount that will count the number of attacks received by the mob during its whole life); the mob can so remove itself after a given delay or a number of attacks.

also, since the dwDeathTime is not resetted, the counter (actually the dead line) will be valid forever and the test in OnAttackable will remove the mob (little visual glitch) if an aggro starts while the 6hr are elapsed.
this grants the requirement "the mob leasts for at most 6 hrs" (it can be present a longer time but only if there are no players to be aware of that).
OOH it is not possible to grant that "the mob (altar) is replaced by another mob (altar) after exactly 6 hrs", still it can be replaced by another mob as soon as the delay is expired *and* a player aggros or attacks it.
castor4878 is offline  
Thanks
2 Users
Old   #7
 
elite*gold: 0
Join Date: Feb 2013
Posts: 36
Received Thanks: 1
Thanks guys ...


shakalaka_boom is offline  
Reply



« Previous Thread | Next Thread »

Similar Threads
[QUESTION] I can't put item in npcs HELP PLS
Hello everyone, i hope you can help me. I saw many guides and i did everything ok, (i think) :P. 1 step: 1- Opened "Flyff NPC editor" and added a...
1 Replies - Flyff PServer - Discussions / Questions
question about old npcs
does anyone remember the name of the old +'ing npc from 1.0?
0 Replies - CO2 Main - Discussions / Questions
Binary question with npcs
Ok so I have managed to sell MoonBox in StoreKeeper (TC) But any ideas how to change the prices of items in StoreKeeper? I know IDs etc but just not...
6 Replies - CO2 PServer - Discussions / Questions
[Question] NPCs don't work
i tried to code some npcs but they didn't work may anyone help me?
2 Replies - CO2 PServer - Discussions / Questions
a question about NPCs =)
where can i find the NPCs Type #? i mean in the client...i coded a "Restart attribute" NPC and i wanna know wat is the Type # so it will look the...
4 Replies - CO2 PServer - Discussions / Questions



All times are GMT +1. The time now is 10:20.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2017 elitepvpers All Rights Reserved.