Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
4 registered members (AndrewAMD, Quad, soulman3, Ayumi), 675 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Weapon Help #140276
07/10/07 06:56
07/10/07 06:56
Joined: May 2007
Posts: 185
Netherlands
SurudoiRyu Offline OP
Member
SurudoiRyu  Offline OP
Member

Joined: May 2007
Posts: 185
Netherlands
Hi there designers,

I want to make a weapon pickup code.
but need some advice and som help.

I want to learn How to do it so please comment it so i know what is happening
or give a sort of workshop how to do it please ^-^

It just have to be simple like. weapon pickup, weapon show and weapon shoot.
no ammo or other things like animation. just a simple pickup, show it with a keypress of the key "1" and shoot with mouse button

Thanks allready for reading.


-The Dragon's Eye is alway's watching you!-
Re: Weapon Help [Re: SurudoiRyu] #140277
07/10/07 07:27
07/10/07 07:27
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
first when gun is on the ground you may use simple trigger.

if(event_type == event_trigger) && (you == player)
{my.passable = on; my.invisible = on; Player_have_this_gun =1;}

my.fire_power = 10;
while(me)
if(key_1 ==1) && (Player_have_this_gun ==1){my.invisible =off; player.fire_power = my.fire_power;}
if(my.invisible == off)
{
vec_set(my.x,player.x};//or use vec_for_vertex to attach to player's hand
my.pan = camera.pan; my.tilt = camera.tilt; //if FPP
if(mouse_left ==1){ fire();}//trace from muzzle to vec_for_screen, add effects etc. If result of trace !=0 and you == enemy then your life -= player.fire_power *time_setp; Just example
wait(1);
}

Last edited by tompo; 07/10/07 07:36.

Never say never.
Re: Weapon Help [Re: tompo] #140278
07/10/07 08:03
07/10/07 08:03
Joined: May 2007
Posts: 185
Netherlands
SurudoiRyu Offline OP
Member
SurudoiRyu  Offline OP
Member

Joined: May 2007
Posts: 185
Netherlands
Thanks i hope i can do something with it
if not then you will hear it
Ill try to play a bit for now.

Thanks for the help.


-The Dragon's Eye is alway's watching you!-
Re: Weapon Help [Re: SurudoiRyu] #140279
07/17/07 15:44
07/17/07 15:44
Joined: May 2007
Posts: 185
Netherlands
SurudoiRyu Offline OP
Member
SurudoiRyu  Offline OP
Member

Joined: May 2007
Posts: 185
Netherlands
The script isn't really working >.< tried diffrent things now but i can't get it working :S I putted into my items script and did a few things in the script.


function fire()
{
wait(1);
beep;
}





ACTION Weapon_01
{

if(event_type == event_trigger) && (you == player)
{
my.passable = on;
my.invisible = on;
player.Wapen1 = 1;
}

my.fire_power = 10;
}
while(me)
{
if(key_1 == 1) && (player.Wapen1 == 1)
{
my.invisible =off;
player.Wapenkracht = my.fire_power;
}
if(my.invisible == off)
{
vec_set(my.x,player.x);//or use vec_for_vertex to attach to player's hand
my.pan = camera.pan; my.tilt = camera.tilt; //if FPP
if(mouse_left ==1)
{
fire(); //trace from muzzle to vec_for_screen, add effects etc. If result of trace !=0 and you == enemy then your life -= player.fire_power *time_setp; Just example
}
wait(1);
}
}


This is the weapon and here the things i did for the player.

DEFINE Wapenkracht, Skill89; //Kracht van het wapen

DEFINE Wapen1, Skill90;
DEFINE Wapen2, Skill91;
DEFINE Wapen3, Skill92;
DEFINE Wapen4, Skill93;
DEFINE Wapen5, Skill94;
DEFINE Wapen6, Skill95;
DEFINE Wapen7, Skill96;
DEFINE Wapen8, Skill97;
DEFINE Wapen9, Skill98;
DEFINE Wapen10, Skill99;

I made for all weapons a skill so if that would be 1 it will mean i have the weapon of its number

Weaponkracht is for the power of the weapon like you had first in the script

Can you help me out ?


-The Dragon's Eye is alway's watching you!-
Re: Weapon Help [Re: SurudoiRyu] #140280
07/17/07 17:07
07/17/07 17:07
Joined: Apr 2006
Posts: 1,551
Netherlands
D3D Offline
Serious User
D3D  Offline
Serious User

Joined: Apr 2006
Posts: 1,551
Netherlands
AUM52
Q: In my game I have a gun model. I don't want a player model but I want the gun to be attached to the screen like in a fps game. Can anybody help me?

AUM53
Q: I am trying to make a simple 'collect 10 items and win' type game but really don't have a clue about coding. I would like an audio file to play every time I collect an item and I'd like a music file and splash screen to appear when all the items are collected.

AUM55
Q: How can I attach a non-animated sword to my player model? (could be gun to)

And there are many more


smile
Re: Weapon Help [Re: D3D] #140281
07/18/07 06:37
07/18/07 06:37
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Code:
ACTION Weapon_01
{

if(event_type == event_trigger) && (you == player)
{
my.passable = on;
my.invisible = on;
player.Wapen1 = 1;
}

my.fire_power = 10;
} // !!!this is your problem! the stuff after isn't in the action!!!

while(me)
{
if(key_1 == 1) && (player.Wapen1 == 1)
{
my.invisible =off;
player.Wapenkracht = my.fire_power;
}
if(my.invisible == off)
{
vec_set(my.x,player.x);//or use vec_for_vertex to attach to player's hand
my.pan = camera.pan; my.tilt = camera.tilt; //if FPP
if(mouse_left ==1)
{
fire(); //trace from muzzle to vec_for_screen, add effects etc. If result of trace !=0 and you == enemy then your life -= player.fire_power *time_setp; Just example
}
wait(1); // !!!this should be at the end of the while loop, not in an "if" statement!!!
}
}



use [ code] [/code ] tags to section off code making it easier to read and letting it maintain its indenting.

hope this helps ^^

julz


Formerly known as JulzMighty.
I made KarBOOM!
Re: Weapon Help [Re: JibbSmart] #140282
07/18/07 07:24
07/18/07 07:24
Joined: May 2007
Posts: 185
Netherlands
SurudoiRyu Offline OP
Member
SurudoiRyu  Offline OP
Member

Joined: May 2007
Posts: 185
Netherlands
Quote:

Code:

while(me)
{
if(key_1 == 1) && (player.Wapen1 == 1)
{
my.invisible =off;
player.Wapenkracht = my.fire_power;
}
if(my.invisible == off)
{
vec_set(my.x,player.x);//or use vec_for_vertex to attach to player's hand
my.pan = camera.pan; my.tilt = camera.tilt; //if FPP
if(mouse_left ==1)
{
fire(); //trace from muzzle to vec_for_screen, add effects etc. If result of trace !=0 and you == enemy then your life -= player.fire_power *time_setp; Just example
}
wait(1); // !!!this should be at the end of the while loop, not in an "if" statement!!!
}
}







So i must place that in my player code ?


-The Dragon's Eye is alway's watching you!-
Re: Weapon Help [Re: SurudoiRyu] #140283
07/18/07 08:45
07/18/07 08:45
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
soz mate, i don't know. it's not my code -- it looks like it goes in the weapon's action.

julz


Formerly known as JulzMighty.
I made KarBOOM!
Re: Weapon Help [Re: JibbSmart] #140284
07/18/07 08:51
07/18/07 08:51
Joined: May 2007
Posts: 185
Netherlands
SurudoiRyu Offline OP
Member
SurudoiRyu  Offline OP
Member

Joined: May 2007
Posts: 185
Netherlands
ok hmm im trying now to get something else

working with entity but doesn't know if i can call it or just place it inside an if statement >.<

Ill put my code here maybe you understand and can help me out a bit ^-^

Code:

//////////////////ITEMS.WDL////////////////////////////////////

ACTION Weapon_01
{

if(event_type == event_trigger) && (you == player)
{
my.passable = on;
my.invisible = on;
//snd_play (Gunpickup_snd, 50, 0);
player.Wapen1 = 1;
sleep (2);
ent_remove (my);
}
}




//////////////////PLAYER.WDL///////////////

Var Kracht01 = 10;



while(me)
{
if(key_1 == 1) && (player.Wapen1 == 1)
{
///////////////entity? Can be placed here ?///////////
entity my_gun
{
type = <gun01.mdl>; // put the name of your model here
layer = 10;
view = camera;
x = 25; // x, y, z adjust the position of the weapon in relation to the camera
y = -10;
z = -10;
flags = visible;
}
//////////////////end of entity///////////////
player.Wapenkracht = Kracht01;
}


else
if(key_1 == 1) && (player.Wapen1 == 0)
{
// Show text for 2 sec. “I don’t have that weapon”
}




wait(1); // !!!this should be at the end of the while loop, not in an "if" statement!!!
}


function shoot()
{
//Here goes the shoot function working on it.
}


on_lmb shoot(); //when left mouse button is pressed go to shoot();





-The Dragon's Eye is alway's watching you!-
Re: Weapon Help [Re: SurudoiRyu] #140285
07/18/07 09:14
07/18/07 09:14
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
"entity" must be outside the brackets, and that "while" loop needs to be inside a function or action otherwise it will never happen.

julz


Formerly known as JulzMighty.
I made KarBOOM!
Page 1 of 2 1 2

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