• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

Feature [TFS 1.2] Monster:onSpawn(position, startup, artificial)

StreamSide

Joseluis Gonzalez
Support Team
Joined
Aug 31, 2007
Messages
3,584
Solutions
51
Reaction score
1,196
Location
Arica - Chile
I am creating a system in which it is necessary to use such a function, in the same way I would have liked to see another solution to the problem, there should be no things that block the server in any way.
why would you need to create the monster just to remove? its an spawn monster event function so just return false. If the spawn teleport effect matters you can also remove or add it into a new "if" check
 
OP
OP
Infernum

Infernum

Senator
Joined
Feb 14, 2015
Messages
5,640
Solutions
559
Reaction score
3,916
I am creating a system in which it is necessary to use such a function, in the same way I would have liked to see another solution to the problem, there should be no things that block the server in any way.
I've already seen the system you made, it's not necessary. You can respawn the monster without forcing monster:remove() and using return false instead.
 

Leo32

Getting back into it...
Joined
Sep 21, 2007
Messages
981
Solutions
14
Reaction score
508
If your pulls are up-to-date.

Don't do this:
events.cpp

replace
C++:
if (className == "Creature")
with
C++:
if (className == "Monster") {
   if (methodName == "onSpawn") {
       info.monsterOnSpawn = event;
   }
} else if (className == "Creature") {

Do this instead:
replace:
C++:
if (methodName == "onDropLoot") {
    info.monsterOnDropLoot = event;
} else {
with:
C++:
if (methodName == "onDropLoot") {
    info.monsterOnDropLoot = event;
} else if (methodName == "onSpawn") { // put it here instead
    info.monsterOnSpawn = event;
} else {
 
OP
OP
Infernum

Infernum

Senator
Joined
Feb 14, 2015
Messages
5,640
Solutions
559
Reaction score
3,916
If your pulls are up-to-date.

Don't do this:


Do this instead:

replace:
C++:
if (methodName == "onDropLoot") {
    info.monsterOnDropLoot = event;
} else {
with:
C++:
if (methodName == "onDropLoot") {
    info.monsterOnDropLoot = event;
} else if (methodName == "onSpawn") { // put it here instead
    info.monsterOnSpawn = event;
} else {
 
Top