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
EA Slayer System (Updated: 29-11-2013)
Author Message
Khaos
Master
**

Posts: 595
Likes Given: 166
Likes Received: 83 in 51 posts
Joined: Mar 2012
Reputation: 11



Post: #1
EA Slayer System (Updated: 29-11-2013)
EA slayer system minus barding implementation (not getting added unless we add it in the base packs). I need this thoroughly tested. XuN tested and said it works fine; but if there are any kinks I need them worked out prior to me adding this to the sphere base packs.

Code:
[comment EA_slayer_damage_system]
Author: Patrick Bradshaw (Developer: Khaos)
Version: 1.2
NPC Side controlled slayer damage to consume less resources in combat with slayer damage.

Script checks to make sure players have slayer flags equipped in their slayer/super slayer/misc slayer variables and check against the enemies variables.
If these variables match the slayer damage token rises. This caps out at 3 with a check in the slayer_damage function (per EA handling). Ea says misc
and lesser don't stack; but that is redundant with a 300% cap anyhow and the checks within the script make sure you don't surpass this cap.

Items must contain the slayer flags for the player to equip. This in turn gets added to the player. So this does force OSI/EA standards of needing the item
equipped to get the benefits of the slayer damage or the bane of the opposing slayers.

NPCs need the slayer flag added to their character variables as well. Make sure they are set using the naming schema or the flag #.

There are additional functions added in case you might need them. ISSLAYER_LESSER, ISSLAYER_SUPER, ISSLAYER_MISC.

Updates:
Switched @Equip to @ItemEquip.
Fixed typo in first @ItemEquip check with calling slayer instead of slayerlesser.
Added calls for lesser slayers in the opposed aligned slayers. It is speculated they work in this fashion.
Added chance to hit. Nothing is specified how often this fires off. There is now a controlling def. Use 0 - 100. 100 there will be no check and always hits. 0 always fails.

Variables used on items and chars:
SLAYERLESSER
SLAYERSUPER
SLAYERMISC


[defname slayer_damage_control]
// Damage control
slayer_dam_l        3    // Lesser Slayer damage.
slayer_dam_s        2    // Super slayer damage.
slayer_dam_m        2    // Misc slayer damage (Talisman).
slayer_dam_o        2    // opposite aligned damage.
slayer_hit_ratio        100 // chance to hit with a slayer 100 always hits. Anything less and we will perform a test to hit.


// Attach to your players.
// Adds slayer flag info from an item to char.
[events e_slayers_pchars]
on=@ItemEquip
if (<act.slayerless> > 0)
slayerlesser |= <act.slayerlesser>
endif
if (<act.slayersuper> > 0)
slayersuper |= <act.slayersuper>
endif
if (<act.slayermisc> > 0)
slayermisc |= <act.slayermisc>
endif
return 0

// Removes slayer flag info char based on item.
on=@ItemUnequip
if (<act.slayerlesser> > 0)
slayerlesser &= ~<act.slayerlesser>
endif
if (<act.slayersuper> > 0)
slayersuper &= ~<act.slayersuper>
endif
if (<act.slayermisc> > 0)
slayermisc &= ~<act.slayermisc>
endif
return 0


// Attach to your NPCs
[events e_slayers_npcs]
on=@GetHit
if (<ddef.slayer_hit_ratio> == 0)
return 0
endif
if (<ddef.slayer_hit_ratio> != 100)
local.hit_chance=<r1,100>
if (<local.hit_chance> <= <def.slayer_hit_ratio>)
  slayer_aligned_type
  slayer_damage
  return 0
endif
else
slayer_aligned_type
slayer_damage
return 0
endif

on=@Hit
if (<ddef.slayer_hit_ratio> == 0)
return 0
endif
if (<ddef.slayer_hit_ratio> != 100)
local.hit_chance=<r1,100>
if (<local.hit_chance> <= <def.slayer_hit_ratio>)
  slayer_opposite_type
  slayer_damage
  return 0
endif
else
slayer_opposite_type
slayer_damage
return 0
endif


//
// FUNCTIONS
//

// Slayer Damage Parsing Function
[function slayer_damage]
if (<local.slayer.dam> > 3)
local.slayer.dam=3
endif
argn1 *= <eval <local.slayer.dam>>

// Aligned Slayer Damage PvM
[function slayer_aligned_type]
local.slayer=0
if (<slayerlesser> > 0)
check_slayer_l
endif
if (<slayersuper> > 0)
check_slayer_s
endif
if (<slayermisc> > 0)
check_slayer_m
endif

// Opposite Aligned Slayer Damage MvP
[function slayer_opposite_type]
local.slayer=0
if (<slayerlesser> > 0) || (<slayersuper> > 0)
if (<slayersuper> &= slayer_abyss) || (<slayerlesser> &= slayer_gargoyle) && (<src.slayersuper> &= slayer_fey|slayer_elemental) || (<src.slayerlesser> &= slayer_air_elemental|slayer_blood_elemental|slayer_earth_elemental|slayer_fire_e​lemental|slayer_poison_elemental|slayer_snow_elemental|slayer_water_elemental)
  local.slayer.dam += <def.slayer_dam_o>
elif (<slayersuper> &= slayer_elemental)  || (<src.slayerlesser> &= slayer_air_elemental|slayer_blood_elemental|slayer_earth_elemental|slayer_fire_e​lemental|slayer_poison_elemental|slayer_snow_elemental|slayer_water_elemental) && (<src.slayersuper> &= slayer_abyss) || (<src.slayerlesser> &= slayer_gargoyle)
  local.slayer.dam += <def.slayer_dam_o>
elif (<slayersuper> &= slayer_fey) && (<src.slayersuper> &= slayer_abyss) || (<src.slayerlesser> &= slayer_gargoyle)
  local.slayer.dam += <def.slayer_dam_o>
elif (<slayersuper> &= slayer_arachnid) || (<src.slayerlesser> &= slayer_scorpion|slayer_spider|slayer_terathan) && (<src.slayersuper> &= slayer_reptile) || (<src.slayerlesser> &= slayer_dragon|slayer_lizardman|slayer_ophidian|slayer_snake)
  local.slayer.dam += <def.slayer_dam_o>
elif (<slayersuper> &= slayer_reptile)  || (<src.slayerlesser> &= slayer_dragon|slayer_lizardman|slayer_ophidian|slayer_snake) && (<src.slayersuper> &= slayer_arachnid) || (<src.slayerlesser> &= slayer_scorpion|slayer_spider|slayer_terathan)
  local.slayer.dam += <def.slayer_dam_o>
elif (<slayersuper> &= slayer_repond) || (<src.slayerlesser> &= slayer_goblin|slayer_orc|slayer_ogre|slayer_troll) && (<src.slayersuper> &= slayer_undead)
  local.slayer.dam += <def.slayer_dam_o>
elif (<slayersuper> &= slayer_undead) && (<src.slayersuper> &= slayer_repond) || (<src.slayerlesser> &= slayer_goblin|slayer_orc|slayer_ogre|slayer_troll)
  local.slayer.dam += <def.slayer_dam_o>
endif
endif


// Lesser Slayer Flag Checks
[function check_slayer_l]
if (<slayerlesser> > 0)
if (<slayerlesser> &= slayer_gargoyle) && (<src.slayerlesser> &= slayer_gargoyle)
  local.slayer.dam += <def.slayer_dam_l>
elif (<slayerlesser> &= slayer_air_elemental) && (<src.slayerlesser> &= slayer_air_elemental)
  local.slayer.dam += <def.slayer_dam_l>
elif (<slayerlesser> &= slayer_blood_elemental) && (<src.slayerlesser> &= slayer_blood_elemental)
  local.slayer.dam += <def.slayer_dam_l>
elif (<slayerlesser> &= slayer_earth_elemental) && (<src.slayerlesser> &= slayer_earth_elemental)
  local.slayer.dam += <def.slayer_dam_l>
elif (<slayerlesser> &= slayer_fire_elemental) && (<src.slayerlesser> &= slayer_fire_elemental)
  local.slayer.dam += <def.slayer_dam_l>
elf (<slayerlesser> &= slayer_poison_elemental) && (<src.slayerlesser> &= slayer_poison_elemental)
  local.slayer.dam += <def.slayer_dam_l>
elif (<slayerlesser> &= slayer_snow_elemental) && (<src.slayerlesser> &= slayer_snow_elemental)
  local.slayer.dam += <def.slayer_dam_l>
elif (<slayerlesser> &= slayer_water_elemental) && (<src.slayerlesser> &= slayer_water_elemental)
  local.slayer.dam += <def.slayer_dam_l>
elif (<slayerlesser> &= slayer_scorpion) && (<src.slayerlesser> &= slayer_scorpion)
  local.slayer.dam += <def.slayer_dam_l>
elif (<slayerlesser> &= slayer_spider) && (<src.slayerlesser> &= slayer_spider)
  local.slayer.dam += <def.slayer_dam_l>
elif (<slayerlesser> &= slayer_terathan) && (<src.slayerlesser> &= slayer_terathan)
  local.slayer.dam += <def.slayer_dam_l>
elif (<slayerlesser> &= slayer_dragon) && (<src.slayerlesser> &= slayer_dragon)
  local.slayer.dam += <def.slayer_dam_l>
elif (<slayerlesser> &= slayer_lizardman) && (<src.slayerlesser> &= slayer_lizardman)
  local.slayer.dam += <def.slayer_dam_l>
elif (<slayerlesser> &= slayer_ophidian) && (<src.slayerlesser> &= slayer_ophidian)
  local.slayer.dam += <def.slayer_dam_l>
elif (<slayerlesser> &= slayer_snake) && (<src.slayerlesser> &= slayer_snake)
  local.slayer.dam += <def.slayer_dam_l>
elif (<slayerlesser> &= slayer_goblin) && (<src.slayerlesser> &= slayer_goblin)
  local.slayer.dam += <def.slayer_dam_l>
elif (<slayerlesser> &= slayer_orc) && (<src.slayerlesser> &= slayer_orc)
  local.slayer.dam += <def.slayer_dam_l>
elif (<slayerlesser> &= slayer_ogre) && (<src.slayerlesser> &= slayer_ogre)
  local.slayer.dam += <def.slayer_dam_l>
elif (<slayerlesser> &= slayer_troll) && (<src.slayerlesser> &= slayer_troll)
  local.slayer.dam += <def.slayer_dam_l>
endif
endif

// Super Slayer Flag Checks
[function check_slayer_s]
if (<slayersuper> > 0)
if (<slayersuper> &= slayer_abyss) && (<src.slayersuper> &= slayer_abyss)
  local.slayer.dam += <def.slayer_dam_s>
elif (<slayersuper> &= slayer_elemental) && (<src.slayersuper> &= slayer_elemental)
  local.slayer.dam += <def.slayer_dam_s>
elif (<slayersuper> &= slayer_fey) && (<src.slayersuper> &= slayer_fey)
  local.slayer.dam += <def.slayer_dam_s>
elif (<slayersuper> &= slayer_reptile) && (<src.slayersuper> &= slayer_reptile)
  local.slayer.dam += <def.slayer_dam_s>
elif (<slayersuper> &= slayer_arachnid) && (<src.slayersuper> &= slayer_arachnid)
  local.slayer.dam += <def.slayer_dam_s>
elif (<slayersuper> &= slayer_repond) && (<src.slayersuper> &= slayer_repond)
  local.slayer.dam += <def.slayer_dam_s>
elif (<slayersuper> &= slayer_undead) && (<src.slayersuper> &= slayer_undead)
  local.slayer.dam += <def.slayer_dam_s>
elif (<slayersuper> &= slayer_vermin) && (<src.slayersuper> &= slayer_vermin)
  local.slayer.dam += <def.slayer_dam_s>
endif
endif

// Misc Slayer Flag Checks (Talisman)
[function check_slayer_m]
if (<slayermisc> > 0)
if (<slayermisc> &slayer_bat) && (<src.slayermisc> &slayer_bat)
  local.slayer.dam += <def.slayer_dam_m>
elif (<slayermisc> &slayer_bear) && (<src.slayermisc> &slayer_bear)
  local.slayer.dam += <def.slayer_dam_m>
elif (<slayermisc> &slayer_beetle) && (<src.slayermisc> &slayer_beetle)
  local.slayer.dam += <def.slayer_dam_m>
elif (<slayermisc> &slayer_bird) && (<src.slayermisc> &slayer_bird)
  local.slayer.dam += <def.slayer_dam_m>
elif (<slayermisc> &slayer_bovine) && (<src.slayermisc> &slayer_bovine)
  local.slayer.dam += <def.slayer_dam_m>
elif (<slayermisc> &slayer_flame) && (<src.slayermisc> &slayer_flame)
  local.slayer.dam += <def.slayer_dam_m>
elif (<slayermisc> &slayer_ice) && (<src.slayermisc> &slayer_ice)
  local.slayer.dam += <def.slayer_dam_m>
elif (<slayermisc> &slayer_mage) && (<src.slayermisc> &slayer_mage)
  local.slayer.dam += <def.slayer_dam_m>
elif (<slayermisc> &slayer_wolf) && (<src.slayermisc> &slayer_wolf)
  local.slayer.dam += <def.slayer_dam_m>
endif
endif

[function isslayer_lesser]
return <qval (<slayerlesser> != 0) ? 1 : 0 >

[function isslayer_super]
return <qval (<slayersuper> != 0) ? 1 : 0 >

[function isslayer_misc]
return <qval (<slayermisc> != 0) ? 1 : 0 >

//
// Slayer Flags
//

// Lesser Slayers
[defname slayer_lesser_flags]
slayer_gargoyle            01
slayer_air_elemental        02
slayer_blood_elemental        04
slayer_earth_elemental        08
slayer_fire_elemental        010
slayer_poison_elemental        020
slayer_snow_elemental        040
slayer_water_elemental        080
slayer_scorpion            0100
slayer_spider            0200
slayer_terathan            0400
slayer_dragon            0800
slayer_lizardman        01000
slayer_ophidian            02000
slayer_snake            04000
slayer_goblin            08000
slayer_orc            010000
slayer_ogre            020000
slayer_troll            040000

// Super Slayers
[defname slayer_super_flags]
slayer_abyss            01
slayer_elemental        02
slayer_fey            04
slayer_arachnid            08
slayer_reptile            010
slayer_repond            020
slayer_undead            040
slayer_vermin            080
slayer_demon            slayer_abyss
slayer_daemon            slayer_abyss

// Misc. Slayers (Talismans) Damage can stack on top of other slayers.
[defname slayer_misc_flags]
slayer_bat            01
slayer_bear            02
slayer_beetle            04
slayer_bird            08
slayer_bovine            010
slayer_flame            020
slayer_ice            040
slayer_mage            080
slayer_wolf            0100

[eof]
(This post was last modified: 11-30-2013 10:01 AM by Khaos.)
11-28-2013 01:24 PM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes Khaos's post
Extreme
Grandmaster Poster
***

Posts: 1,141
Likes Given: 217
Likes Received: 90 in 77 posts
Joined: May 2012
Reputation: 20

SphereCommunity

Post: #2
RE: EA Slayer System (Needs testing before added to default packs)
Thanks!!

STEPS BEFORE CREATE A THREAD
- Check the revisions log;
- Use the search button and use the keywords of your problem;
- Check the WIKI;
- Create a thread.
11-28-2013 08:29 PM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes Extreme's post
Khaos
Master
**

Posts: 595
Likes Given: 166
Likes Received: 83 in 51 posts
Joined: Mar 2012
Reputation: 11



Post: #3
RE: EA Slayer System (Needs testing before added to default packs)
You are welcome. Let me know how it works! XuN said it works great. I just need a couple more people to test it before I commit it to the base packs and start putting the flags on the NPCs!

Corrected the extra "!" in the ISSLAYER_* checks that were added for extras.
(This post was last modified: 11-28-2013 09:52 PM by Khaos.)
11-28-2013 09:41 PM
Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #4
RE: EA Slayer System (Needs testing before added to default packs)
I haven't tested it fully, but it looks like it is one way... in other words, a paladin NPC equipping an orc slayer will not be able to cause slayer damage to an NPC Orc. Similarly, a GM/other player role playing an Orc would not take slayer damage.
11-29-2013 08:08 AM
Find all posts by this user Like Post Quote this message in a reply
Khaos
Master
**

Posts: 595
Likes Given: 166
Likes Received: 83 in 51 posts
Joined: Mar 2012
Reputation: 11



Post: #5
RE: EA Slayer System (Needs testing before added to default packs)
It is equipped on NPCs. XuN test by placing slayerlesser=slayer_terathan on a terathan and the same on his char and said it worked Ran.

Again it is EA emulated. People can create their own custom. Sphere base packs aren't SCP... I am not providing anything minus base scripts to work as it would on OSI/EA.

But with this in mind with what you said; You would need to change the script to not check for the slayer values on the character but the weapon instead. Which I was avoiding since it would require extra checks for the talisman layer in combat. If people want that I can edit it to check the weapon and you can simply set slayers on all players and npcs as it is set for NPCs now.

As I said, originally it was meant for one sided combat. Players versus NPCs.

I do have a copy of this in the downloads section as well. I can add what you want to that one and just use this one in core packs.

Updated. There was a check for slayer instead of slayerlesser in the @Equip trigger. Switch @Equip to @ItemEquip. Thanks XuN!!!
(This post was last modified: 11-29-2013 09:17 AM by Khaos.)
11-29-2013 09:07 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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