Author Topic: Meditation Time  (Read 402 times)

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
Meditation Time
« on: April 14, 2012, 12:02:21 am »


               How can I speakstring the duration a player was in an animation loop?

for example.

[code=auto:0]

object oPC;oPC = GetItemActivator(); AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_MEDITATE, 1.0f, 120.0f));//wont need this time as it could be ongoing until the player is interupted.
[code=auto:0]

Any suggestions?
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Meditation Time
« Reply #1 on: April 14, 2012, 12:23:15 am »


               You want to determine the length of time a character was in an animation loop immediately after they exit the looping animation?

I think first you need to timestamp the PC the moment they enter the animation. So just before you assign the command to play the animation, set an int on the PC that represents GameTime in seconds. Lets call this int the meditation timestamp.

You also I think need to create a user defined event that will catch any action by the player which will end the animation state.

In the user defined event you would get the meditation timestamp and subtract it from current GameTime in seconds. This would be the length in seconds that the PC was in the looping animation.

The tricky part is defining the user defined event properly, and turning this event catching on or off. Without the toolset in front of me I am unable to puzzle it out.
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Meditation Time
« Reply #2 on: April 16, 2012, 10:33:27 am »


               One other possible option woud be to do a recursive script that adds time to an int variable on the PC until they move (location changes). Might not be the best solution but it works:


void ActionTimerCheck(object oPC, location lCheck)
{
    int iMedTime = GetLocalInt(oPC, "MEDITATE_TIME");
    SetLocalInt(oPC, "MEDITATE_TIME", iMedTime + 1);
    //SendMessageToPC(oPC, "1 second meditation time has been added.");
    location lCurrent = GetLocation(oPC);
    if (lCurrent == lCheck)
    DelayCommand(1.0, ActionTimerCheck(oPC, lCheck));
}

void main()
{
    object oPC = GetLastUsedBy();
    AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_MEDITATE, 1.0, 10000.0));
    DelayCommand(3.0, ActionTimerCheck(oPC, GetLocation(oPC)));
}


P.S. This script would be for the OnUsed event of an object. Then later when you need to check how long they were meditating you would just do a: GetLocalInt(oPC, "MEDITATE_TIME");
               
               

               


                     Modifié par GhostOfGod, 16 avril 2012 - 09:39 .
                     
                  


            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
Meditation Time
« Reply #3 on: April 16, 2012, 01:20:49 pm »


               I suppose this has some good RP Value. '<img'>

Anyway, it would probably be far easier to have the PC touch something to start the animation, create a tracks trigger around the device, so if they move away from the device that they touch to start the animation, you know instantly that they stopped...

All you would need to do is set an int on the PC based upon the module minute and hour, and then have the tracks trigger calculate time spent based upon current game time...

Naturally the reward for meditation would probably be handled by this tracks trigger script too, and you will want to turn off that the PC is "meditating" so the script doesn't fire multiple times...

Furthermore, you would have to check to see if the variable is on the PC to start meditating so that the tracks trigger doesn't fire when the PC crosses it to go meditate...

Just some pointers..
               
               

               
            

Legacy_SHOVA

  • Hero Member
  • *****
  • Posts: 893
  • Karma: +0/-0
Meditation Time
« Reply #4 on: April 16, 2012, 01:40:22 pm »


               I admit I do not understand what the OP is after, If it is to speak string while the PC is in an animation that is a simple line of code. If you want the PC to be unable to break the animation, use a cut scene. In the cut scene you can have the speak sting line, or lines. You can advance time, though if your mod is multi-player it might get wonky for others.
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Meditation Time
« Reply #5 on: April 16, 2012, 02:57:36 pm »


               If you're talking just about finding out when they start moving, then you apply a null (-1) AOE to the PC with the OnExit script comparing the current time to a timestamp made on the PC when the animation started.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Meditation Time
« Reply #6 on: April 16, 2012, 04:27:23 pm »


               Ah... good one FB. Using AOE's is something I need to do more often.
               
               

               
            

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
Meditation Time
« Reply #7 on: April 16, 2012, 09:33:55 pm »


               I'll be having a unique power that does d4 roll damage + the time meditated before cast. Kind of like a concentration or a 'build up' found in other games. So if a user 'meditates for say 10 seconds, the unique power will do d4 + 10. What I'm not sure how to do is how to keep track of the time a player "meditates" in one place without moving.

Thanks for the suggestions guys, I'll take a better look at them when I get home. THanks again!
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
Meditation Time
« Reply #8 on: April 17, 2012, 12:02:02 am »


               

Buddywarrior wrote...

I'll be having a unique power that does d4 roll damage + the time meditated before cast. Kind of like a concentration or a 'build up' found in other games. So if a user 'meditates for say 10 seconds, the unique power will do d4 + 10. What I'm not sure how to do is how to keep track of the time a player "meditates" in one place without moving.

Thanks for the suggestions guys, I'll take a better look at them when I get home. THanks again!


OK, now it's starting to make "a little" more sense, it's best to always state what you are planning with your request, otherwise we have to guess exactly what you are doing...

Therefore I need to ask a question...

What will trigger the "mediation"?  Will it be a spells script?  A placeable object?

Get back to us with more details about your system, thanks..
               
               

               
            

Legacy_Builder__Anthony

  • Full Member
  • ***
  • Posts: 180
  • Karma: +0/-0
Meditation Time
« Reply #9 on: April 17, 2012, 03:43:59 am »


               I think haven the player in a cutscene is a very good idea i think it would give it more of a true meditation fee to it.I know cutscenes can also be a real pain to fine tune but there well worht it in the end.I dont know what angle wold be best for it because if a pc decides to meditate in a hall it could cause camera issues with not being able to see your guy if hes zoomed in.But i do think this is one of those gresat ideas that has poped up on the boards.
               
               

               
            

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
Meditation Time
« Reply #10 on: April 17, 2012, 11:31:53 pm »


               The trigger is a unique power called Meditation. It's to simulate meditation in classic EverQuest. You med, you're blind, and you hope nothing comes beating up on you and interrupts your meditation. If it's not something I'm able to do then I'll find another solution.
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
Meditation Time
« Reply #11 on: April 18, 2012, 05:04:44 pm »


               

Buddywarrior wrote...

The trigger is a unique power called Meditation. It's to simulate meditation in classic EverQuest. You med, you're blind, and you hope nothing comes beating up on you and interrupts your meditation. If it's not something I'm able to do then I'll find another solution.



Hmmm, this is a rather complex request...

I think the best way to handle it, is like Ghost of the God said, use a re-occuring script....
Set a variable on the PC every time they pass a concentration check...
You would naturally want to roll the concentration check within the re-occuring script..

Then, once the variable on the PC has reached X (meaning X minutes or seconds of successful mediation), then you would actually cast the spelld or do the function you desire to happen...

Hope that helps...
               
               

               
            

Legacy_Leurnid

  • Sr. Member
  • ****
  • Posts: 473
  • Karma: +0/-0
Meditation Time
« Reply #12 on: April 18, 2012, 05:11:19 pm »


               Universal Spirit Bomb?