Mage Duel system
#1
Posté 06 août 2012 - 08:34
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
Posté 06 août 2012 - 08:57

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)
Modifié par Carcerian, 06 août 2012 - 09:11 .
#3
Posté 06 août 2012 - 12:55
Baaleos wrote...
Any ideas?
Have you tried just a single invisible creature, that moves back and forth between the casters.
#4
Posté 06 août 2012 - 04:26
#5
Posté 06 août 2012 - 09:58
.
#6
Posté 06 août 2012 - 11:10

(perhaps by a small "self-destruct" aoe effecting only one of the two casters)
Modifié par Carcerian, 06 août 2012 - 11:25 .
#7
Posté 06 août 2012 - 11:16
#8
Posté 06 août 2012 - 11:24
#9
Posté 07 août 2012 - 03:34
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
Posté 07 août 2012 - 04:02
Yes I know my tracking was off a bit.
#11
Posté 07 août 2012 - 05:55
#12
Posté 07 août 2012 - 09:03
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
Posté 07 août 2012 - 10:29
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
Posté 07 août 2012 - 10:38
#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
Posté 07 août 2012 - 10:49
Modifié par Lightfoot8, 07 août 2012 - 10:50 .
#16
Posté 07 août 2012 - 10:52
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
Posté 07 août 2012 - 11:13
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
Posté 07 août 2012 - 11:19
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
Posté 08 août 2012 - 02:10
#20
Posté 08 août 2012 - 03:03
Modifié par ffbj, 08 août 2012 - 03:08 .
#21
Posté 08 août 2012 - 01:02
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
Posté 15 août 2012 - 02:05
it looks great!
#23
Posté 17 août 2012 - 11:59
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
Posté 17 août 2012 - 01:22
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
Posté 17 août 2012 - 01:34
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.





Retour en haut







