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
Targetting a Corpse
Author Message
Nachtmusique
Journeyman
*

Posts: 89
Likes Given: 0
Likes Received: 6 in 6 posts
Joined: Mar 2012
Reputation: 0



Post: #1
Targetting a Corpse
Hello,

I'm working on a sleep/KO script and I would like to forward the targeting of a corpse to the linked character. Is this possible? For example, if a character is knocked out (sleep + stone), and a second player casts the heal spell. I would like him to be able to target the body on the ground, but have it still affect the hidden, stoned character linked to that body. I realize I could script this specifically for heal, but I've like it to be more broad for other spells and, if possible, even dclicking in war mode to attack the sleeper. Is there a way to do all this without having to script each individual action? Perhaps an event that uses targon_item to trigger targon_char?
(This post was last modified: 03-05-2015 08:21 AM by Nachtmusique.)
03-05-2015 08:20 AM
Find all posts by this user Like Post Quote this message in a reply
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #2
RE: Targetting a Corpse
Asuming you are using a function to make character sleep (something like KnockOut and calling sleep inside) you can add one event to the player which handle all @SpellEffect, using something like if (<serv.spell.<argn1>.flags>&spellflag_good) will tell you if the spell is benefitial (there is a spellflag_bless too, maybe you have to look at sphere_defs to have a better idea of what you can use there).

Bad news come now, if no one corrects me (i'm a little sleep yet), there is no easy way to handle the corpse's targetting since there is a MUST-HAVE flag for spells 'spellflag_targ_item' that allows/deny spells to be casted at items. My best ideas now are:

a) Add this flag to all spells you may want to allow to this system and then add to them something like @Start in these spells checking if ACT is t_corpse and return 1 if not, if target is a corpse then you have to 'transfer' the spell effect to corpse's link (try ACT=<act.link>), this must work.
b) Using @Select to redo all the casting system from scratch for these spells (more instructive if you want to learn about it, more stupid/non-sense/boring if not) disallowing everything from targetting and handling yourself timers,events,checks, etc until you finished and have to call the spelleffect on target (Possible, but I see no profit here).
03-05-2015 07:14 PM
Find all posts by this user Like Post Quote this message in a reply
JohnVeritas
Apprentice
*

Posts: 49
Likes Given: 0
Likes Received: 4 in 4 posts
Joined: Feb 2014
Reputation: 2



Post: #3
RE: Targetting a Corpse
A little reminder; check the link's ( player ) current pos. it has to be close to the body. Other wise they can heal each other from far far away. And also link hits must be higher than zero for sure you dont heal him while he's actually dead.
03-05-2015 08:46 PM
Find all posts by this user Like Post Quote this message in a reply
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #4
RE: Targetting a Corpse
I don't think this is needed since players will Awake automatically when they move, get a hit, etc (AFAIR).
03-05-2015 11:06 PM
Find all posts by this user Like Post Quote this message in a reply
JohnVeritas
Apprentice
*

Posts: 49
Likes Given: 0
Likes Received: 4 in 4 posts
Joined: Feb 2014
Reputation: 2



Post: #5
RE: Targetting a Corpse
Damn my english isnt good that exlpain what i want to mean clearly but i m going to try;

(03-05-2015 11:06 PM)XuN Wrote:  since players will Awake automatically when they move, get a hit, etc (AFAIR).

it doesnt matter because, there can be more than one body linked same player in the world. That means he can die somewhere and go back a local town and resurrect with leave his body behind. While he's in action or something else a player or a friend can heal him on his corpse far far away if you not check the link's distance to his body...
03-05-2015 11:26 PM
Find all posts by this user Like Post Quote this message in a reply
Nachtmusique
Journeyman
*

Posts: 89
Likes Given: 0
Likes Received: 6 in 6 posts
Joined: Mar 2012
Reputation: 0



Post: #6
RE: Targetting a Corpse
Thanks for the options. I guess I'll plan on adding item targeting to each spell. As for the multiple corpses, I'll add some safety checks in there, but it shouldn't matter because in my particular death system a player would rarely (if ever) have more than one body. Upon resurrection, if a body exists, the player is returned to his existing rather then gaining a new one.
03-05-2015 11:34 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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