Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Ayumi, AndrewAMD), 770 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
do not pick up when ammo is full? #154190
09/14/07 20:04
09/14/07 20:04
Joined: Jan 2005
Posts: 30
F
fp Offline OP
Newbie
fp  Offline OP
Newbie
F

Joined: Jan 2005
Posts: 30
how can i do it that the player do not pick up the ammo pack, when
"current_ammoreserve is 180"?



action ammo_pack
{
my.passable = on;
while (player == null) {wait (1);}
while (vec_dist (player.x, my.x) > 50)
{
my.pan += 3 * time_step;
wait (1);
}
snd_play (gotammo_wav, 80, 0);
ent_remove (my);
current_ammoreserve += 18;
current_ammoreserve = min(180, current_ammoreserve);
}

Re: do not pick up when ammo is full? [Re: fp] #154191
09/14/07 22:16
09/14/07 22:16
Joined: Aug 2006
Posts: 152
vector(200,45,338)
Marwan Offline
Member
Marwan  Offline
Member

Joined: Aug 2006
Posts: 152
vector(200,45,338)
\\I have changed it mostly only to make it easier, I did not try it , but it could work
\\replace it with the old one
var maximum_ammo=180;
var myammo;
action ammo_pack
{

my.passable = on;
while (player == null) {wait (1);}

while(1)
{
my.pan+=3*time_step;
current_ammoreserve=myammo;
if(current_ammoreserve>maximum_ammo)
{current_ammoreserve-=(myammo -maximum_ammo;}

if (vec_dist(player.x,my.x)<50 && current_ammoreserve<180)
{
snd_play (gotammo_wav, 80, 0);
ent_remove (my);
current_ammoreserve += 18;
}
wait(1);
}
}



Last edited by Marwan; 09/14/07 22:41.
Re: do not pick up when ammo is full? [Re: Marwan] #154192
09/14/07 23:45
09/14/07 23:45
Joined: Jan 2005
Posts: 30
F
fp Offline OP
Newbie
fp  Offline OP
Newbie
F

Joined: Jan 2005
Posts: 30
tried it and got the following error message:

empty pointer in ammo_pack:
((vec_dist(player.x, my.x) < 50 && current_ammoreserve < 180)

Re: do not pick up when ammo is full? [Re: fp] #154193
09/15/07 08:41
09/15/07 08:41
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
do you have a player ?

action player
{
player = me;


"empty"
Re: do not pick up when ammo is full? [Re: flits] #154194
09/15/07 10:06
09/15/07 10:06
Joined: Jan 2005
Posts: 30
F
fp Offline OP
Newbie
fp  Offline OP
Newbie
F

Joined: Jan 2005
Posts: 30
yes, i have a player. in another script, but i think that doesn´t matter, right?

i have a script player.wdl
in that script i included the weapons2.wdl

Re: do not pick up when ammo is full? [Re: fp] #154195
09/15/07 10:31
09/15/07 10:31
Joined: Aug 2006
Posts: 152
vector(200,45,338)
Marwan Offline
Member
Marwan  Offline
Member

Joined: Aug 2006
Posts: 152
vector(200,45,338)
Okay ,1- go to the player script file and do this

entity* player1;//I changed it from (player) to (player1)

2-go inside the player action and change (player=me;)to (player1=me;)

3-go to the ammo pack action and change ( vec_dist(player.x,my.x)) to (vec_dist(player1.x,my.x))
//that should do it


age:16 game design and programming experience:2 years
Re: do not pick up when ammo is full? [Re: Marwan] #154196
09/15/07 13:32
09/15/07 13:32
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
{current_ammoreserve-=(myammo -maximum_ammo);}

Last edited by flits; 09/15/07 13:36.

"empty"
Re: do not pick up when ammo is full? [Re: flits] #154197
09/15/07 13:38
09/15/07 13:38
Joined: Aug 2006
Posts: 152
vector(200,45,338)
Marwan Offline
Member
Marwan  Offline
Member

Joined: Aug 2006
Posts: 152
vector(200,45,338)

Quote:

{current_ammoreserve-=(myammo -maximum_ammocolor:red])[/color; ]



what?????
EDIT: Oh yeh i get it , sorry

Last edited by Marwan; 09/15/07 13:42.
Re: do not pick up when ammo is full? [Re: Marwan] #154198
09/15/07 13:42
09/15/07 13:42
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
srry i dont get thate ubb coding yet so i need to idet it like 20 times lol


"empty"
Re: do not pick up when ammo is full? [Re: fp] #154199
09/15/07 14:26
09/15/07 14:26
Joined: Nov 2002
Posts: 792
Berne, Switzerland
elsewood Offline
User
elsewood  Offline
User

Joined: Nov 2002
Posts: 792
Berne, Switzerland
Why not just changing in your original Code:
 while (vec_dist (player.x, my.x) > 50)

with Code:
 while (vec_dist (player.x, my.x) > 50 || current_ammoreserve >= 180)

??

Last edited by elsewood; 09/15/07 14:29.

A bus station is where the bus stops. A train station is where the train stops.
On my desk I have a workstation...
Page 1 of 2 1 2

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