Author Topic: Change datablock help + static help  (Read 1061 times)

Simple question, why doesnt this work?
Code: [Select]
datablock PlayerData(SpeedArmor : PlayerStandardArmor)
{
   runForce = 100 * 90;
   runEnergyDrain = 0;
   minRunEnergy = 0;
   maxForwardSpeed = 15;
   maxBackwardSpeed = 15;
   maxSideSpeed = 15;
   maxForwardCrouchSpeed = 3;
   maxBackwardCrouchSpeed = 2;
   maxSideCrouchSpeed = 2;

minJetEnergy = 0;
jetEnergyDrain = 0;
canJet = 0;

uiName = "";
showEnergyBar = false;

   runSurfaceAngle  = 45;
   jumpSurfaceAngle = 45;

};

datablock ItemData(SpeedSyringe)
{
category = "Weapon";  // Mission editor category
className = "Weapon"; // For inventory system

// Basic Item Properties
shapeFile = "./DRSYRINGE.dts";
rotate = true;
mass = 1;
density = 0.1;
elasticity = 0.1;
friction = 0.8;
emap = true;

//gui stuff
uiName = "Speed Syringe (Static)";
doColorShift = false;

// Dynamic properties defined by the scripts
canDrop = true;
};


function SpeedSyringeItem::onPickup(%this, %obj, %col)
{
%obj.changedatablock(PlayerSpeedArmor);
}
Doesnt appear to work, help!

On the other hand, I need help with static items, if you dont know what that is, well its an item that you pickup and use instantly, for example the TF2 medkits or the Sanvich. So if anyone can help me with that too, like item dropping and that, please do!

I'm not the best at scripting but I think


Code: [Select]
%obj.changedatablock(PlayerSpeedArmor);
Should just be

Code: [Select]
%obj.changedatablock("SpeedArmor");

I'm not the best at scripting but I think


Code: [Select]
%obj.changedatablock(PlayerSpeedArmor);
Should just be

Code: [Select]
%obj.changedatablock("SpeedArmor");
I'll have a go at it.

Thanks.


as normal, make sure there's no syntax errors and such, but i think you know that.

try changing your datablock to the speed datablock (add a uiName for a little bit) and enter in the console echo(findclientbyname("yourname").player.datablock.getName()); and post the results.

1. You have the name of the datablock right, it's SpeedPlayer, as you named it.
2. The arguments for itemData::onPickup are %this, %obj, %client, %amount
3. I believe %obj is the item, so you would probably want to try %client.player instead to change the datablock.

as normal, make sure there's no syntax errors and such, but i think you know that.

try changing your datablock to the speed datablock (add a uiName for a little bit) and enter in the console echo(findclientbyname("yourname").player.datablock.getName()); and post the results.
Syntax error in input.

1. You have the name of the datablock right, it's SpeedPlayer, as you named it.
2. The arguments for itemData::onPickup are %this, %obj, %client, %amount
3. I believe %obj is the item, so you would probably want to try %client.player instead to change the datablock.
Did as said, nothing appears to have changed.

And anybody know how to make it so the item doesn't go into your inventory? So basically you walk over it, it goes into use, and disappears from inventory.

Syntax error in input.
Did as said, nothing appears to have changed.

And anybody know how to make it so the item doesn't go into your inventory? So basically you walk over it, it goes into use, and disappears from inventory.
Is that even possible? :o

Is that even possible? :o
That's how static works, its a pickup item that goes into use but you never exactly see it get used apparently.

My rotate isnt working for my item either, can anyone else help me with that?!

That's how static works, its a pickup item that goes into use but you never exactly see it get used apparently.

My rotate isnt working for my item either, can anyone else help me with that?!
._.
processing data...
error
error
commencing self destruct
BOOM!

Syntax error in input.
Did as said, nothing appears to have changed.
shoot, sorry.
echo(findclientbyname("name").player.getDatablock().getName());


also, i'm not really that great at item scripts so i can't help you there, sorry.


for the static item, you should try to make it so that when they pick it up, it finds which slot the item is (for loop looping through the player's slots, getting the names of the weapons, checking if they're equal to your static item's name) then removing it from the slot. then, apply whatever happens when you use it. it seems a bit complicated, but trust me, once you get it it's pretty easy.

it's player.setDataBlock("Name");

next time with problems like this, try dumping your player (localclientconnection.player) to find the right method.

it's player.setDataBlock("Name");

next time with problems like this, try dumping your player (localclientconnection.player) to find the right method.
Still doesnt work! wtf!

and what localclientconnection.player?

Still doesnt work! wtf!

and what localclientconnection.player?
localclientconnection = i believe host
so localclientconnection.player = host's player
i assume you know what dump is.

Still doesnt work! wtf!

and what localclientconnection.player?
Post the code you have now