Aller au contenu

Photo

Mage Duel system


  • Veuillez vous connecter pour répondre
28 réponses à ce sujet

#1
Baaleos

Baaleos
  • Members
  • 1 329 messages
I've started working on an idea - inspired by Harry Potter and by a Mage Duel system from Skyrim.





Basically - the way I planned on implimenting this was

Spellhook - on hostile spell cast - mark the caster as both casting a spell, and casting the spell on the target.
Remove this variable/flag after 4 seconds.

When the target, targets his own hostile spell on the first player, the system detects from the flag/markers that the first player was casting a hostile spell at the current player.

This initiates the duel.


The way I tried to do this, was to spawn numerous invisible objects in a straight line from caster1 to caster2.
Then, we get the middle one.

Both players are told via script to apply a visual effect / beam to that same node.

The winner of the duel depends on who has the higher spellcraft.
I was trying to impliment a pseudo heartbeat, that would fire the same update function each time.
This function would increment the number (if the caster is a winner) - until the number = the max amount of nodes. 
If the caster is the loser - then the number decreases until it gets to 0.

0 =  The beams converge close to the caster (who initiated the duel)  (Caster Loses)
NodeCount = The beams converge close to the opponent.    (Caster Wins)


I am having some success with this, but I am finding that when I fire my function to test it all out.
My pseudoloops fire, and calculate my winners etc,
But the visual representations seem to be delayed by several minutes.

Eg - Fire function
Debug Messages fire
but then it is like 4 minutes before the visual effects fire, and even then, sometimes the beams tend to stick/stay on - despite only being given a duration of 0.35 seconds.

Anyone know a better way of doing this?

The only thing that I can think of that might be causing it, is that the nodes tend to number 300 in maximum count.
Meaning it is trying to go from 150 all the way to 0, or 150 all the way to 300 etc
(This gives a smooth change in Convergence point.)



Anyway - when the duel is over, the loser is typically blasted with damage.

Any ideas?

#2
Carcerian

Carcerian
  • Members
  • 1 108 messages
You are talking basically about a "Wizard-Beam-Battle?"

Posted Image

A beam moving back and forth sounds awesome, or an easier alternative might be to use multiple beams, the first person to get 3 beams wins. (1 = dim, 2 = med, 3 = bright).

Depending on the setting, "freezing" the combats and using simulated combat (ie arcanespace/d20/no-dance of death mods) might make life easier as well...

If it helps, check out Prismatic Ray/Shield (and other goodies) in Custom Magic Items (Variable Based)

Posted Image

Modifié par Carcerian, 06 août 2012 - 09:11 .


#3
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

Baaleos wrote...

 Any ideas?



Have you tried just a single invisible creature, that moves back and forth between the casters.

#4
henesua

henesua
  • Members
  • 3 863 messages
I like this idea. OTR needs to speak up here about nodes and beams. :)

#5
eeriegeek

eeriegeek
  • Members
  • 47 messages
Using a creature is a great idea, with the CEP using other tail/wing effects added to the invis creature, you can also get some extra special effects at the beam intersection.
Posted Image.

#6
Carcerian

Carcerian
  • Members
  • 1 108 messages
:devil: And when it gets too close to a caster it explodes?

Posted Image

(perhaps by a small "self-destruct" aoe effecting only one of the two casters)

Modifié par Carcerian, 06 août 2012 - 11:25 .


#7
Shadooow

Shadooow
  • Members
  • 4 468 messages
I like the idea except... if the winner is one with higher spellcraft, where is the player skill? That would be totally boring this way.

#8
Carcerian

Carcerian
  • Members
  • 1 108 messages
There could be shields, and possibly a rock paper scissors kind of everything can be foiled by something else idea? (fire has bonus vs cold, cold vs acid, etc)

#9
_six

_six
  • Members
  • 919 messages
How about a conversation system that allows the player to select between any element (ie damage type) they have a prepared spell in, changing their beam's type at any time during the duel, coupled with a fast iterating pseudo heartbeat that determines which player's beam will prevail in that scenario, with the rock paper scissors style logic. The collision moves closer to the player with the weaker beam type every second or so, and explodes when it reaches one end. If a losing player changes their beam type during the duel to a more suitable one via the conversation, the beam will head in the opposite direction.

Rinse & repeat beam re-selection until one player doesn't have an available counter and is forced to concede.


Incidentally regarding the beam target objects, you should only ever need one at a time. If you're getting slight delays by deleting that and spawning the new one each time, perhaps spawn in 3 (the currently affected one, and one on either side).

Modifié par _six, 07 août 2012 - 03:38 .


#10
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
A Quick test using a Will-O'-Wisp for the creature



Yes I know my tracking was off a bit.

#11
The Amethyst Dragon

The Amethyst Dragon
  • Members
  • 1 877 messages
Nice idea! And the test video looks like it works well with a "target" creature in the middle.

#12
Baaleos

Baaleos
  • Members
  • 1 329 messages
One of the original ideas I had, was that there could perhaps be a fastest finger first sort of contest.

or Reaction based test.
eg- The invisible creature could say something, and both casters have to repeat it.
The caster who says it first, wins a point.
First to reach perhaps 10 points, wins?


Im gonna try the invisible creature approach - does anyone have any code snippets that can return a location exactly equedistant from two casters - eg - in the middle?
After that  - I think ForceFollow can be used to get the creature to move x towards the desired target.

Modifié par Baaleos, 07 août 2012 - 09:07 .


#13
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

Baaleos wrote...


Im gonna try the invisible creature approach - does anyone have any code snippets that can return a location exactly equedistant from two casters - eg - in the middle?



location GetGeometricMean( object oObject1, object oObject2)
{
  object oArea = GetArea(oObject1);

  vector vMean = (GetPosition(oObject1) + GetPosition (oObject2))/2.0;

  return Location( oArea,vMean,GetFacing(oObject1));
}

#14
Baaleos

Baaleos
  • Members
  • 1 329 messages
I managed to use

#include "x0_i0_position"
float fDist = GetDistanceBetween(oCaster,oTarget);
location l = GenerateNewLocation(oCaster, fDist/2, GetFacing(oCaster), GetFacing(oCaster));


Here is the effect I managed to get.
Note - I wish the purple star vfx from CEP was a few inches higher - so it would go perfectly in the center of the beams interlocking.




If anyone is wondering about the music - I added magical harps to player homes in my server - allowing the players to change their own area music.
This particular track is from the credit roll of Lands of Lore 3 - A great, if not buggy, game series.

Modifié par Baaleos, 07 août 2012 - 10:38 .


#15
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Video is still processing. So while I wait. I am not 100% on your function, The reason is that it requires the PC to be facing the correct angle to begin with. If he is turned just a little to the side, Over a good distance, your position may be well off.

Modifié par Lightfoot8, 07 août 2012 - 10:50 .


#16
henesua

henesua
  • Members
  • 3 863 messages
One issue with the creature...
you can't have a mage duel across a chasm as the creature wouldn't be able to walk back and forth.

Just FYI.

#17
Baaleos

Baaleos
  • Members
  • 1 329 messages
Good point @ Henesua

Yeah video is finished processing.
I managed to get the function to force the player and target to face eachother, and then the creature is generated via AssignCommand(ActionDoCommand(Part2())) etc
So - in theory, the creatures creation is added to action queue, which should follow directly after the player finishes the turn to face.

As for the gap/gorge problem.
I dont think there is any function that can determine 'is walkable', or 'can get to'

Function I have - uses a peseudo loop to determine the distance between caster and center, and target and center.
If the distance for one of them is less than 1.75, then it explodes.
If - in the scenario you point out, that the creature can never get to either creature, then it would in theory go indefinitely.

Would need to code in a max time limit etc.

#18
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Well, If you do end up having problems with the mean, Perhaps in cases where the target is moving, Try the function I posted above.
 
EDIT:  Forgot to say, the video looks really good.

Or if you wanted just one line of code instead of the function

...
location l = Location( GetArea(oCaster), (GetPosition(oCaster) + GetPosition (oTarget))/2.0, GetFacing(oCaster));

Modifié par Lightfoot8, 08 août 2012 - 02:13 .


#19
Carcerian

Carcerian
  • Members
  • 1 108 messages
Awesome vid indeed!

#20
ffbj

ffbj
  • Members
  • 593 messages
As long as it's an invisible creature you could add the effect appear/disappear to a random waypoint within the vicinity of the two mages, closer to the one who was losing, however that is determined. In this way the beam effects would follow it, the creature up and down. Have some sort of conditinal so it does not happen all that often. Oh and the video was the cat's meow.

Modifié par ffbj, 08 août 2012 - 03:08 .


#21
Baaleos

Baaleos
  • Members
  • 1 329 messages
Thx for the comments on the vid

I also had an idea to add EffectBeams with the miss boolean set to true.

It would be like Voldemort vs Dumbledore - where he tries to shoot lightning bolts past him, to hit Harry.

I think if the pseudo hb on the creature, was configured to randomly shoot 'Miss' beams towards the caster/target - then it would look like beams are flying to the side of the caster / target, giving the impression of a much busier scene.
Im unsure of the logic for the beam miss function - I think it tends to shoot the miss beams towards the target, but with an angle offset of up to 45 degrees or something.
Eg- the beams are always in the general direction of the target, but never hitting the target.

In addition to this - might be able to make it so that energy that shoots out of the center does damage/explosions to the ground etc.

#22
acomputerdood

acomputerdood
  • Members
  • 219 messages
were you planning to release any of the code to produce these visual effects? it would be nice not having to recreate them for myself.

it looks great!

#23
Baaleos

Baaleos
  • Members
  • 1 329 messages
I will have a look for the script when I get home.
I kinda suffered a module corruption - inside the module I use for creating stand-alone scripts for inclusion via resman.


#include "inv_spells_inc"
#include "nwnx_funcs"
#include "mage_duel_inc"

void main()
{
    object oCaster = OBJECT_SELF;

    object oTarget = GetLocalObject(oCaster,"INV_TARGET");
    if(GetResRef(oTarget)=="beam_intersec")
    {
        DestroyObject(oTarget,0.75);
        return;
    }
    StartDuel(oCaster,oTarget);


}



Litterally, all I have at the moment infront of me, is this - which shows that the majority of the code is contained inside mage_duel_inc

I was only really investigating this, as a potential system to develop - so yeah, I will make what I have so far public, but its gonna be very rough around the edges - Havent worked on it for about a week.
Been working on a new Subrace inspired by the Faeries from True Blood - which is actually really fun to develop.
I gave them 'Light' magic - which is essentially like a mana meter, and while they have 75% light magic or above, they get unlimited spells (their spells for that spell level replenishes, after a spell cast)
And they get light blasting powers,
ability to open portals to a Fae Realm etc
Very fun to make - will include a video of them too

#24
acomputerdood

acomputerdood
  • Members
  • 219 messages
i'm really only interested in the mechanics of how the visuals work, and yeah, it looks like most of that will be in mage_duel_inc.

i understand if you wouldn't want to release something - just know that i'll be doing my best to copy your system from the video! haha.

thanks for saving me a bunch of work, though :)

#25
Baaleos

Baaleos
  • Members
  • 1 329 messages
most of the complex stuff is just to figure out where the place the creature.

Once you have that, just do
CreateObject to make the creature
make sure its friendly to both players - so it doesnt attack them

Then calculate who the winner is

then instruct the creature to walk towards the loser

I use a pseudo loop that checks the distance between caster and target
whoever gets within 2ft of the creature, receives the damage from the explosion etc

The beams are done by the creature,
(he is the effect creator)
so the beams come from the creature, and hit both the caster and target

The damage from the explosion has to be created by the winner - to give the winner credit for any deaths


But yes- hopfully my mage_duel_inc is intact, and I will release it here later tonight.