Author Topic: NPC floaty text  (Read 528 times)

Legacy_acomputerdood

  • Sr. Member
  • ****
  • Posts: 378
  • Karma: +0/-0
NPC floaty text
« on: April 22, 2012, 03:41:25 am »


               i'm trying to write a script that deals damage to an NPC.  it does the EffectDamage and then does an ApplyEffectToObject(DURATION_TYPE_INSTANT, ...) like normal, but i'd really like the damage to float up above the NPC's head.

i tried a FloatingTextStringOnCreature("12", oCreature, FALSE), but i don't see it.
               
               

               
            

Legacy_Builder__Anthony

  • Full Member
  • ***
  • Posts: 180
  • Karma: +0/-0
NPC floaty text
« Reply #1 on: April 22, 2012, 07:18:01 am »


               i havent scripted in a while but try to see if theres apply effect to creature or something like that a object might be a placeable.lilacs souls script generator should be able to produce it.
               
               

               


                     Modifié par Builder__Anthony, 22 avril 2012 - 06:19 .
                     
                  


            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
NPC floaty text
« Reply #2 on: April 22, 2012, 08:19:12 am »


               The floating test only displays to the creature receiving it and (if the option is selected) members of their own faction.
 As far as I know the only way to do that would be as a SpeakString, which likely wouldn't give the sort of effect you're hoping for.
               
               

               
            

Legacy_acomputerdood

  • Sr. Member
  • ****
  • Posts: 378
  • Karma: +0/-0
NPC floaty text
« Reply #3 on: April 22, 2012, 02:58:07 pm »


               WEAK!

speakstring really wouldn't do what i want.  i was hoping ApplyEffectToObject would deal damage and the nwn engine would take care of the floaty text, but it doesn't seem to be.
               
               

               
            

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
NPC floaty text
« Reply #4 on: April 22, 2012, 04:03:38 pm »


               Doesn't applying damage already float the total amount above creatures?  It certainly works for a Fireball spell, which is just an applied EffectDamage().
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
NPC floaty text
« Reply #5 on: April 22, 2012, 05:53:39 pm »


               

The Amethyst Dragon wrote...

Doesn't applying damage already float the total amount above creatures? It certainly works for a Fireball spell, which is just an applied EffectDamage().



Yes It does,  But it only shows up for the faction that is doing the damage.    Without him posting his script or giving more information about what he is doing, It is hard to tell what he wants. 

My guess is that the is using an item event and the module is applying the damage, Hence the reason he can not see the text for both the applyed effect and the FloatingTextString.
               
               

               
            

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
NPC floaty text
« Reply #6 on: April 22, 2012, 09:38:08 pm »


               That makes sense, Lightfoot8.
               
               

               
            

Legacy_acomputerdood

  • Sr. Member
  • ****
  • Posts: 378
  • Karma: +0/-0
NPC floaty text
« Reply #7 on: April 24, 2012, 11:38:47 am »


               yeah, i always thought it was odd that EffectDamage() wasn't showing the damage, but that makes a lot of sense, Lightfoot8.

in lieu of showing my code, yes, i'm using an item with a "cast spell at (long range)" or whatever that deals the damage.  that does seem to fit the item event and module applying the damage theory.

is there a way to get around the problem?


i see that a couple lines later down in the code, it does:
SignalEvent(oTarget, EventSpellCastAt(oPC, SPELL_MAGIC_MISSILE));

i read that it's a non-damaging event that just gets the target's attention and makes him react to the PC.  likely because it's not the PC doing the original damage like Lightfoot8 suggested.
               
               

               
            

Legacy_acomputerdood

  • Sr. Member
  • ****
  • Posts: 378
  • Karma: +0/-0
NPC floaty text
« Reply #8 on: April 24, 2012, 11:55:10 am »


               i got an idea.  i read on the lexicon (http://www.nwnlexico...fectdamage.html) that "Whoever calls the ApplyEffectToObject with EffectDamage is considered the damager, and the message to players usually names it. Useful to know if you want the PC to be the damager, but another script is performing the task (for example, a unique power)."

my script now has the:

DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oTarget));

line in the normal activate item script (well, in another script called by the activate item.


would it be as simple as having the activate item script call:

ExecuteScript(damage_script, oPC);

that seems to me like it would work.  because then the PC would be the one performing the EffectDamage() and ApplyEffectToObject() calls instead of the module.

it would also seem to me that i could get rid of the aforementioned SPELL_MAGIC_MISSILE stuff, right?
               
               

               


                     Modifié par acomputerdood, 24 avril 2012 - 10:57 .
                     
                  


            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
NPC floaty text
« Reply #9 on: April 24, 2012, 01:27:20 pm »


               You can create the damage effect within a routine assigned to the PC as well.  As in:

DelayCommand (fDelay, AssignCommand (oPC, DoDamage (oTarget) ) );

void DoDamage (object oTarget)
{
 // Effect created and applied to oTarget here.
}
               
               

               
            

Legacy_acomputerdood

  • Sr. Member
  • ****
  • Posts: 378
  • Karma: +0/-0
NPC floaty text
« Reply #10 on: April 24, 2012, 01:59:40 pm »


               nice!  that's even cleaner.  do i have the mess with canceling action states and all that garbage?  i don't like messing with the action queue.

i guess if the delay is like .01 or something miniscule then nothing should be able to interfere.  actually, is there even a reason why i'd have to have a delay command in there?
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
NPC floaty text
« Reply #11 on: April 25, 2012, 02:23:18 am »


               

acomputerdood wrote...

nice! that's even cleaner. do i have the mess with canceling action states and all that garbage? i don't like messing with the action queue.

i guess if the delay is like .01 or something miniscule then nothing should be able to interfere. actually, is there even a reason why i'd have to have a delay command in there?


The code that FB posted does not mess with the action Que.


As far as the reasoning behind the delay command in your code.  I do not know i have not seen your original code.   The only reason I could guess at a need for a delay would be to get the Damage time to mesh with animantion time.
               
               

               
            

Legacy_acomputerdood

  • Sr. Member
  • ****
  • Posts: 378
  • Karma: +0/-0
NPC floaty text
« Reply #12 on: April 25, 2012, 10:40:49 am »


               thanks FB - that did the trick!