Blockland Forums > Modification Help

How to make the playertype switch back after a certain amount of time.

Pages: (1/1)

Uncle Bengs:

i modeled a simple syringe, took the Pill script and files and edited them a little (replaced "pill" with syringe and "heal" with healed, i also changed the emote.) and it works just like i want it to. except for one thing:
i figured out how to change the playertype but now i need to know how to make it change back after about 5 seoncds.

i'd also like to point out that the model has an error as well, the syringe is stick inside the hand even though i added a mountPoint joint at the right place, it still gets stuck inside the hand in a very strange way.


i posted this in the General Modification Help and then realized that it was in the wrong section.

Ash:

I'm not quite sure on how this works, but I think there's a setDatablock function, and a schedule/delay type thing.

Try something like this:

--- Code: ---function Syringe_changeData(%player)
{
   %player.oldDatablock = %player.datablock;
   %player.newDatablock = (Desired datablock);
   %player.setDatablock(%player.newDatablock);
   %player.revertData = %player.schedule(5000,"Syring_revertData);
}

function Syringe_revertData(%player)
{
   %player.newDatablock = %player.oldDatablock;
   %player.setDatablock(%player.newDatablock);
}

--- End code ---

Again, I wouldn't really call myself a scripter, but this should help you get started. If it doesn't work, don't be surprised.

ThinkInvisible:

I think you can just use %player.datablock = "datablock";
Could be %player.changeDataBlock("datablock"); (because of the event)

Uncle Bengs:

I fixed it, and it works splendid so far!

Locked, but thanks for trying to help :)

Pages: (1/1)

Go to full version