WEAPON CHAINGING SYSTEM

Posted By: 3run

WEAPON CHAINGING SYSTEM - 01/09/10 10:01

I worked with all of you weapon workshops, I learnd allot of usefull things, thank you allot!!! laugh 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))
Posted By: MasterQ32

Re: WEAPON CHAINGING SYSTEM - 01/09/10 10:13

Create an action for the pickup weapon
like this:
Code:
//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:
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;
	}
}


Posted By: 3run

Re: WEAPON CHAINGING SYSTEM - 01/09/10 10:46

And how about drop? How can player drop weapon? If I have 4 weapons, for example, I whant to be able to drom and pick an other weapon. And can you make a small demo of this please? laugh I'll be very grateful
Posted By: 3run

Re: WEAPON CHAINGING SYSTEM - 01/11/10 08:21

Some one, help with this please
Posted By: George

Re: WEAPON CHAINGING SYSTEM - 01/11/10 10:43

Dropping a weapon means to remove it (ent_remove, etc) from player's inventory and create it again (ent_create) close to his feet.
Posted By: 3run

Re: WEAPON CHAINGING SYSTEM - 01/11/10 11:45

I know that George, but I do not know how to realize all that. That why I'm asking for workshop or small demo.
Posted By: George

Re: WEAPON CHAINGING SYSTEM - 01/12/10 18:12

I've got a long list but I'll see what I can do about it.
Posted By: 3run

Re: WEAPON CHAINGING SYSTEM - 01/12/10 19:54

Thank you George, I'm sure this kind of workshop will be very useful, with it and all previous weapon workshops, GS users will be able to create they own full working weapon system laugh
Posted By: 3run

Re: WEAPON CHAINGING SYSTEM - 02/02/10 06:00

Still waiting for you help dear George. laugh I know, you are very busy... But I hope, that you will finish that workshop soon... You may just make an example for now, and when you will be free, you may just add workshop to it. laugh Really need your help man.
Posted By: Nidhogg

Re: WEAPON CHAINGING SYSTEM - 02/02/10 10:16

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.
Posted By: 3run

Re: WEAPON CHAINGING SYSTEM - 02/02/10 11:14

Hey nidhogg! Ain't asking you for help!!! And there is on DOUBLE post! Read my posts again, and if you can't see the difference, just go and improve you english skills!!! I'm not the only one who need this kind of workshop!!
Posted By: Nidhogg

Re: WEAPON CHAINGING SYSTEM - 02/02/10 14:23

Improve my English eh! Bwahahahahahaha..
Posted By: 3run

Re: WEAPON CHAINGING SYSTEM - 02/02/10 19:23

That is really funy dude... if you can't see the difference...
Posted By: Rei_Ayanami

Re: WEAPON CHAINGING SYSTEM - 02/02/10 19:24

Sorry 3run, but don't always post your questions to the aum, post them to: beginning with gamestudio or lite-c wink

george doesen't have enough time to answer all your questions wink
Posted By: 3run

Re: WEAPON CHAINGING SYSTEM - 02/02/10 19:30

I know Rei_Ayanami)) I'll just wait for his workshop)))
Posted By: George

Re: WEAPON CHAINGING SYSTEM - 02/03/10 09:21

Sorry, it's going to be a long wait; the team project will take me a lot of time. The good news is that the shooter template is on its way now.
Posted By: 3run

Re: WEAPON CHAINGING SYSTEM - 03/15/10 15:06

Dear George, not like I'm trying to hurry you up. I know that you are really a busy person, and now when there is a team project, you are even much busier... Sorry for asking you again for help, but I really do need the weapon changing system with drop and pick up system, slot based, up to 2 weapons like in counter strike. I've tried many times to do that myself with arrays, but I always failed frown I've finished already my player movement script, improved it as well... And I've made a simple weapons system myself, up to 9 weapons. But thats all not as I need. I need some thing similar to counter strike, so player couldn't be able to pick up more than 2 weapons at the same time. And he'll be able to drop and pick up weapons as well. I really hope that you or some one will help me out with this, I'm newbie in such stuff... If the person who will help me out, will need help in scripting for example with player movement script, I'll be really happy to help laugh sorry again for this dear George.
Posted By: George

Re: WEAPON CHAINGING SYSTEM - 03/16/10 08:07

I have started to work at the shooter template code, so the weapons system should be out in a few months. I guess that it won't be exactly what you need, but you should be able to customize it without too much effort. Meanwhile, I suggest that you should continue to improve your programming abilities.

Here are a few things to try until then: create a variable named "picked_up_weapons" and set its initial value to zero. If the player comes close to a weapon (make them all passable) and picked_up_weapons is smaller than 2, add the weapon to its arsenal and increment picked_up_weapons. Otherwise, if picked_up_weapons is 2 already, don't do anything until the player drops a weapon (you'd do this by removing the weapon using ent_remove and creating (ent_create) it at player's feet).
Posted By: 3run

Re: WEAPON CHAINGING SYSTEM - 03/16/10 09:51

Thank you dear George, I'll do my best. Only one thing I what to ask you for, I have some problems with removing and creating weapons at the players feet. First problem is, that I don't know how to make create different weapon models, depending on the weapon type. And the second, and main problem is that I do not know how to create weapon model near players feet. I've tried to to create from camera.x and then move a little bit forward, so it flyes a bit and the heights of model is decreasing... So it will fall on the ground, something similar to counter strike... But weapon model just stuck at the player position... I've tried to use push, but failed... This problems I've faced, please give me a small examples how to do all that. After when I'll finish it, I'll post the script here, so I hope if you will find it usefull it will be at the next AUM in plug and play laugh I do hope so.
Posted By: George

Re: WEAPON CHAINGING SYSTEM - 03/16/10 10:32

The first thing is to make sure that all the weapons are passable; if player's movement code uses IGNORE_PASSABLE, the player / the weapons won't get stuck.
Posted By: 3run

Re: WEAPON CHAINGING SYSTEM - 03/16/10 17:33

But if I'll make it passable, it will just pass through the ground... Please give me examples for that two things.
Posted By: George

Re: WEAPON CHAINGING SYSTEM - 03/16/10 21:44

Use vec_dist to detect if a player has come close to a passable weapon. Search the AUMs, there are examples in there (I don't know the magazine numbers, though).
© 2023 lite-C Forums