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
Damage to self...
Author Message
RanXerox
Master
**

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



Post: #1
Damage to self...
I am having difficulty working this out:

When a player or npc steps into a fire (for example, an item of type=t_fire), the "source" of the damage in the @GetHit trigger is themselves...

Similarly, when a fire elemental drops a fire on the ground and then walks into it, the "source" of the damage is themselves...

Does anyone have suggestions on how to prevent a fire elemental from taking damage when they walk into their own droppings, but still allow players or npc's to take fire damage when they step on something dangerous?
11-01-2012 08:02 AM
Find all posts by this user Like Post Quote this message in a reply
Shaklaban
Master
**

Posts: 378
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Mar 2012
Reputation: 8

DOT

Post: #2
RE: Damage to self...
linking fire field to fire elemental do the trick for that situation.
11-01-2012 09:27 AM
Visit this user's website 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: #3
RE: Damage to self...
I presume you do this in @NPCSpecialAction... but how do you reference the item in that trigger?

... on second thought, this trigger occurs before the fire is dropped. What trigger fires AFTER (that has a reference to the fire object)?
(This post was last modified: 11-01-2012 10:45 AM by RanXerox.)
11-01-2012 10:22 AM
Find all posts by this user Like Post Quote this message in a reply
Barnabus
Journeyman
*

Posts: 124
Likes Given: 0
Likes Received: 3 in 2 posts
Joined: Apr 2012
Reputation: 1



Post: #4
RE: Damage to self...
Hi RanXerox
I was wondering what you did here.... I was thinking something like

On the ITEMDEFS for FireFields

ON=@Step
IF <SRC.ISPLAYER>
SRC.TAG.StoodOnUIDSFireField=<LINK.UID>
ENDIF
RETURN 0

Then in PLAYERS GETHIT Doing something like..

ON=@GetHit
IF <REF2.TAG.StoodOnUIDSFireField>
REF2.TAG.StoodOnUIDSFireField=
ARGN2=dam_fire
ELSE
ARGN2=dam_god
ENDIF

And in the NPCS get hit
IF <REF2.TAG.StoodOnUIDSFireField> && <REF2.BASEID>==c_fire_elemental
REF2.TAG.StoodOnUIDSFireField=
RETURN 1
ELSE
ARGN2=dam_fire
ENDIF

What did you end up doing ?
(This post was last modified: 11-01-2012 10:06 PM by Barnabus.)
11-01-2012 10:05 PM
Find all posts by this user Like Post Quote this message in a reply
Shaklaban
Master
**

Posts: 378
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Mar 2012
Reputation: 8

DOT

Post: #5
RE: Damage to self...
(11-01-2012 10:22 AM)RanXerox Wrote:  I presume you do this in @NPCSpecialAction... but how do you reference the item in that trigger?

... on second thought, this trigger occurs before the fire is dropped. What trigger fires AFTER (that has a reference to the fire object)?

mayve @step works since elemental drop the fire field @step must fire for it for first time.

or if NPCSpecialAction fires for dropping fire field, maybe you can try act or foritems.
11-01-2012 11:20 PM
Visit this user's website 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: #6
RE: Damage to self...
The thing is, I don't want to stop all monsters from taking damage by stepping on things... players cast wall of fire, players can lay traps, monsters can fight each other when provoked or after being tamed, etc. I just want certain cases fixed. I like the idea of linking an item to its owner and detecting that to avoid the damage. The case of the fire field is just one example.
11-02-2012 01:04 AM
Find all posts by this user Like Post Quote this message in a reply
Barnabus
Journeyman
*

Posts: 124
Likes Given: 0
Likes Received: 3 in 2 posts
Joined: Apr 2012
Reputation: 1



Post: #7
RE: Damage to self...
Ive Decided on something similiar just reading your post and Ive just did something basic, I like skulls idea about defining the NPCSpecial Triggers etc.. I did on the ITEMDEF for the field

PHP Code:
ON=@Step
    REF1
=<SERV.UID.<SRC.UID>>
    
REF2=<SERV.UID.<LINK.UID>>
    
REF2.TAG.StoodOnUIDSFireField=<REF1.UID>
    
SERV.LOG @ITEMDEF <REF2.NAMEuid <REF2.UIDhas stepped on a fire field created by <LINK.NAMEuid <LINK.UID>
    RETURN 


and then in GETHIT I just did this....

PHP Code:
    IF <REF2.TAG.StoodOnUIDSFireField> == <REF2.UID>
        
REF2.TAG.StoodOnUIDSFireField=
        
SERV.LOG @GETHIT <REF2.NAMEstood on own fire field.
    ENDIF 

i havnt set no damage or effect yet but at least I know who did it and who got it now

@NPCFireField

Would rock Ive had difficuty with the dragon breath too.. Just to add another but similiar annoyance.
PHP Code:
ON=@NPCSpecialAction
    
IF <BASEID>== c_dragon
        serv
.log @NPCSpecialAction (<NAME>) does action <ACTION> <SERV.SKILL.<ACTION>.KEY>
    ENDIF

ON=@NPCAction
    
IF <BASEID>== c_dragon
        
IF <ACTION>==06e
            serv
.log @NPCAction (<NAME>) does action <ACTION> <SERV.SKILL.<ACTION>.KEY>
        ENDIF
    ENDIF

ON=@NPCActFight
    REF1
=<SERV.UID.<UID>>
    
REF2=<SERV.UID.<SRC.UID>>
    IF (
STRMATCH(*dragon*,<REF1.TAG.NPCGroup>>)
        IF <
ARGN1> > 2
                
IF <SERV.SKILL.<ACTION>.KEY> == Wrestling
                    
// This must be a Dragon Breath
                    
SERV.LOG @NPCActFight <NAMEBreathes Fire on <REF2.NAME>
                    
REF2.TAG.DragonFireDamage=<EVAL <REF1.INT> + <REF1.DAM>>
                ENDIF
            ENDIF
        ENDIF
    ENDIF
    RETURN 

(This post was last modified: 11-02-2012 01:48 AM by Barnabus.)
11-02-2012 01:41 AM
Find all posts by this user Like Post Quote this message in a reply
Barnabus
Journeyman
*

Posts: 124
Likes Given: 0
Likes Received: 3 in 2 posts
Joined: Apr 2012
Reputation: 1



Post: #8
RE: Damage to self...
Sorry I got that Wrong. Ill Repost that @Step and @GetHIt Bit again for the benefit of noobs who may be reading this post.

PHP Code:
ON=@Step
    REF1
=<SERV.UID.<SRC.UID>> // Stepper
    
REF2=<SERV.UID.<LINK.UID>> // Doer
    
REF3=<SERV.UID.<UID>> // Item
    
REF1.TAG.StoodOnUIDSFireField=<REF2.UID>
    IF <
REF1.ISPLAYER>
        
SERV.LOG @ITEMDEF <REF1.NAMEuid <REF1.UIDhas stepped on a <REF3.NAMEcreated by <REF2.NAMEuid <REF2.UID>
    ENDIF
    RETURN 


The GETHIT trigger and just to note who is who in my GETHIT trigger.
Code:
ON=@GetHit
    REF1=<SERV.UID.<SRC.UID>>    // The one that served the HIT
    REF2=<SERV.UID.<UID>>        // One getting HIT

ANd Below is the code that was added to my get hit trigger.
PHP Code:
    IF <REF2.TAG0.StoodOnUIDSFireField> == <REF2.UID>
        
REF2.TAG.StoodOnUIDSFireField=
        
SERV.LOG @GETHIT <REF2.NAMEstood on own fire field.
        
ARGN1=0
        ARGN2
=0
        ARGN3
=0
        
RETURN 0
    
ELSE
        IF <
REF2.TAG0.StoodOnUIDSFireField>
            
REF1=<SERV.UID.<REF2.TAG.StoodOnUIDSFireField>>
            
SERV.LOG @GETHIT <REF2.NAMEstood on a firefield created by <REF1.NAME>[<REF1.UID>]
            
ARGN2=dam_fire
            REF2
.TAG.StoodOnUIDSFireField=
        ENDIF
    ENDIF 
(This post was last modified: 11-04-2012 03:17 AM by Barnabus.)
11-04-2012 03:11 AM
Find all posts by this user Like Post Quote this message in a reply
Skul
Master
**

Posts: 413
Likes Given: 0
Likes Received: 19 in 15 posts
Joined: Jun 2012
Reputation: 9



Post: #9
RE: Damage to self...
Barnabus, use @spelleffect and @gethit, here's an example:
Code:
on=@spelleffect
if ( <serv.spell.<argn1>.flags> & spellflag_damage ) //spell does damage?
  tag.spell_argn=<argn1> //store the spell number on effected player
endif

on=@gethit
if ( <argn2> & 04 ) //magic damage?
  if (<serv.spell.<tag0.spell_argn>.defname>==s_fire_field) //fire field?
    argn2 |= dam_fire //add fire damage flag
  endif
endif
tag.spell_argn= //erase tag in case of other hit type actions

"I ask a question to the answer I already know."

Marchadium :: http://www.marchadium.ca/ :: Join us!
11-14-2012 02:51 AM
Visit this user's website 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: #10
RE: Damage to self...
This technique will work for "instant" spells... but it won't work for things like firefield etc. So be careful hehe.
11-14-2012 04:27 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)