Game Development Community

Question about an Alternative Energy(type)

by MJ-meo-dmt · in Torque 3D Beginner · 06/12/2013 (11:49 pm) · 6 replies

Hi, people this is my very first post here. "So Hello from South Africa..." :)

I would like to know, how should I go about adding a different energy type. Like say for instance a 'manaPool' or whatever.

or even better if someone that knows how the energy(current) is setup in the source codes, so that I could look at that and then figure it out. I found some things in the source but I'm still bit new to cpp syntax not that its that much different from what I'm used to, being Python. But any case it would be nice to play around with it.

Thanks

MJ

About the author

Open minded; Independent Thinker / Analytical Thinker; A Dreamer; A friend.


#1
06/13/2013 (2:49 am)
Welcome to GG, MJ!

Look about for using energy when sprinting/running and jumping that may give you some clues.

I used energy before for weapons, as a laser weapon and also as a weapon that overheats.

I am pretty sure you can go:
%player.getEnergyLevel();
%player.setEnergyLevel(100);
#2
06/13/2013 (2:54 am)
Here is a section of code I had for an energy weapon:

function FlamerImage::onFire(%this, %obj, %slot)
{
//this is an energy weapon so lets test the energy levels!
%energy = %obj.getEnergyLevel();
if(%energy<1)
{
%obj.playAudio(0,DryFire);
return;
}

%obj.playAudio(0, FlamerFireSound);
%obj.setEnergyLevel(%obj.getEnergyLevel()-1);

...


#3
06/13/2013 (3:16 am)
Thanks for the reply.

Yeah those I have figured out already, hehe... Before I learned about the energy and useEnergy stuff I made ammo to act as energy.

Anyways what I meant was, I want to add another type of energy. Like say a manaPool for the player, so when the player use Spells it uses the mana pool and when he runs it uses the energyPool.

Although now thinking about it. Can this set/use/get energy be object specific? or is the energy 1 global energy?

Like if you add useEnergy on the weapon in the datablock, it uses the energy defined in the player data block. so if I use sprint it draws from the same energy pool right?

Hope I make sense.

Thanks
#4
06/13/2013 (11:35 pm)
Ah I see, you really need to replicate the energy in the engine to be the same but just called Mana. So you need to basically copy and paste all the references in the engine to energy in the player object and make the copied section called Mana.

But yes the energy is on the player object.

Unfortunately most use energy for Mana and not a to have both.
#5
06/13/2013 (11:46 pm)
Yeah please add chi/life-energy so the engine will become more spiritual.
#6
06/14/2013 (12:32 am)
Ah okay, I'll just go search through it again. And then make a clone of it.

Thanks Edward.