|
3 registered members (AndrewAMD, Grant, Neb),
908
guests, and 6
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
WEAPON CHAINGING SYSTEM
#304614
01/09/10 10:01
01/09/10 10:01
|
Joined: May 2009
Posts: 5,365 Caucasus
3run
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,365
Caucasus
|
I worked with all of you weapon workshops, I learnd allot of usefull things, thank you allot!!!  But, I whant to create weapon changing system, to make player drop and pick up to two weapons, primary and secondary. As in Couter Strike, how can I make that? I think allot it will be very usefull, if you will make such a workshop))) or just a simple demo, of how does it work. Thank you))
Last edited by 3run; 01/09/10 10:03.
|
|
|
Re: WEAPON CHAINGING SYSTEM
[Re: 3run]
#304616
01/09/10 10:13
01/09/10 10:13
|
Joined: Nov 2007
Posts: 2,568 Germany, BW, Stuttgart
MasterQ32
Expert
|
Expert
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
|
Create an action for the pickup weapon like this:
//skill1 WeaponID 0
//skill2 PickupDist 100
action weapon_pickup()
{
while(vec_dist(my.x,player.x) < my.PickupDist)
{
my.pan += time_step; //Let the Weapon rotate
wait(1);
}
switch_active_weapon(my.skill1);
ent_remove(me);
}
}
now you need the weapon change code:
var active_weapon_id = 0;
var active_weapon = 0;
var weapons[2];
//Switches the active weapon
function switch_active_weapon(var weapon_id)
{
weapons[active_weapon] = weapon_id;
}
//Used to cycle the Weapons
function weapon_changer_startup()
{
while(1)
{
active_weapon = cycle(active_weapon + mickey.z / 120,0,2); //Change Weapon with mousewheel
active_weapon_id = weapons[active_weapon];
wait(1);
}
}
// Use to shoot
function shoot()
{
switch(active_weapon_id)
{
case 0:
//Weapon with first ID
break;
case 1:
//Weapon with second ID
break;
case n:
//Weapon with n ID
break;
default:
//No Weapon or Weapon not defined
break;
}
}
|
|
|
Re: WEAPON CHAINGING SYSTEM
[Re: 3run]
#308214
02/02/10 10:16
02/02/10 10:16
|
Joined: Dec 2006
Posts: 1,086 Queensland - Australia
Nidhogg
Serious User
|
Serious User
Joined: Dec 2006
Posts: 1,086
Queensland - Australia
|
Hey 3run how about having a go at it yourself and if you are having problems post your code on what you have done and then maybe somebody will help you.
Also do NOT double post you have the same question in the lite_c forum.
Windows XP SP3 Intel Dual Core CPU: E5200 @ 2.5GHz 4.00GB DDR3 Ram ASUS P5G41T-M LX PCIE x16 GeForce GTS 450 1Gb SB Audigy 4 Spyware Doctor with AntiVirus
|
|
|
|