The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"Rare" Spawner Event
Author Message
gergecoelho
Apprentice
*

Posts: 31
Likes Given: 7
Likes Received: 3 in 3 posts
Joined: Jul 2015
Reputation: 0



Post: #1
"Rare" Spawner Event
Hello, everyone! Just back from a while away from scripting. Smile

So, let's get to it: I'm having problems while trying to apply a randomizer to my NPC spawns (something to buff their stats up for rare/boss random automated spawning).

I've added my event over there:

//Events related to all pets
EventsPet=your_event

But by checking via ".set show events" the NPCs are all blank of events.

What would be some possible reasons for that? Since the event triggers on @Create, I need it to be applied before the NPC spawns, what could be some workaround if the EventsPet wouldn't cover it?

Thanks in advance!
(This post was last modified: 05-05-2017 10:16 AM by gergecoelho.)
04-29-2017 02:06 AM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #2
RE: NPC Events not being applied
EventsPet, EventsPlayer and so on aren't displayed by .show events command, however the triggers are still called.

Also take note that the @Create trigger doesn't follow the normal events order (Events-> Tevents -> Char/itemdef block trigger), instead is called after the @Create of the chardef block.
04-29-2017 03:50 AM
Find all posts by this user Like Post Quote this message in a reply
gergecoelho
Apprentice
*

Posts: 31
Likes Given: 7
Likes Received: 3 in 3 posts
Joined: Jul 2015
Reputation: 0



Post: #3
RE: NPC Events not being applied
Oh, then it's even better than I thought. Though the script isn't working for some OTHER reason.

See if you can make any sense of this (it's the event on EventsPet):

Code:
[TYPEDEF e_NPC_Triumphus] //NPC Spawn
ON=@Create
ALLSKILLS = (100 + (<TAG.LEVEL> * 80))
IF (<TAG.NPCCLASS> == 1) //Brute
    STR = (18 + (<TAG.LEVEL> * 8) + {1 3})
    DEX = (3 + (<TAG.LEVEL> * 8) + {1 3})
    INT = (-3 + (<TAG.LEVEL> * 8) + {1 3})
    MAXHITS = STR+20
    HITS = MAXHITS
    EVENTS +e_brute
ENDIF
IF (<TAG.NPCCLASS> == 2) //Soldier
    STR = (13 + (<TAG.LEVEL> * 8) + {1 3})
    DEX = (8 + (<TAG.LEVEL> * 8) + {1 3})
    INT = (3 + (<TAG.LEVEL> * 8) + {1 3})
    MAXHITS = STR+15
    HITS = MAXHITS
    EVENTS +e_soldier
ENDIF
IF (<TAG.NPCCLASS> == 3) //Artillery
    STR = (3 + (<TAG.LEVEL> * 8) + {1 3})
    DEX = (23 + (<TAG.LEVEL> * 8) + {1 3})
    INT = (3 + (<TAG.LEVEL> * 8) + {1 3})
    MAXHITS = STR+10
    HITS = MAXHITS
    EVENTS +e_artillery
ENDIF
IF (<TAG.NPCCLASS> == 4) //Skirmisher
    STR = (8 + (<TAG.LEVEL> * 8) + {1 3})
    DEX = (23 + (<TAG.LEVEL> * 8) + {1 3})
    INT = (-3 + (<TAG.LEVEL> * 8) + {1 3})
    MAXHITS = STR+15
    HITS = MAXHITS
    EVENTS +e_skirmisher
ENDIF
IF (<TAG.NPCCLASS> == 5) //Lurker
    STR = (13 + (<TAG.LEVEL> * 8) + {1 3})
    DEX = (23 + (<TAG.LEVEL> * 8) + {1 3})
    INT = (-3 + (<TAG.LEVEL> * 8) + {1 3})
    MAXHITS = STR+10
    HITS = MAXHITS
    EVENTS +e_lurker
ENDIF
IF (<TAG.NPCCLASS> == 6) //Controller
    STR = (3 + (<TAG.LEVEL> * 8) + {1 3})
    DEX = (-3 + (<TAG.LEVEL> * 8) + {1 3})
    INT = (23 + (<TAG.LEVEL> * 8) + {1 3})
    MAXHITS = STR+5
    HITS = MAXHITS
    EVENTS +e_controller
ENDIF
IF (<TAG.NPCCLASS> == 7) //Support
    STR = (3 + (<TAG.LEVEL> * 8) + {1 3})
    DEX = (-3 + (<TAG.LEVEL> * 8) + {1 3})
    INT = (23 + (<TAG.LEVEL> * 8) + {1 3})
    MAXHITS = STR+5
    HITS = MAXHITS
    EVENTS +e_support
ENDIF

VAR.RAND = <EVAL {1 500}> //Random chance for rare spawn
IF (<VAR.RAND> == 1)
    NAME = "Master "+<NAME>
    STR += (<STR> * 2,5)
    STR += (<DEX> * 2,5)
    STR += (<INT> * 2,5)
    Allskills = 100.0
    MAXHITS += 250
    HITS = MAXHITS
    COLOR = colors_all
    OSKIN = COLOR
ENDIF
IF (<VAR.RAND> >= 2) && (<VAR.RAND> <= 6)
    NAME = "Paragon "+<NAME>
    STR += (<STR> * 1,5)
    STR += (<DEX> * 1,5)
    STR += (<INT> * 1,5)
    Allskills = (<I.Anatomy> + (<I.Anatomy> * 1,5))
    MAXHITS += 150
    HITS = MAXHITS
    COLOR = colors_all
    OSKIN = COLOR
ENDIF
IF (<VAR.RAND> >= 7) && (<VAR.RAND> <= 16)
    NAME = "Champion "+<NAME>
    STR += (<STR> * 1)
    STR += (<DEX> * 1)
    STR += (<INT> * 1)
    Allskills = (<I.Anatomy> + (<I.Anatomy> * 1))
    MAXHITS += 100
    HITS = MAXHITS
    COLOR = colors_all
    OSKIN = COLOR
ENDIF
IF (<VAR.RAND> >= 17) && (<VAR.RAND> <= 36)
    NAME = "Greater "+<NAME>
    STR += (<STR> * 0,5)
    STR += (<DEX> * 0,5)
    STR += (<INT> * 0,5)
    Allskills = (<I.Anatomy> + (<I.Anatomy> * 0,5))
    MAXHITS += 50
    HITS = MAXHITS
    COLOR = colors_all
    OSKIN = COLOR
ENDIF

I put the TAG.LEVEL and TAG.NPCCLASS inside the monster chardef. Should I move them to the monster's @Create, then?
04-29-2017 12:28 PM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #4
RE: NPC Events not being applied
[TYPEDEF xxxxx] is used only by items, to create events you must use [EVENTS xxxxx]

also don't forget to use eval on all numeric formulas (eg: STR = <eval 1+1>) and <xxx> brackets when reading properties (eg: HITS = <MAXHITS>)
05-01-2017 04:38 PM
Find all posts by this user Like Post Quote this message in a reply
gergecoelho
Apprentice
*

Posts: 31
Likes Given: 7
Likes Received: 3 in 3 posts
Joined: Jul 2015
Reputation: 0



Post: #5
RE: NPC Events not being applied
Whoa those were some rookie mistakes. Corrected them and cleaned up a bit the parenthesis, but it steel doesn't seem to work. The stats aren't being applied.

Code:
[EVENTS e_NPC_Triumphus] //NPC Spawn
ON=@Create
ALLSKILLS = <EVAL 100 + <TAG.LEVEL> * 80>
IF (<TAG.NPCCLASS> == 01) //Brute
    STR = <EVAL 18 + <TAG.LEVEL> * 8 + {1 3}>
    DEX = <EVAL 3 + <TAG.LEVEL> * 8 + {1 3}>
    INT = <EVAL -3 + <TAG.LEVEL> * 8 + {1 3}>
    MAXHITS = <EVAL <STR> + 20>
    HITS = <MAXHITS>
    EVENTS +e_brute
ENDIF

1. I don't know if ALLSKILLS can be called in like that;
2. I've tried <TAG.NPCCLASS> == 01 and just 1, it's being defined on the Chardef block.

Any clues? Sad
05-02-2017 02:33 AM
Find all posts by this user Like Post Quote this message in a reply
gergecoelho
Apprentice
*

Posts: 31
Likes Given: 7
Likes Received: 3 in 3 posts
Joined: Jul 2015
Reputation: 0



Post: #6
RE: "Rare" Spawner Event
*shameless bump* Still hasn't figured this one out. Sick
05-05-2017 10:17 AM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #7
RE: "Rare" Spawner Event
Is the trigger called?
Try to log something in the code.
Example:
Code:
[EVENTS e_NPC_Triumphus] //NPC Spawn
ON=@Create
serv.log Create trigger fired for <name>
ALLSKILLS = <EVAL 100 + <TAG.LEVEL> * 80>
IF (<TAG.NPCCLASS> == 01) //Brute
    serv.log  Attributes before changes for <name> with NPCClass <dtag.npcclass>: <str> <dex> <int> <maxhits>
    STR = <EVAL 18 + <TAG.LEVEL> * 8 + {1 3}>
    DEX = <EVAL 3 + <TAG.LEVEL> * 8 + {1 3}>
    INT = <EVAL -3 + <TAG.LEVEL> * 8 + {1 3}>
    MAXHITS = <EVAL <STR> + 20>
    HITS = <MAXHITS>
    EVENTS +e_brute
    serv.log  Attributes after changes for <name> with NPCClass <dtag.npcclass>: <str> <dex> <int> <maxhits>
ENDIF
05-05-2017 09:26 PM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes darksun84's post
gergecoelho
Apprentice
*

Posts: 31
Likes Given: 7
Likes Received: 3 in 3 posts
Joined: Jul 2015
Reputation: 0



Post: #8
RE: "Rare" Spawner Event
Code:
19:58:1:'gergecoelho' commands 'add c_orc'=1
19:58:1:'Gerge' Says 'all stop' mode=0
19:58:LOL
19:58:1:'gergecoelho' commands 'serv.log LOL'=1
Server is being PAUSED for Resync
Resync Restart
Indexing 753 scripts...
WARNING:Resource 'scripts/npcs/Monsters/Orcs.scp' changed, resync.
Done loading scripts (105 of 199 triggers used)
Resync complete!
20:00:1:'gergecoelho' commands 'add c_orc'=1
20:00:1:'Gerge' Says 'all stop' mode=0
20:00:1:'gergecoelho' commands 'set show str'=1
20:00:'gergecoelho' commands uid=0401 (Rugbu) to 'show str'=1
20:01:1:'gergecoelho' commands 'remove'=1
20:01:'gergecoelho' commands uid=0401 (Rugbu) to 'remove'=1
20:01:1:'gergecoelho' commands 'remove'=1
20:01:'gergecoelho' commands uid=03fc (Romarod) to 'remove'=1

Edit: Managed to get it to work, but I need to force the event on each creature TEVENTS=e_carnivores2, e_NPC_Triumphus, etc.

The normalized spawn based on level+npcclass is working, the Rare Spawner is still not triggering, though. I'll test further. ;O

Edit2: Random Rare spawner seems to be in order! Thanks for the help! Think I'll just apply it manually, also spares me the trouble of finding a way to make this system not trigget on shopkeepers. Smile
(This post was last modified: 05-06-2017 09:18 AM by gergecoelho.)
05-06-2017 09:10 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 2 Guest(s)