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
0 registered members (), 18,654 guests, and 5 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
[Solved]Pointers from switch_key action to doors #336163
08/02/10 02:06
08/02/10 02:06
Joined: Jul 2010
Posts: 32
E
EID Offline OP
Newbie
EID  Offline OP
Newbie
E

Joined: Jul 2010
Posts: 32
really i have a big problem that summarized that i want to make the switch key is an smart key to be able to distinguish which door to be open by player . i have one action for switch_key to the all keys and another one action to the all doors . then the player going to open the press tha switch then the bordering door to the switch to be opned. my problem now is the all doors in the level opened when the player press any switch. Hint the switch sacn the player if he have the security card or not then trigger the actions .
here is my code...
#define ON 1
#define OFF 2
var key_check=0;// global variable should be to set to ON when the key_pressed
var card_check=OFF;
var door_check=0;

function detect() // detecting
{
if (event_type == EVENT_DETECT)
{
}
}
function security_card_event() // security card function
{
if (event_type== EVENT_IMPACT)
{
card_check=ON;
my.z=200;
}
}

function open_door() //open door function
{
if(card_check==ON)
{
if (event_type == EVENT_SCAN && key_o)
{
door_check=ON;
}
if (event_type == EVENT_SCAN && key_c)
{
door_check=OFF;
}
}
}
action security_card()// action security card
{
my.push=0;
my.emask |= ENABLE_IMPACT; // lite-C
my.event =security_card_event;
}
action switch_key() // action switch key
{
var switch_scan_range = 80;
var switch_scan_cone_horizontal = 90;
var switch_scan_cone_vertical = 90;

my.event = detect;
while(1)
{
c_scan(my.x,my.pan,vector(switch_scan_cone_horizontal,switch_scan_cone_vertical,switch_scan_range),SCAN_ENTS | SCAN_LIMIT|IGNORE_ME);
wait(1);
}
}

action door()//action door
{
var door_step=3;
var door_full_trip=200;
var counter=0;
var door_travelled_dist = 0.0;
while(1)
{
if( door_check==ON)
{
if (door_travelled_dist < door_full_trip)
{
door_travelled_dist += door_step*time_step;
my.z+=door_step*time_step;
}
else
{
my.z += door_full_trip -door_travelled_dist ;
door_travelled_dist = door_full_trip;
}
}
if(door_check ==OFF)
{
if (door_travelled_dist > 0)
{
door_travelled_dist -= door_step*time_step;
my.z-=door_step*time_step;
}
else
{
my.z -= -door_travelled_dist ;
door_travelled_dist = 0;
}
}
wait(1);
}
wait(1);
}

in the end the player action that have pointer player=me;

/////////////////////// SOLVED BY 3RUN (Muhamed) ////////////////////////////

#define switch_number skill19 //only use these skill numbers for
#define switch_status skill20 //entities that react to switches

function switch_event()
{
if(event_type == EVENT_IMPACT)
{
my.emask &= ~(ENABLE_IMPACT);
you=NULL;
if(my.skill20)
{
my.skill20 = 0; //toggle switch setting
}
else
{
my.skill20 = 1; //toggle switch setting
}
while((you=ent_next(you)))
{
if(you.skill19==my.skill19)
{
you.skill20 = my.skill20;
}
wait(-1);
}
if(my.skill18)
{
my.emask |= (ENABLE_IMPACT);
}
}
}


//skill18: switch_type 0 //0=one-shot, 1=toggle
//skill19: switch_number 0
//skill20: switch_status 0
action door_button()
{
c_setminmax(my);
my.emask |= (ENABLE_IMPACT);
my.event = switch_event;
}

//skill16: door_speed 10
//skill17: door_highest 100
//skill18: door_lowest 0
//skill19: switch_number 0
//skill20: switch_status 0
action door_()
{
wait(1);
c_setminmax(my);
while(1)
{
if(my.skill20)
{
if(my.z < my.skill17)
{
my.z += my.skill16*time_step;
}
if(!my.skill20)
{
if(my.z > my.skill18)
{
my.z -= my.skill16*time_step;
}
}
}
wait(1);
}
}


[b][/b]

Last edited by EID; 08/02/10 10:34.
Re: Pointers from switch_key action to doors [Re: EID] #336166
08/02/10 02:20
08/02/10 02:20
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
PM me bro, I'll be happy to help you laugh


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Pointers from switch_key action to doors [Re: 3run] #336167
08/02/10 02:25
08/02/10 02:25
Joined: Jul 2010
Posts: 32
E
EID Offline OP
Newbie
EID  Offline OP
Newbie
E

Joined: Jul 2010
Posts: 32
i am do it grin i am waitin

Re: Pointers from switch_key action to doors [Re: EID] #336168
08/02/10 02:29
08/02/10 02:29
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
You are doing what? grin You didn't PM me yet^^


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Pointers from switch_key action to doors [Re: 3run] #336169
08/02/10 02:31
08/02/10 02:31
Joined: Jul 2010
Posts: 32
E
EID Offline OP
Newbie
EID  Offline OP
Newbie
E

Joined: Jul 2010
Posts: 32
make the registration in this site ... then????

Re: Pointers from switch_key action to doors [Re: EID] #336170
08/02/10 02:34
08/02/10 02:34
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
Ohh grin My friend, I didn't mean that you need to register on my site and so on laugh You just needed to send a private message here on this forum laugh But, I'm happy to see you on my website. Make a topic on my website forum, I'll make a demo level, and will post there.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Pointers from switch_key action to doors [Re: 3run] #336171
08/02/10 02:38
08/02/10 02:38
Joined: Jul 2010
Posts: 32
E
EID Offline OP
Newbie
EID  Offline OP
Newbie
E

Joined: Jul 2010
Posts: 32
never mind i am so happy to be with u in ur website . and now u want an personal msg form me to u .. what is the message include ??

Re: Pointers from switch_key action to doors [Re: EID] #336172
08/02/10 02:39
08/02/10 02:39
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
Never mind, just make a topic on my forum about ur request wink Assalamu Aleykum by the way wink


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Pointers from switch_key action to doors [Re: 3run] #336173
08/02/10 02:43
08/02/10 02:43
Joined: Jul 2010
Posts: 32
E
EID Offline OP
Newbie
EID  Offline OP
Newbie
E

Joined: Jul 2010
Posts: 32
hhhhhh we alikom el salam we rahmet alla we brkaato by the way also wink thank u


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