Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 20:05
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (Grant, dr_panther, AndrewAMD), 1,379 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
mousewheel selectable weapons #182207
02/05/08 16:01
02/05/08 16:01
Joined: Mar 2005
Posts: 969
ch
Loopix Offline OP
User
Loopix  Offline OP
User

Joined: Mar 2005
Posts: 969
ch
Hi

I have coded a close combat template that allows picking up weapons (trough event_impact) and attaching them to the char using vec_for_vertex.
The problem is, once I have a weapon it will remain in my hand Id' now like to be able to "register" many weapons (those I've picked up) and toggle trough all of them using the mousewheel. Clicking the wheel(middle mouse button) should put away the actual weapon.

As I'm a bit code impaired, I will need some help Best would be an example (c-script)

Thanks...I love you all (almost all!)

(I'll check the thread when I'm back from work...tonight)

Re: mousewheel selectable weapons [Re: Loopix] #182208
02/05/08 17:10
02/05/08 17:10
Joined: Feb 2006
Posts: 76
Mi
H
Havoc22 Offline
Junior Member
Havoc22  Offline
Junior Member
H

Joined: Feb 2006
Posts: 76
Mi
This might not be how you want it or even close. but I just set up a variable called weapon num. Then based on the variable, whether the number was set to the current weapons number, made it either invisible, or, not invisible. Then everything else of course was coded based off of that. Weapon damage was set according to that variable, the sounds they play things like that.

If you were to go at it like that it would probably look something like this...



var weapon_num;

function weapon_1_vis()
{

if (weapon_num==1)
{
my.invisible=off;
}
else
{
my.invisible=on;
}
}

Then you can set up a function to either add or subtract to that value based on the mouse wheel. It should change through the weapons. Since techincally they'll all be visible when you pick them up.

I'm not a coder either, but that's what I would do. There's probably a better and cleaner way to go about it, but that's all I know how to do.

Re: mousewheel selectable weapons [Re: Havoc22] #182209
02/05/08 20:37
02/05/08 20:37
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline
Serious User
Scorpion  Offline
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
I think you should use an array. If you now get a weapon (let's say weapon nr. 5) you set that special array part to 1:
Code:
int weapons[8];

[...]

weapons[4] = 1; //i got the weapon nr. 5



To select it with the mousewheel you just need a number that holds the weapon number.

Code:
int current_weapon = 0;

[...]

int old_weapon;
while(1)
{
current_weapon += (mickey.z/120);
current_weapon %= 7;
while(weapons[current_weapon]==0)
{
current_weapon++;
current_weapon %= 7;
}
if(old_weapon!=current_weapon)
{
change_weapon(current_weapon);//in this function morph the weapon entity
}
old_weapon = current_weapon;
wait(1);
}



all in all nothing is really detailed, but shoould give you the clue how to do it.

Re: mousewheel selectable weapons [Re: Scorpion] #182210
02/05/08 21:34
02/05/08 21:34
Joined: Mar 2005
Posts: 969
ch
Loopix Offline OP
User
Loopix  Offline OP
User

Joined: Mar 2005
Posts: 969
ch
Hey...this looks good! I'll try to get this array thing working

Thanks a bunch...this is true love


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1