Impact system

Scripts and code that enhance the gameplay functionality of the engine.
  • 1
  • 2
13 posts Page 1 of 2
LukasPJ
Site Admin
Posts: 388
Joined: Tue Feb 03, 2015 7:25 pm
 
by LukasPJ » Thu Feb 26, 2015 6:01 pm
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
(6.48 KiB) Downloaded 109 times
and add them to the project.
Gibby
Posts: 72
Joined: Wed Feb 11, 2015 2:40 pm
by Gibby » Sat Feb 28, 2015 8:05 pm
Do I need this to make it work?

from ConeImpact:

Code: Select all

#include "T3D\fx\ImprovedParticle\IPSCore.h"
LukasPJ
Site Admin
Posts: 388
Joined: Tue Feb 03, 2015 7:25 pm
 
by LukasPJ » Sun Mar 01, 2015 1:46 am
Do I need this to make it work?

from ConeImpact:

Code: Select all

#include "T3D\fx\ImprovedParticle\IPSCore.h"
I don't think so.. I may have been in a bit of a hurry to get it out there, try deleting that line, it should be okay :P
Gibby
Posts: 72
Joined: Wed Feb 11, 2015 2:40 pm
by Gibby » Sun Mar 01, 2015 1:23 pm
@Lukas:

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

Code: Select all

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?
LukasPJ
Site Admin
Posts: 388
Joined: Tue Feb 03, 2015 7:25 pm
 
by LukasPJ » Mon Mar 02, 2015 10:29 pm
@ Gibby did you remember to make these changes? They might be a little hard to notice in the post :)
Gibby
Posts: 72
Joined: Wed Feb 11, 2015 2:40 pm
by Gibby » Tue Mar 03, 2015 9:46 pm
Ah Snap! I'd commented those changes out troubleshooting and forgot to uncomment them. I got past the previous error, now I get:

Code: Select all

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?
LukasPJ
Site Admin
Posts: 388
Joined: Tue Feb 03, 2015 7:25 pm
 
by LukasPJ » Wed Mar 04, 2015 1:47 am
@ Gibby that seems it's the same issue as with the Tweening.

Just change Impact.h line 22-23 to this:
virtual void interpolateTick( F32 delta ) {};
virtual void processTick() {};
Gibby
Posts: 72
Joined: Wed Feb 11, 2015 2:40 pm
by Gibby » Wed Mar 04, 2015 7:04 pm
@
User avatar
LukasPJ
: AHHHH YEAH! Thank you so much for sharing this...
Gibby
Posts: 72
Joined: Wed Feb 11, 2015 2:40 pm
by Gibby » Thu Mar 05, 2015 4:46 pm
@
User avatar
LukasPJ
: 'Nother question: Is it possible to mount an impactCone to an object? i'd like to attach one to a rocket to simulate the thrust exhaust...
LukasPJ
Site Admin
Posts: 388
Joined: Tue Feb 03, 2015 7:25 pm
 
by LukasPJ » Thu Mar 05, 2015 6:17 pm
@
User avatar
Gibby
such that the exhaust of the rocket deals damage?
  • 1
  • 2
13 posts Page 1 of 2

Who is online

Users browsing this forum: No registered users and 1 guest