Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (RealSerious3D, rvl), 1,187 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
squik, AemStones, LucasJoshua, Baklazhan, Hanky27
19060 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
model shoot #80109
06/30/06 18:48
06/30/06 18:48
Joined: May 2005
Posts: 222
T
tek Offline OP
Member
tek  Offline OP
Member
T

Joined: May 2005
Posts: 222
I would love to know how to code a model shooting, the model does not move and is invisible but just shoots a bullet.mdl in one direction.
kinda like every 5 seconds it shoots another bullet facing the same direction always.
I want to make on my game that while I am walking through a pyramid cave I have to overcome obstacles one is arrows that fly at me from a wall I have to pass through them those 5 seconds that it stops shooting.

thanks in advance.

Re: model shoot [Re: tek] #80110
06/30/06 18:52
06/30/06 18:52
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Hey I could post some code, but I need to know which version of gamestudio you are using. (because of syntax differences)

thanks

Re: model shoot [Re: Xarthor] #80111
06/30/06 18:58
06/30/06 18:58
Joined: May 2005
Posts: 222
T
tek Offline OP
Member
tek  Offline OP
Member
T

Joined: May 2005
Posts: 222
I bought gamestudio about a year ago the one I have is version 6.1.

Re: model shoot [Re: tek] #80112
06/30/06 19:04
06/30/06 19:04
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Well first I would update to either 6.31 or 6.40 (both on the download page, 6.31 is at the very bottom of that page), or why didn't you update yet?

Then we can talk about the script.

Re: model shoot [Re: Xarthor] #80113
07/01/06 00:16
07/01/06 00:16
Joined: May 2005
Posts: 222
T
tek Offline OP
Member
tek  Offline OP
Member
T

Joined: May 2005
Posts: 222
ok I updated it to 6.40.

Re: model shoot [Re: tek] #80114
07/01/06 20:56
07/01/06 20:56
Joined: May 2005
Posts: 222
T
tek Offline OP
Member
tek  Offline OP
Member
T

Joined: May 2005
Posts: 222
anyone know ?

Re: model shoot [Re: tek] #80115
07/02/06 05:13
07/02/06 05:13
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
EDIT: Case cleared for me.

Alright lets do this then
Here is the code I came up with: (not tested)
Code:

string arrow_str = <arrow.mdl>; //your arrow model


function arrow_event()
{
//hit an entity?
if(event_type == event_impact || event_type == event_entity)
{
if(you == player) //player = pointer to your player model
{
you.health -= 25; //do damage
}

my.skill1 = 1; //set my skill 1 so I get removed
}

//hit a wall?
if(event_type == event_block)
{
my.skill1 = 1; //remove me
}
}

action arrow_act
{
my.enable_impact = on;
my.enable_entity = on;
my.enable_block = on;
my.event = arrow_event;

my.skill1 = 0;

while(!my.skill1)
{
//change the 5 for making the arrow faster or slower
//if there is a syntax error with time_step, change it into time
c_move(my,vector(5*time_step,0,0),nullvector,ignore_passable);
wait(1);
}

wait(1); //just to be safe
ent_remove(me);
}

action arrow_creator
{
my.invisible = on;
my.passable = on;

my.skill1 = 0;

while(!my.skill1) //get rid of this entity by setting skill1 to 1
{
you = ent_create(arrow_str,my.x,arrow_act);
you.pan = my.pan; //let the arrow face the same way
wait(-5); //wait 5 seconds
}

wait(1);
ent_remove(me);
}




Thunder

Last edited by Thunder; 07/02/06 08:38.
Re: model shoot [Re: Xarthor] #80116
07/02/06 20:12
07/02/06 20:12
Joined: May 2005
Posts: 222
T
tek Offline OP
Member
tek  Offline OP
Member
T

Joined: May 2005
Posts: 222
cool, thanks for the code

I tried it but it doesn't seem to work at first sed gave me an error so I changed "time_step" to "time" like you told me and it worked.
I then made the arrow model and a model for the arrow creator.
I placed the mdl of the arrow creator on my wed game and gave it the action arrow_creator then I build and when I runned all that happened was that the arrow creator exist but is invisible (that's ok because I would like that) but I first see two arrows flying towards a direction and two arrows stuck where the arrow creator.mdl is and no arrows being created or moving.

I would like this to work because I would like to make these obstacles and in a later level big rocks rolling towards me, but if not that's ok because I can place something else and eventually figure it out.

Re: model shoot [Re: tek] #80117
07/02/06 20:24
07/02/06 20:24
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Ok here is a suggestion:
change the "wait(-5);" in the arrow_creator action
into "sleep(5);"

Re: model shoot [Re: Xarthor] #80118
07/02/06 21:19
07/02/06 21:19
Joined: May 2005
Posts: 222
T
tek Offline OP
Member
tek  Offline OP
Member
T

Joined: May 2005
Posts: 222
cool, thanks alot Thunder the sleep(5) did it.

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