Jump to content

Home

Summoning Force Power WIP


DarthSilius

Recommended Posts

My first mod is 80% done, but I'd like some feedback and help. :) If nothing else, take a look at the screenshots below.

 

I wanted to come up with an original offensive force power for lightside characters.

Of course, the lightside can't have it as easy and blunt as a lightning bolt.

So I thought summoning powers would fit pretty well.

 

The basic rules:

 

*As an offensive power, you cast it on a target, and the summoned creature appears next to them.

 

*Recasting causes any existing summoned creature to be replaced by a newly summoned one.

 

*You cannot heal summoned creatures.

 

 

I really wanted to have a Summon Rancor, but I figure they wouldn't fit in most rooms!

 

Summon Gizka

A goofy, but effective power for lower level characters.

The Gizka aren't there to defeat your opponents, but they will distract them and slow them down.

As you advance you gain more Gizka. The games' built-in autobalancing

will improve their stats.

Level 1-4: 1 Gizka

Level 5-8: 2 Gizka

Level 9+: 3 Gizka

 

 

Here's the power I'm serious about...

Summon Jedi Spirit :slsaber:

You call on the spirit of a dead Jedi (ala Obi Wan) to fight for you.

There is an equal chance it will have the appearance of Vrook (scrnshot) (2 Lightsabers),

Yoda(scrnshot) (Short Lightsaber), or Bastila (Double Saber).

 

*It will have a Force Point Cost, Hitpoints, Feats and Force Powers

based on your level.

 

Now for my issues:

 

1) How to make Spirit use force powers (currently does not):

If I grant boss AI either through SetLocalBoolean(obj, SW_FLAG_BOSS_AI, TRUE) or GN_SetSpawnInCondition(SW_FLAG_BOSS_AI),

then it stops fighting. Even if I try to make it attack using ActionAttack(), it still does nothing.

 

 

 

2) If the Spirit survives combat, it stands there.

Here are some potential solutions I have tried and failed:

 

A) Have a time-limit on the spirit:

I thought I was quite clever in using a negative regeneration as a time limit for the spirit.

 

ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectRegenerate(-5, 1.0), OBJECT_SELF);

 

This DOES work. However, when HitPoints<=0, OnDeath does NOT fire, so I cannot DestroyObject.

 

 

B) Have the Spirit go away when combat is over:

Enable OnEndRound event.

 

In OnUserDefine:

if (GetIsInCombat() == FALSE)

DestroyObject(OBJECT_SELF);

 

This works, however, sometimes GetIsInCombat returns false in the middle of combat!

 

C) Have the spirit follow you like a party member?

I don't know how to do this.

 

 

Thanks!

Link to comment
Share on other sites

1) How to make Spirit use force powers (currently does not):

If I grant boss AI either through SetLocalBoolean(obj, SW_FLAG_BOSS_AI, TRUE) or GN_SetSpawnInCondition(SW_FLAG_BOSS_AI),

then it stops fighting.

 

What AI style have you set the creature to? If you set it to NPC_AISTYLE_JEDI_SUPPORT it should use force powers if it has a jedi class and force powers assigned.

 

A) Have a time-limit on the spirit:

I thought I was quite clever in using a negative regeneration as a time limit for the spirit.

ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectRegenerate(-5, 1.0), OBJECT_SELF);

This DOES work. However, when HitPoints<=0, OnDeath does NOT fire, so I cannot DestroyObject.

 

That's a long time bug inherited from the Aurora engine. Regeneration does not count as damage, and as such a creature will not register as being killed if negative regeneration pulls them below 0 hitpoints. I wouldn't recommend doing it since it can cause strange problems, as you've seen.

 

I'd use a variable as a countdown instead in its heartbeat script, and when the counter runs out you destroy the creature.

 

B) Have the Spirit go away when combat is over:

Enable OnEndRound event.

(snip)

This works, however, sometimes GetIsInCombat returns false in the middle of combat!

 

Add an extra check to see if there are any enemies within line of sight in a 30 meter radius if GetIsInCombat returns false, and it should be a bit more reliable. (Creatures won't notice enemies more than 30m away since it's outside their perception range, and the combat AI won't attack enemies more than 30m away unless they are BOSS-flagged.)

 

C) Have the spirit follow you like a party member?

I don't know how to do this.

 

You could assign the spawned creature as a puppet of the force user, and assign it the proper AI scripts (check Remote's creature blueprint). Then it'd follow you around just like Bao-Dur's sidekick. (At least if the power is restricted so Bao-Dur can't use it. Don't know if a character can have more than one puppet assigned.)

Link to comment
Share on other sites

Feel free to look at my lighsaber floating (invisible creatures wielding sabers) and force zombie/jedi ghost force powers: they do most of the things you want, including being destroyed at the end of combat and following you (just set their faction to 2 -party member- no need to create a puppet). However, they are spawned near the player instead of the ennemy.

 

 

OnSpawn script:

#include "k_inc_generic"
void main()
{

//This will make our user-defined event fire
GN_SetSpawnInCondition ( SW_FLAG_EVENT_ON_COMBAT_ROUND_END );              
GN_SetDayNightPresence ( AMBIENT_PRESENCE_ALWAYS_PRESENT );
GN_SetListeningPatterns();  
GN_WalkWayPoints();
}

UserDefined:

#include "k_inc_generic"
#include "k_inc_utility"
void main()
{

   int nUser = GetUserDefinedEventNumber();
   if(nUser == 1003) //
   {
     effect eVFXc = EffectVisualEffect(VFX_IMP_FORCE_BREACH);
//I added this delay as otherwise the sabers would get destroyed too quickly, someitme in the middle of battle if there was no close ennemy
     DelayCommand(24.3,ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVFXc, OBJECT_SELF, 0.7));
     DelayCommand(24.7, DestroyObject(OBJECT_SELF));
    }

}

[/size]

On Heartbeat: don't forget to set the faction in the .utc file to 2 (party member)

#include "k_inc_debug"
#include "k_inc_generic"
#include "k_inc_switch"
#include "k_inc_utility"



void main()
{

           object oEnemy = GetNearestCreature(CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN, OBJECT_SELF, 1, CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY);
           //GN_SetSpawnInCondition(SW_FLAG_SHOUTED_AT, FALSE);

           if(!GN_GetSpawnInCondition(SW_FLAG_AI_OFF) && !GetSoloMode())
           {
               if(GetPartyMemberByIndex(0) != OBJECT_SELF)
               {
                   if(//IsObjectPartyMember(OBJECT_SELF) &&  //Note that this check replaces GetIsObjectValid(oMaster)
                      //GetCurrentAction(OBJECT_SELF) != ACTION_FOLLOW &&
                      GetCurrentAction(OBJECT_SELF) != ACTION_MOVETOPOINT &&
                      //GetCurrentAction(OBJECT_SELF) != ACTION_WAIT &&
                      GetCurrentAction(OBJECT_SELF) != ACTION_FOLLOWLEADER &&
                      !GetIsConversationActive() &&
                      //GetDistanceBetween(OBJECT_SELF, GetPartyMemberByIndex(0)) > 4.5 &&
                      !GN_GetSpawnInCondition(SW_FLAG_SPECTATOR_STATE) &&
                      GetCommandable())
                   {
                       //Db_PostString(GetTag(OBJECT_SELF) + " HEARTBEAT CHECK 1 PASS", 4, 10, 2.0);
                       if(!GN_GetIsFighting(OBJECT_SELF) && !GetIsObjectValid(oEnemy))
                       {
                           //Db_PostString(GetTag(OBJECT_SELF) + " HEARTBEAT CHECK 2 PASS", 4, 12, 2.0);
                           //The distance checking is now down in the script fired from AI Action Update - Leave 5m Radius of party leader.
                           ClearAllActions();
                           ActionMoveToObject(GetFirstPC(), TRUE);
                       }
                   }
               }
           }
           else if(GetSoloMode() && GetCurrentAction(OBJECT_SELF) == ACTION_FOLLOWLEADER)
           {
               ClearAllActions();
           }
           if(GN_GetSpawnInCondition( SW_FLAG_EVENT_ON_HEARTBEAT ))
           {
               SignalEvent(OBJECT_SELF, EventUserDefined(1001));
           }


  int iCheck = GetLocalNumber(OBJECT_SELF, 1);
  if (iCheck <= 7)
  {
     SetLocalNumber(OBJECT_SELF, 1, (iCheck + 1)); 
  }
  else
  {
     effect eVFXc = EffectVisualEffect(VFX_PRO_RESIST_ELEMENTS);
     ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVFXc, OBJECT_SELF, 1.3);

     DestroyObject(OBJECT_SELF);
  }
}

 

Edit: If for a reason or another you want to create a puppet, check this thread: http://www.lucasforums.com/showthread.php?s=&threadid=144975

Link to comment
Share on other sites

LOL!

Thanks Darth (and Stoffee)!

 

:newbie:

A lesson to all newbie modders (such as me).

 

1) Think of mod idea

 

2) Read Tutorials

 

3) Browse through the many fine mods already out there and look for examples similar to your mod idea.

 

I skipped step 3 and wasted many an hour.

 

What's hysterical is, I was originally going to use the floating sabers (already implemented by Darth333).

 

I still think the hologram Jedi look sweet, so I shall proceed, reusing as much of D333's code as possible. Perhaps I'll make it easily configurable so folks can summon whatever they want.

 

In my defense, it appears I had a lot of the right ideas which relied on OnHearbeat, but I had issues whenever I enabled that event. I'm sure all the answers are in D3's code.

 

P.S. Stoffee -- Looking at my blob of commented out failures, it appears I had tried NPC_AISTYLE_PARTY_SUPPORT. So hopefully NPC_AISTYLE_JEDI_SUPPORT will git-r-done.

 

Thanks all

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...