Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, 1 invisible), 18,787 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Making a "Hitbox" [Re: Leaf] #134347
06/08/07 08:34
06/08/07 08:34
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Yeah I just wrote it down quickly.
The beep is just there for "debug purpose" so I would take it out and replace it with the code which should be executed when the if statement is "true".
The action name was to long, yeah maybe but again I just wrote it as scetch and not "working" code

Re: Making a "Hitbox" [Re: Xarthor] #134348
06/11/07 18:55
06/11/07 18:55
Joined: May 2006
Posts: 69
Canada
L
Leaf Offline OP
Junior Member
Leaf  Offline OP
Junior Member
L

Joined: May 2006
Posts: 69
Canada
I must of got excited, I forgot what I wanted... It was when the 0,0 of my screen looks at the model it does the action. Right now its if im within 200 quants x value it happens, not if ive got my crosshair over it (which is 0,0 of the screen always)

Anyways this is what ive got done with the script you gave me as a Automatic Door trigger:

/////////////////////////////////////////////////////////////////////////////////////////////////
//Leafs automatic door action script/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
ACTION door_vert {

my.shadow = on;//casts a shadow
my.gravity = off;//gravity off or your door might float away
wait(1);
my.polygon= on;//polygon collison
c_updatehull(my,my.frame);//updates the collison once the door is moved to its new position
wait(2);

while(1)//how many times to run the if statement //should only be a value of 1 for doors
{

//if the player is within clipping distance //If player is within 200 quants do
if(my.clipped != on && vec_dist(my.x,player.x) <= 200)
//if the player is within clippin distance //If player is within 200 quants do
{
my.z + = 140*1 ;//play with "140" for how far door goes up
time_smooth = 0.666;//smooths vertical movement over 3 frames incase of hardware lag

wait(1000);//time in millo-seconds before the door goes down

my.z - = 140*1 ;//play with "140" for how far door goes down
time_smooth = 0.666;//smooths vertical movement over 3 frames incase of hardware lag
wait(100);//time in millo-seconds before the door re-opens //only if you are still in range
}
wait(1);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////
//End of Leafs door action script////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////




Thanks, Leaf

Re: Making a "Hitbox" [Re: Leaf] #134349
06/11/07 19:01
06/11/07 19:01
Joined: May 2006
Posts: 69
Canada
L
Leaf Offline OP
Junior Member
Leaf  Offline OP
Junior Member
L

Joined: May 2006
Posts: 69
Canada
Would the if statement be:

if(my.clipped != on && vec_dist(my.x,player.x) <= 200 && vec_dist(my.y,player.y) == 0 && vec_dist(my.z,player.z) == 0)


??

Re: Making a "Hitbox" [Re: Leaf] #134350
06/14/07 07:24
06/14/07 07:24
Joined: May 2006
Posts: 69
Canada
L
Leaf Offline OP
Junior Member
Leaf  Offline OP
Junior Member
L

Joined: May 2006
Posts: 69
Canada
Another Bumps, Xauthor came close to solving it but not quite, still ned help please.

Re: Making a "Hitbox" [Re: Leaf] #134351
06/14/07 08:57
06/14/07 08:57
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
But I dont't get it
What do You want to make? Just doors which woorks only when You are close enough and when you touch it with crosshair?

Last edited by tompo; 06/14/07 09:06.

Never say never.
Re: Making a "Hitbox" [Re: tompo] #134352
06/14/07 18:10
06/14/07 18:10
Joined: May 2006
Posts: 69
Canada
L
Leaf Offline OP
Junior Member
Leaf  Offline OP
Junior Member
L

Joined: May 2006
Posts: 69
Canada
Quote:

But I dont't get it
What do You want to make? Just doors which woorks only when You are close enough and when you touch it with crosshair?




Yup, when the center of my camera is over the entity and im withing the distance then do the unction I give it.

So if I aim at the entity with my crosshair and im within 200 quants.

Re: Making a "Hitbox" [Re: Leaf] #134353
06/14/07 18:14
06/14/07 18:14
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
so simple trigger event is not good enough?

function door_event
{
if(event_type == event_trigger) && (vec_to_screen(me,camera) ==1)
{do action;}
}

action door_action
{
my.enable_trigger = on;
my.trigger_range = 200;
my.event = door_event;
}

or
function door_event
{
if(vec_dist(my.x,player.x) <= 200) && (vec_to_screen(me,camera) ==1)
{do action;}
}

Last edited by tompo; 06/14/07 18:16.

Never say never.
Re: Making a "Hitbox" [Re: tompo] #134354
06/14/07 18:35
06/14/07 18:35
Joined: May 2006
Posts: 69
Canada
L
Leaf Offline OP
Junior Member
Leaf  Offline OP
Junior Member
L

Joined: May 2006
Posts: 69
Canada
okay I used your example:

Quote:


function door_event
{
if(vec_dist(my.x,player.x) <= 200) && (vec_to_screen(me,camera) ==1)
{do action;}
}




and when I compile, then run, it crashes after the load screen a few frames in saying bad:

if(my.clipped != on && vec_dist(my.x,player.x) <= 200 && vec_to_screen(me,camera) ==1)



wich is the IF statement

Re: Making a "Hitbox" [Re: Leaf] #134355
06/14/07 18:54
06/14/07 18:54
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
if you use
if(vec_dist(my.x,player.x) <= 200) && (vec_to_screen(me,camera) ==1)

this one
if(my.clipped != on && vec_dist(my.x,player.x) <= 200 && vec_to_screen(me,camera) ==1)
is useless... specialy clipped becouse if(vec_to_screen) = if visible
try just to copy/pste my code and we'll see what will happend


Never say never.
Re: Making a "Hitbox" [Re: tompo] #134356
06/15/07 06:55
06/15/07 06:55
Joined: May 2006
Posts: 69
Canada
L
Leaf Offline OP
Junior Member
Leaf  Offline OP
Junior Member
L

Joined: May 2006
Posts: 69
Canada
I still get the same error using your code. Plus if I copied and pasted you have one too many ")" Also, removed my.clipped !=on but still no good.

Bump for more help

Page 2 of 2 1 2

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

Gamestudio download | 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