Author Topic: How do you decrease health by holding the mouse button?  (Read 1725 times)

Title says it all, I'm working on a cigarette item where the health decreases if you hold the button, and if you hold it too long, you die. Also, how do you make the item spawn an emitter at a specific spot of the item? Oh, and can you use Google Sketchup to make models in Blockland? And how do you make it so you hold the item in your hand first, then, if you click, it will go up at the mouth?
« Last Edit: March 26, 2010, 06:18:53 PM by Flubbman »


Um, maybe something like so:

Seriously though you could have gotten this from the tanks script.
Just replace the 'PLAYER_TYPE' with the playertype you want to get hurt when it clicks.
Code: [Select]
Package Stuff
function armor::onTrigger(%this, %obj, %triggerNum, %val)
   {
      //hack so we can shoot if we are a tank turret
      if(%obj.getDataBlock().getID() == PLAYER_TYPE.getID())
         %mount = %obj;

      if(isObject(%mount))
      {
         if(%mount.getDataBlock() == PLAYER_TYPE.getId() && %triggerNum == 0 && %val)
         {
            if(getSimTime() - %obj.lastHurtTime < 500)
               return;
            %obj.addHealth("-5");
            %obj.playThread(0,activate);
            %obj.lastHurtTime = getSimTime();

            return;
         }
      }
     
      Parent::onTrigger(%this,%obj,%triggerNum,%val);
   }
};
ActivatePackage(Stuff);

Title says it all, I'm working on a cigarette item where the health decreases if you hold the button, and if you hold it too long, you die. Also, how do you make the item spawn an emitter at a specific spot of the item? Oh, and can you use Google Sketchup to make models in Blockland? And how do you make it so you hold the item in your hand first, then, if you click, it will go up at the mouth?

#1 Make emitter at certain point: Joints
#2 Sketchup in Blockland will also require blender.
#3 Animations.

Just replace the 'PLAYER_TYPE' with the playertype you want to get hurt when it clicks.
I want it to damage any Playertype, also how do I make it spawn at the mouth? Does it say that in the code you posted?

Ok, here's a really detailed explanation of what it will be.

The Cigarette
When you equip it, it will spawn at your mouth. When you hold the mouse button, your health slowly decreases. While smoking it, the tip of the cigarette will spawn small smoke emitters. One cigarette can drain up to 50 HP. When you've smoked the whole cigarette, a "Cigarette" Projectile will fire, and if someone gets hit by that projectile, he'll lose 10 HP.

And, here's some pics of the model. Excuse the page stretch and the huge pictures. (I know it's easy to make, but we all have to start from somewhere.)





I need someone to make:
A script
A projectile
If you do this, PM me. I'll give credit.

Oh, and one more thing: how do you convert Sketchup models into Blender? Or is changing the name from BLCigarette.skp to BLCigarette.dts enough?
« Last Edit: March 29, 2010, 09:06:45 AM by Flubbman »

No really, you can't use Sketchup for blockland. Sketchup is for architectural design. Use blender or Milkshape.

No really, you can't use Sketchup for blockland. Sketchup is for architectural design. Use blender or Milkshape.
But... I've heard it's possible to convert Sketchup models into Blender.

But, what would a player even use an item which kills? If you'd wanted some useful ways to do this, you'd need to do that:

1. Increase player speed/jump force.
2. make a constant smoke emitter whitch would make a player look cool.
3. Make it useable with other weapons, so they can look even cooler while holding a minigun.

EDIT: Why would you import this in Blender, its just a box.
« Last Edit: March 30, 2010, 08:43:42 AM by Barakuda »

But, what would a player even use an item which kills?
One cigarette can drain up to 50 HP.


If you'd wanted some useful ways to do this,
When you've smoked the whole cigarette, a "Cigarette" Projectile will fire, and if someone gets hit by that projectile, he'll lose 10 HP.


Why would you import this in Blender, its just a box.
In Blender, you can put out spots where emitters and projectiles and stuff happens. I think...


Oh, and
2. make a constant smoke emitter whitch would make a player look cool.
While smoking it, the tip of the cigarette will spawn small smoke emitters.

Oh ty, I didn't read the description  :cookieMonster:

Projectile will fire, and if someone gets hit by that projectile, he'll lose 10 HP.
Is it worth loosing your life to decrease 10 HP to our enemy? Which wouldn't be very useful in city RPGs because of it. But it would be good if one cigarette would increase your HP, but there would be a bar that would be your lungs, and more usage of drugs would make you slower and the concequences would be a slow death.
In Blender, you can put out spots where emitters and projectiles and stuff happens. I think...
You don't need to import a box, its the most basic shape of them all.

You don't need to import a box, its the most basic shape of them all.
Yeah, but I need to put a place where the smoke emitter will spawn. Also, there's no real point to this, but it can be good for movies or posing.

Hmm..  I suggest you start your addon cariere by making easyer things, but go ahead if you want it.