Author Topic: Some Weapons i've made.  (Read 12327 times)

Hello, Thease are some weapons i have made for Blockland and every weapon need some scripting help
So here they are:


The USP_45.                                                                                              (based of)

The G18.                                                                                                    (based of)

The Mini_Uzi                                                                                               (based of)




USP 45: The fail on this is the script, then i enable it and start a game, it automaticly turn itself off, i tryed to give it auto-script (so it is auto) and then it works, but it is ment to me semi-auto, i think it is the State that fail.
Gravity Cat helped me to fix this, so it work perfectly now.

G18: It need to shoot faster, and i dont know what to do to make it shoot faster.
Heedicalking helped me to fix this, so it work perfectly now.

Mini Uzi: This also need to shoot faster.
This was also fixed with the help of Heed. (wrote of the G18)
Futures:   *for all weapons*
*Reload animation + Animation Script.
*Sight-Able.
*Recoil "Animation" as i call it. (I make a animation that play evory time a bullet fires of the weapon.)
*Ray casting
« Last Edit: June 07, 2010, 03:47:37 PM by mazeribot »

Looks nice.

Post your scripts so we can help ye (Better post them in Coding Help)

lol, No, i will get more scripting knowledge of i do it myself. (with abit help :P)

The Only thing i need to know is: How do i make the weapon shoot faster/slower?

I'll script the G18. Just tell me what you want it to do, and I'll do it.

Ohhh, so you want to script it yourself? Not a good idea if you're new to it.

lol, No, i will get more scripting knowledge of i do it myself. (with abit help :P)

The Only thing i need to know is: How do i make the weapon shoot faster/slower?
Post the script and I'll show you what part.

Then i shot uzi.
I'll script the G18. Just tell me what you want it to do, and I'll do it.

I'll just need you to make/get the sounds and icon. I could probably make the death CI for you.

I'll script the G18. Just tell me what you want it to do, and I'll do it.

Ohhh, so you want to script it yourself? Not a good idea if you're new to it.

Well, i'm new to it, but i lern fast, and i have Gravity Cat to help me too.
But i need to wait til he comes online again...

And here is the part i need help in the G18 (to make it shoot faster)

Code: [Select]
stateName[0]                     = "Activate";
stateTimeoutValue[0]             = 0.5;
stateTransitionOnTimeout[0]       = "Ready";
stateSound[0] = weaponSwitchSound;

stateName[1]                     = "Ready";
stateTransitionOnTriggerDown[1]  = "Fire";
stateAllowImageChange[1]         = true;

stateName[2]                    = "Fire";
stateTransitionOnTimeout[2]     = "Reload";
stateTimeoutValue[2]            = 0.11;
stateFire[2]                    = true;
stateAllowImageChange[2]        = false;
stateSequence[2]                = "Fire";
stateScript[2]                  = "onFire";
stateWaitForTimeout[2] = true;
stateEmitter[2] = gunFireEmitter;
stateEmitterTime[2] = 0.05;
stateEmitterNode[2] = "Muzzlepoint";
stateSound[2] = gunShot1Sound;

stateName[3] = "Reload";
stateSequence[3]                = "Reload";
stateAllowImageChange[3]        = false;
stateTimeoutValue[3]            = 0.01;
stateWaitForTimeout[3] = true;
stateTransitionOnTimeout[3]     = "Check";

stateName[4] = "Check";
stateTransitionOnTriggerUp[4] = "StopFire";
stateTransitionOnTriggerDown[4] = "Fire";

stateName[5]                    = "StopFire";
stateTransitionOnTimeout[5]     = "Ready";
stateTimeoutValue[5]            = 0.2;
stateAllowImageChange[5]        = false;
stateWaitForTimeout[5] = true;
//stateSequence[5]                = "Reload";
stateScript[5]                  = "onStopFire";


};

function G18_normalImage::onFire(%this,%obj,%slot)
{
if(%obj.getDamagePercent() < 1.0)
%obj.playThread(2, plant);
%projectile = %this.projectile;
%spread = 0.0012;
%shellcount = 1;

for(%shell=0; %shell<%shellcount; %shell++)
{
%vector = %obj.getMuzzleVector(%slot);
%objectVelocity = %obj.getVelocity();
%vector1 = VectorScale(%vector, %projectile.muzzleVelocity);
%vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);
%velocity = VectorAdd(%vector1,%vector2);
%x = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%z = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
%velocity = MatrixMulVector(%mat, %velocity);

%p = new (%this.projectileType)()
{
dataBlock = %projectile;
initialVelocity = %velocity;
initialPosition = %obj.getMuzzlePoint(%slot);
sourceObject = %obj;
sourceSlot = %slot;
client = %obj.client;
};
MissionCleanup.add(%p);
}
return %p;
}

and is the stateTimeoutValue how fast it take before next bullet come?

(with shoot faster i dont mean the muzzleVelocity...)
« Last Edit: April 10, 2010, 02:25:30 PM by mazeribot »


Code: [Select]
stateName[0]                     = "Activate";
stateTimeoutValue[0]             = 0.5;
stateTransitionOnTimeout[0]       = "Ready";
stateSound[0] = weaponSwitchSound;

stateName[1]                     = "Ready";
stateTransitionOnTriggerDown[1]  = "Fire";
stateAllowImageChange[1]         = true;

stateName[2]                    = "Fire";
stateTransitionOnTimeout[2]     = "Reload";
stateTimeoutValue[2]            = 0.11;
stateFire[2]                    = true;
stateAllowImageChange[2]        = false;
stateSequence[2]                = "Fire";
stateScript[2]                  = "onFire";
stateWaitForTimeout[2] = true;
stateEmitter[2] = gunFireEmitter;
stateEmitterTime[2] = 0.05;
stateEmitterNode[2] = "Muzzlepoint";
stateSound[2] = gunShot1Sound;

stateName[3] = "Reload";
stateSequence[3]                = "Reload";
stateAllowImageChange[3]        = false;
stateTimeoutValue[3]            = 0.01;
stateWaitForTimeout[3] = true;
stateTransitionOnTimeout[3]     = "Check";

stateName[4] = "Check";
stateTransitionOnTriggerUp[4] = "StopFire";
stateTransitionOnTriggerDown[4] = "Fire";

stateName[5]                    = "StopFire";
stateTransitionOnTimeout[5]     = "Ready";
stateTimeoutValue[5]            = 0.2;
stateAllowImageChange[5]        = false;
stateWaitForTimeout[5] = true;
//stateSequence[5]                = "Reload";
stateScript[5]                  = "onStopFire";


};
Before I do anything, how fast does it actually fire? And I need to see the whole script before this as well before you do anything. In fact, you should package it then send it to me so I really know what I'm doing.


Code: [Select]
function G18_normalImage::onFire(%this,%obj,%slot)
{
if(%obj.getDamagePercent() < 1.0)
%obj.playThread(2, plant);
%projectile = %this.projectile;
%spread = 0.0012;
%shellcount = 1;

for(%shell=0; %shell<%shellcount; %shell++)
{
%vector = %obj.getMuzzleVector(%slot);
%objectVelocity = %obj.getVelocity();
%vector1 = VectorScale(%vector, %projectile.muzzleVelocity);
%vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);
%velocity = VectorAdd(%vector1,%vector2);
%x = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%z = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
%velocity = MatrixMulVector(%mat, %velocity);

%p = new (%this.projectileType)()
{
dataBlock = %projectile;
initialVelocity = %velocity;
initialPosition = %obj.getMuzzlePoint(%slot);
sourceObject = %obj;
sourceSlot = %slot;
client = %obj.client;
};
MissionCleanup.add(%p);
}
return %p;
}

This part controls the spread of the weapon, so the projectiles don't go in the same direction, but have a spread. I'm guessing you probably already knew this, but still.


Code: [Select]
stateName[0]                     = "Activate";
stateTimeoutValue[0]             = 0.5;
stateTransitionOnTimeout[0]       = "Ready";
stateSound[0] = weaponSwitchSound;

stateName[1]                     = "Ready";
stateTransitionOnTriggerDown[1]  = "Fire";
stateAllowImageChange[1]         = true;

stateName[2]                    = "Fire";
stateTransitionOnTimeout[2]     = "Reload";
stateTimeoutValue[2]            = 0.11;
stateFire[2]                    = true;
stateAllowImageChange[2]        = false;
stateSequence[2]                = "Fire";
stateScript[2]                  = "onFire";
stateWaitForTimeout[2] = true;
stateEmitter[2] = gunFireEmitter;
stateEmitterTime[2] = 0.05;
stateEmitterNode[2] = "Muzzlepoint";
stateSound[2] = gunShot1Sound;

stateName[3] = "Reload";
stateSequence[3]                = "Reload";
stateAllowImageChange[3]        = false;
stateTimeoutValue[3]            = 0.01;
stateWaitForTimeout[3] = true;
stateTransitionOnTimeout[3]     = "Check";

stateName[4] = "Check";
stateTransitionOnTriggerUp[4] = "StopFire";
stateTransitionOnTriggerDown[4] = "Fire";

stateName[5]                    = "StopFire";
stateTransitionOnTimeout[5]     = "Ready";
stateTimeoutValue[5]            = 0.2;
stateAllowImageChange[5]        = false;
stateWaitForTimeout[5] = true;
//stateSequence[5]                = "Reload";
stateScript[5]                  = "onStopFire";


};
Before I do anything, how fast does it actually fire? And I need to see the whole script before this as well before you do anything. In fact, you should package it then send it to me so I really know what I'm doing.


Code: [Select]
function G18_normalImage::onFire(%this,%obj,%slot)
{
if(%obj.getDamagePercent() < 1.0)
%obj.playThread(2, plant);
%projectile = %this.projectile;
%spread = 0.0012;
%shellcount = 1;

for(%shell=0; %shell<%shellcount; %shell++)
{
%vector = %obj.getMuzzleVector(%slot);
%objectVelocity = %obj.getVelocity();
%vector1 = VectorScale(%vector, %projectile.muzzleVelocity);
%vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);
%velocity = VectorAdd(%vector1,%vector2);
%x = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%z = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
%velocity = MatrixMulVector(%mat, %velocity);

%p = new (%this.projectileType)()
{
dataBlock = %projectile;
initialVelocity = %velocity;
initialPosition = %obj.getMuzzlePoint(%slot);
sourceObject = %obj;
sourceSlot = %slot;
client = %obj.client;
};
MissionCleanup.add(%p);
}
return %p;
}

This part controls the spread of the weapon, so the projectiles don't go in the same direction, but have a spread. I'm guessing you probably already knew this, but still.


Yes i did.

Thanks, but i can open a server so you can have a look at it, i don't trust people on this forum :o
With Shoot fast i dont mean the muzzleVelocity, because i have it on the highest. (200)
I mean the time before next bullet releases.

Damn nice mini uzi!

Thanks.

Code: [Select]
stateTimeoutValue[2]            = 0.11;Low the 0.11 to something like 0.4 and see if it works faster.

Code: [Select]
stateTimeoutValue[2]            = 0.11;Low the 0.11 to something like 0.4 and see if it works faster.

ya :/

Code: [Select]
stateTimeoutValue[2]            = 0.11;Low the 0.11 to something like 0.4 and see if it works faster.

Thanks Heed

EDIT: I'm planing on making the Weapons Sight-Able, i have the script that is needed, but evory time i try to use it, the gun get a fail like it can't shoot.
« Last Edit: April 11, 2010, 04:36:48 PM by mazeribot »

Wow, much better than I was expecting. Can't wait to see them textured.

Okaay
i'm woundering if i should release after reload-thing is done...
« Last Edit: April 13, 2010, 09:33:55 AM by mazeribot »