Accessing DataBlock's settings on the fly.
by Matthew Jones · in Torque Game Engine · 01/06/2003 (8:03 pm) · 5 replies
I have been trying my ass off to animate a weapon depending on the action the player is performing (via script). I finally come to the conclusion (and I hope its wrong) that a weapon image can't be animated outside the states that are hard coded in the engine. Basically you get ready, fire and reload (with some minor changes in script). So my idea was use a global variable in the slot for onFIRE in the weapons script (statesequence[3]) and make that value equal to a string. Then I would set that value according to how the player moves.
Well that doesn't work either. But what I am wondering, Is, are DataBlock's values loaded and stored in memory in a way that things can't be changed on the fly? Also if they can be changed how do you go about accessing that memory slot and letting the engine know that the value can change on the fly and be equal to a global variable found in the script.
Or is this even possible with minor changes to the code?
The value of this could be limitless and would even be a nice upgrade on the engine if it could work. If anybody has any GOOD advice on how to get started on this please post it.
Thanks
Matt
Well that doesn't work either. But what I am wondering, Is, are DataBlock's values loaded and stored in memory in a way that things can't be changed on the fly? Also if they can be changed how do you go about accessing that memory slot and letting the engine know that the value can change on the fly and be equal to a global variable found in the script.
Or is this even possible with minor changes to the code?
The value of this could be limitless and would even be a nice upgrade on the engine if it could work. If anybody has any GOOD advice on how to get started on this please post it.
Thanks
Matt
#2
I kinda got the feeling that , that was the case. We found a good work around that seems to do about what we want to do. We had to limit ourselves a little more but it works.
Thanks again
Matthew Jones
01/18/2003 (10:18 am)
Thanks TimI kinda got the feeling that , that was the case. We found a good work around that seems to do about what we want to do. We had to limit ourselves a little more but it works.
Thanks again
Matthew Jones
#3
01/18/2003 (12:29 pm)
FYI, you can run any animation you want from within the sate engine, not just ready/fire/re-load. You can transition into different states, play different animations, etc. It's fairly flexible, the only caveate is that all state transitions are currently controlled by three flags, fire, ammo, loaded. You can also only be in one state at a time, so though you could probably use the fire/ammo to control alternate fire modes, you could still only fire in one mode at a time.
#4
Its kind of silly though, since it changes every instance of that datablock. I used it for a "fireworks" mode in a Tribes2 mod.
It also causes lag.
01/20/2003 (1:35 pm)
This doesnt work for states (and textures or other preloaded parts, I'm pretty sure), but for a lot of datas that are client-handled, you can change that datablock properties and do %client.transmitDataBlocks(1); for every client in the game.Its kind of silly though, since it changes every instance of that datablock. I used it for a "fireworks" mode in a Tribes2 mod.
It also causes lag.
#5
We were looking for an alternative to having to write a whole new class but in the end we had to anyway.
Thanks Matt
01/21/2003 (3:56 am)
Ya we ended up just basically writing a new class for our players. It ended being a hybrid between the player and the wheeled vehicle. We are still trying to get the net code 100% percent for it but it will work sooner or later and save us alot of trouble.We were looking for an alternative to having to write a whole new class but in the end we had to anyway.
Thanks Matt
Torque Owner Tim Gift
If your running the server yourself (single player games or hosting), then some datablocks can be manipulated on the fly (ShapeImageData isn't one of them), though if you're writing a multiplayer game, you have to be carefull not to do this.