Power Ups
by Boom_Dude · in General Discussion · 07/30/2007 (3:31 pm) · 4 replies
I was wondering if anyone can show me how make a object into a powerup, But I'd like to have a timed so the power-up such as a insanly good weapon spawns every say five minutes, but the user can only have it for maybe 30 seconds.
So please respond to this Post I only have a week to finish this project at my camp.
Thanks Y'all
So please respond to this Post I only have a week to finish this project at my camp.
Thanks Y'all
#2
07/30/2007 (3:59 pm)
Maybe have a count of how many are in the world at a time, and once its gone, say out of ammo or lost off the side of the edge, set a schedule for 5 mins or however long? Just an idea.
#3
the effecs are just particles that appear when you pick it up, not sure about the timed thing, maybe change it in item.cs to where it takes longer o respawn?
TomFeni
07/31/2007 (2:22 am)
My one up code// ----------------------------------------------------------------------------
//
// Life up
//
// TomFeni
//
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// particle effect
// ----------------------------------------------------------------------------
datablock ParticleData(lifePickup)
{
textureName = "~/data/shapes/particles/hearts";
dragCoefficient = 0.0;
gravityCoefficient = -0.2; // rises slowly
inheritedVelFactor = 0.00;
lifetimeMS = 500;
lifetimeVarianceMS = 50;
useInvAlpha = false;
spinRandomMin = -60.0;
spinRandomMax = 60.0;
colors[0] = "0.0 0.0 0.8 0.1";
colors[1] = "0.6 0.0 0.0 0.1";
colors[2] = "0.0 0.8 0.0 0.1";
sizes[0] = 0.1;
sizes[1] = 0.1;
sizes[2] = 0.1;
times[0] = 1.0;
times[1] = 2.5;
times[2] = 3.0;
};
datablock ParticleEmitterData(lifePickupEmitter)
{
ejectionPeriodMS = 35;
periodVarianceMS = 0;
ejectionVelocity = 8.0;
ejectionOffset = 0.45;
velocityVariance = 0.5;
thetaMin = 45.0;
thetaMax = 90.0;
particles = lifePickup;
};
datablock ParticleEmitterNodeData(lifePickupEmitterNode)
{
timeMultiple = 1.5;
};
// ----------------------------------------------------------------------------
// audio
// ----------------------------------------------------------------------------
datablock AudioProfile(LifeUpSound)
{
filename = "~/data/sound/health_mono_01.ogg";
description = AudioClose3d;
preload = true;
};
// ----------------------------------------------------------------------------
// datablock
// ----------------------------------------------------------------------------
datablock ItemData(lifeUp)
{
// Mission editor category, this datablock will show up in the
// specified category under the "shapes" root category.
category = "Health";
// Basic Item properties
shapeFile = "~/data/shapes/lifeUp/lifeUp.dts";
mass = 1;
friction = 1;
elasticity = 0.3;
emap = true;
// Dynamic properties defined by the scripts
//repairAmount = 20;
maxInventory = 0; // No pickup or throw
lightType = "constantLight";
lightColor = "0.4 0.8 0.3 1.0";
lightTime = "1000";
lightRadius = "3";
};
function lifeUp::onPickup(%this, %obj, %user, %amount)
{
// The parent Item method performs the actual pickup.
if (Parent::onPickup(%this, %obj, %user, %amount)) {
$Player::lives++;
serverPlay3D(LifeUpSound,%obj.getTransform());
livescounter.setCounterValue($Player::lives);
saveGame();
%effect = new ParticleEmitterNode() {
position = vectorSub(%Obj.getWorldBoxCenter(), "0 0 1");
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = "lifePickupEmitterNode";
emitter = lifePickupEmitter;
velocity = "1";
};
%obj.myEffect = %effect;
%obj.delete();
//scorecounter.setCounterValue( scorecounter.getCounterValue() + 1 );
if(isObject(%effect))
%effect.schedule(1500, "delete");
}
}the effecs are just particles that appear when you pick it up, not sure about the timed thing, maybe change it in item.cs to where it takes longer o respawn?
TomFeni
#4
P.S. As some of you may have thought I have just started this program and know only the very basics.
07/31/2007 (9:30 am)
Thanks this work as my base of what the power up looks like. However, how am I to combine this script so that once they pick it up they get say a weapon that changes damage, range and area affect. Even after that how do I have the power-up itshelf and the upgrade have separate times? Once I get these my project should be finished.P.S. As some of you may have thought I have just started this program and know only the very basics.
Boom_Dude