Jump to content

Impact system


LukasPJ

Recommended Posts

This is the Impact System from the SpellSystem I created. It's an useful system for, well having an impact on the scene.. Like do something to all enemies in a box, or do something multiple times over a duration. It was created with spells in mind, but can probably be used for other things.


There are 5 available impact classes:

  • AOEImpact - Circular impact
  • BoxImpact - What it says on the tin
  • CubeImpact - Likewise
  • ConeImpact - Likewise
  • DOTImpact - Happens x times with [y] milliseconds interval between each impact

Examples of use (from my spellsystem examples):

%aoe = new ConeImpact(){       
   SourceObject = %src;       
   Start = %pos;
   End = VectorAdd(%pos, VectorScale(%eye, 10));     
   Radius = 2;
   TypeMask =  $TypeMasks::StaticShapeObjectType |                    
               $TypeMasks::StaticTSObjectType;       
   CallBack = "ConeCallback";    
};   
 
function ConeImpact::ConeCallback(%this, %src, %tgt) 
{    
   %projectile = ImpactProjectile;    
   ThrowHomingBezierProjectile(%src,%tgt,%projectile,true,"0 0 12"); 
}

 

%dotimpact = new DOTImpact(){
  TickMS = 100;
  TickCount = 15;
 
  CallBack = "FrostBarrageCB";
  sourceObject = %spell.getSource();
 
  // Dynamic variables
  Target = %spell.getTarget();
};
 
function DOTImpact::FrostBarrageCB(%this, %src)
{
   %weights = GetRandomVector(-3, 3, -3, 3, 0, 3);
   ThrowHomingBezierProjectile(%src, %this.Target, FrostShardProjectile, true, %weights);
}

 

Make these changes to the SceneContainer, and then download the files in: Impacts.zip and add them to the project.

Link to comment
Share on other sites

@Lukas:


Tried using your suggestion but Cone, Cube and BoxImpact all have the same error:

 

c:\torque\363_vehiculo\my projects\vehiculo363\source\t3d\impacts\boximpact.cpp(37): error C2039: 'initBoxSearch' : is not a member of 'SceneContainer'
16>          c:\torque\363_vehiculo\engine\source\scene\scenecontainer.h(138) : see declaration of 'SceneContainer'

 

Are there other changes I need to make?

Link to comment
Share on other sites

Ah Snap! I'd commented those changes out troubleshooting and forgot to uncomment them. I got past the previous error, now I get:

 

16>     Creating library ../../../game/Vehiculo363_DEBUG DLL.lib and object ../../../game/Vehiculo363_DEBUG DLL.exp
16>DOTImpact.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Impact::interpolateTick(float)" (?interpolateTick@Impact@@UAEXM@Z)
16>Impact.obj : error LNK2019: unresolved external symbol "public: virtual void __thiscall Impact::interpolateTick(float)" (?interpolateTick@Impact@@UAEXM@Z) referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::assign(char const *)" (?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBD@Z)
16>AOEImpact.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Impact::interpolateTick(float)" (?interpolateTick@Impact@@UAEXM@Z)
16>BoxImpact.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Impact::interpolateTick(float)" (?interpolateTick@Impact@@UAEXM@Z)
16>ConeImpact.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Impact::interpolateTick(float)" (?interpolateTick@Impact@@UAEXM@Z)
16>CubeImpact.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Impact::interpolateTick(float)" (?interpolateTick@Impact@@UAEXM@Z)
16>DOTImpact.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Impact::processTick(void)" (?processTick@Impact@@UAEXXZ)
16>Impact.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Impact::processTick(void)" (?processTick@Impact@@UAEXXZ)
16>AOEImpact.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Impact::processTick(void)" (?processTick@Impact@@UAEXXZ)
16>BoxImpact.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Impact::processTick(void)" (?processTick@Impact@@UAEXXZ)
16>ConeImpact.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Impact::processTick(void)" (?processTick@Impact@@UAEXXZ)
16>CubeImpact.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Impact::processTick(void)" (?processTick@Impact@@UAEXXZ)
16>../../../game/Vehiculo363_DEBUG DLL.dll : fatal error LNK1120: 2 unresolved externals

 

AOETmpact didn't have an include for IPScore, so I think I may have a different problem - any ideas?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...