visualize a process of a reload a gun
by genomegames · in Torque 3D Professional · 12/17/2010 (1:25 am) · 18 replies
Hello everybody!
I wanna visualize a process of a reload a gun: progress bar is loading while a timeout between gunshots. There are two weapon types in my game and each type has different timeout value (this value is determined in FSM). How can I get this value when a game is running?
Thank you for your time!
Sorry for my bad English
I wanna visualize a process of a reload a gun: progress bar is loading while a timeout between gunshots. There are two weapon types in my game and each type has different timeout value (this value is determined in FSM). How can I get this value when a game is running?
Thank you for your time!
Sorry for my bad English
About the author
#3
12/17/2010 (2:11 am)
May the Great Noodle forgive me; I am totally ignorant about the details of your FSM to offer any real help, I expect you need an TGB person (or I still do not understand...Or are you talking about AI???) and I am hardly a person at all, but now i know what FSM stands for, so thank you there.
#4
12/17/2010 (2:36 am)
FSM is used by ShapeBaseImageData class for change weapon states
#5
12/17/2010 (4:09 pm)
The FSM for weapons can have animations - but the FSM animates the weapon only. You could play a script that makes the weapon's Ai/Player do an animation.stateSequence[#] = "reload";//animation on the weapon statescript[#] = "doReload";//start script function
#6
One may use "ShapeBaseImageDataNAME".dump(); to view that ShapeBaseImageData datablock.
For RocketLauncher it would be RocketLauncherImage.dump();
Knowing this, if you wish for stateTimeoutValue[1] you could do echo(RocketLauncherImage.stateTimeoutValue[1]); from the console.
This shows how to get the data from the ShapeBaseImageData datablock. The ShapeBaseImageData state machine also have script function callbacks as exampled in scripts/server/rocketLauncher.cs, but to fully understand the depth and flexibility of the ShapeBaseImageData state machine, one would need a quick study of the C'code (filename T3DshapeImage.cpp ).
Im quite sure what you need is easy and possible, and hopefully I have offered some clues.
EDIT: expansion on the script function callbacks...
stateName[1] = "STATENAME";
This state function call back would be...
function RocketLauncherImage::STATENAME(%this)
{
...Do magic game stuff for STATENAME condition...
}
Now anytime the RocketLauncherImage is in the STATENAME state, that function is called.
12/17/2010 (8:12 pm)
I am using an clean fresh FPS project build. One may use "ShapeBaseImageDataNAME".dump(); to view that ShapeBaseImageData datablock.
For RocketLauncher it would be RocketLauncherImage.dump();
Knowing this, if you wish for stateTimeoutValue[1] you could do echo(RocketLauncherImage.stateTimeoutValue[1]); from the console.
This shows how to get the data from the ShapeBaseImageData datablock. The ShapeBaseImageData state machine also have script function callbacks as exampled in scripts/server/rocketLauncher.cs, but to fully understand the depth and flexibility of the ShapeBaseImageData state machine, one would need a quick study of the C'code (filename T3DshapeImage.cpp ).
Im quite sure what you need is easy and possible, and hopefully I have offered some clues.
EDIT: expansion on the script function callbacks...
stateName[1] = "STATENAME";
This state function call back would be...
function RocketLauncherImage::STATENAME(%this)
{
...Do magic game stuff for STATENAME condition...
}
Now anytime the RocketLauncherImage is in the STATENAME state, that function is called.
#7
...and it might get a bit tricky to get the art right...as in, on the PlayerClass object, what type of animation[armThread/actionThread] and in what Thread to run it, and what animation Type[blend/not] to run to make it look good...
...this type of structure would make for a good 'Resource'?!!
...or change the Player object class to accept a direct link from the image as in the 'recoil' animation, already in use, just not extended to a state beyond 'recoil' of the weapon, making sure it works across the network; this is what I think Caylo is looking for, no? as am I! lol Always wanted to see an 'official' scripting of these events.
12/18/2010 (5:00 pm)
...and the function that would animate the PlayerClass object...would need to be in the form of a callback on the object, am I right?...and it might get a bit tricky to get the art right...as in, on the PlayerClass object, what type of animation[armThread/actionThread] and in what Thread to run it, and what animation Type[blend/not] to run to make it look good...
...this type of structure would make for a good 'Resource'?!!
...or change the Player object class to accept a direct link from the image as in the 'recoil' animation, already in use, just not extended to a state beyond 'recoil' of the weapon, making sure it works across the network; this is what I think Caylo is looking for, no? as am I! lol Always wanted to see an 'official' scripting of these events.
#8
I asked about another thing, but I thank you anyway!
Now I working on another thing, I'll return to this question in a few time.
12/18/2010 (5:46 pm)
Thank you for your time guys!I asked about another thing, but I thank you anyway!
Now I working on another thing, I'll return to this question in a few time.
#9
I didn t dig yet into it, but i thought it was how to setup a weapon reload séquence and not to have a script calling the Sequence for the player and the state machine driving the weapon séquence.
12/18/2010 (10:00 pm)
Can't the weapon animation have bones animation in it? I think the grenade launcher or the rocket launcher have both weapon & bones animation in the dts. I didn t dig yet into it, but i thought it was how to setup a weapon reload séquence and not to have a script calling the Sequence for the player and the state machine driving the weapon séquence.
#10
My example have nothing to do with controlling any animation, that task is already a built in feature of the ShapeBaseImageData state machine.
12/19/2010 (12:17 am)
Perhaps I am misunderstanding the subject of inquiry from the original question; what I had thought was about reading the data already contained in the ShapeBaseImageData state machine datablock... Quote:...each type has different timeout value (this value is determined in FSM). How can I get this value when a game is running?
My example have nothing to do with controlling any animation, that task is already a built in feature of the ShapeBaseImageData state machine.
#11
12/19/2010 (3:43 pm)
Yeah! You are right Caylo, I was about to get a data from FSM of ShapeBaseImageData
#12
I have a GuiProgressCtrl and when I shoot, GuiProgressCtrl value becomes 0, then a value begins to grow up until it less than the maximum value. My weapon has an one second delay between shots. How to find a count of percent to grow each moment? How to find a count of milliseconds in a moment?
12/26/2010 (6:18 pm)
How to implement a delay after firing?I have a GuiProgressCtrl and when I shoot, GuiProgressCtrl value becomes 0, then a value begins to grow up until it less than the maximum value. My weapon has an one second delay between shots. How to find a count of percent to grow each moment? How to find a count of milliseconds in a moment?
#13
12/26/2010 (9:24 pm)
Does anybody make "cooltime"?
#14
12/26/2010 (10:13 pm)
Define cooltime. Quote:How to find a count of percent to grow each moment? How to find a count of milliseconds in a moment?Are you asking for the GuiProgressCtrl count of milliseconds? Or do you need the weapon delay count?
#15
I am about...
How to find an increment value in different period in time?
For example, I have an one second period, in this period GuiProgressCtrl's value must grow up from 0 to 1, what is increment step to grow? How to find this?
"Cooltime" is a delay after firing.
12/27/2010 (11:32 am)
Sorry, if I say misunderstandable;I am about...
How to find an increment value in different period in time?
For example, I have an one second period, in this period GuiProgressCtrl's value must grow up from 0 to 1, what is increment step to grow? How to find this?
"Cooltime" is a delay after firing.
#17
01/06/2011 (7:02 pm)
how!
#18
The way to build cooltime is a long story and I think I can make a resource about creating cooltime in some time.
01/08/2011 (1:35 pm)
Is this question?The way to build cooltime is a long story and I think I can make a resource about creating cooltime in some time.
Torque 3D Owner Caylo Gypsyblood