1 registered members (TipmyPip),
18,631
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Shoots to the moon
[Re: ]
#454532
09/09/15 21:58
09/09/15 21:58
|
Joined: Aug 2013
Posts: 101
mschoenhals
OP
Member
|
OP
Member
Joined: Aug 2013
Posts: 101
|
so I've made these changes and its better. However, if I press into the door hinge, I go skyward still.
function open_doors() // this function is called by each door
{
set(me, POLYGON | SHADOW);
var door_swing_speed = 5;
var closed_pan = my.pan;
var OPEN_OR_CLOSED = 0;
// if (is(my.FLAG1)) {OPEN_OR_CLOSED = 1;my.pan+=90;closed_pan = my.pan-90;}
VECTOR door_handle;
vec_for_vertex(door_handle, me, 5);
while(1){wait(1);
if(vec_dist(door_handle.x, player.x) < 300 && my.pan == closed_pan){
// set(me, PASSABLE);
while(my.pan < closed_pan+90){wait(1);my.pan+=door_swing_speed;}
SND_CREATE_STATIC(door_opens, door_opens_wav); // play the "door opens" sound
snd_play(door_opens, 100, 0);
// door_sounds(); //runs the function for sounds below.
// reset(me, PASSABLE);
while(key_enter){wait(1);}
}
}
}
|
|
|
Re: Shoots to the moon
[Re: mschoenhals]
#454536
09/09/15 22:05
09/09/15 22:05
|
Malice
Unregistered
|
Malice
Unregistered
|
You are literally ignoring what I am saying.
function open_doors() // this function is called by each door
{
set(me, POLYGON | SHADOW);
var door_swing_speed = 5;
var closed_pan = my.pan;
var OPEN_OR_CLOSED = 0;
// if (is(my.FLAG1)) {OPEN_OR_CLOSED = 1;my.pan+=90;closed_pan = my.pan-90;}
VECTOR door_handle;
vec_for_vertex(door_handle, me, 5);
while(1){wait(1);
if(vec_dist(door_handle.x, player.x) < 300 && my.pan == closed_pan){
// // REMOVED A SET
while(my.pan < closed_pan+90){wait(1);my.pan+=door_swing_speed;}
SND_CREATE_STATIC(door_opens, door_opens_wav); // play the "door opens" sound
snd_play(door_opens, 100, 0);
// door_sounds(); //runs the function for sounds below.
// // REMOVED A RESET
while(key_enter){wait(1);}
}
}
}
|
|
|
Re: Shoots to the moon
[Re: mschoenhals]
#454539
09/09/15 22:22
09/09/15 22:22
|
Malice
Unregistered
|
Malice
Unregistered
|
Have you now gone back and fixed the RETURNS in the action like I said a few post ago.
Tell you what, I'm just going to write this for you.
Give me a minute.
|
|
|
Re: Shoots to the moon
[Re: ]
#454540
09/09/15 22:37
09/09/15 22:37
|
Malice
Unregistered
|
Malice
Unregistered
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Template rpg doors and keys
// Written by Mike Schoenhals, May 11th, 2015.
// based on the Tutorial code by Bandicam, Devon Lively
// HACKED by Malice
//DOOR MUST HAVE BOUNDING BOX FLAG ENABLED!!!!!!!
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define key skill1
#define key skill2
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var door_range = 120; //scan distance of door to player
var key_rotating_speed = 5; //how fast should the key rotate when visible
STRING* got_key_wav = "gotkey.wav"; //sets the file name for getting a key
STRING* door_opens_wav = "dooropens.wav"; //sets the file name for opening the door
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function key_collision()
{
if (you == player)
{
my.skill67 = 1;
}
}
//Below is a define skill statement needed for the customizable window in WED. Note how they are commented out.
// skill1: key 0
action keys()
{
set (my, PASSABLE); // the key is passable
while (!player) {wait (1);} // wait until the player model is loaded
while (vec_dist (player.x, my.x) > 50) // wait until the player comes close to the key
{
my.pan += 5 * time_step; // rotate while waiting for the player
wait (1);
}
player.skill70 = my.skill1; // now pass the value set inside the key's skill1 using Wed to player's skill70
SND_CREATE_STATIC(got_the_key, got_key_wav);
snd_play(got_the_key, 80, 0); // play the "got the key" sound
set (my, INVISIBLE); // make the key invisible
wait (-1);
ent_remove(my); // and then remove it after a second
}
function open_doors() // this function is called by each door
{
set(me, POLYGON | SHADOW);
var door_swing_speed = 5;
var closed_pan = my.pan;
var OPEN_OR_CLOSED = 0;
// if (is(my.FLAG1))
{
OPEN_OR_CLOSED = 1;
my.pan+=90;
closed_pan = my.pan-90;
}
VECTOR door_handle;
//vec_for_vertex(door_handle, me, 1); // Not needed at all
while(1){
if(vec_dist(my.x, player.x) < 100 && my.pan == closed_pan)
{
if(!key_enter && my.skill88)
{
my.skill88=0;
}
if(key_enter && !my.skill88)
{
my.skill88 = 1;
my.skill89 = 1;
}
if(my.pan < closed_pan+90 && my.skill89)
{
my.pan+=door_swing_speed;
SND_CREATE_STATIC(door_opens, door_opens_wav); // play the "door opens" sound
snd_play(door_opens, 100, 0);
// door_sounds(); //runs the function for sounds below.
}
}
wait(1); // wait goes at the end....
}
}
// skill2: key 0
action door()
{
while (!player) {wait (1);} // wait until the player is loaded
vec_set (my.skill61, my.x); // store the xyz initial position of the door inside skill61... 63
my.skill64 = my.pan; // store the initial pan angle
while (!my.skill89)
{
c_scan(my.x, my.pan, vector(360, 180, door_range), IGNORE_ME | SCAN_ENTS); // each door scans around it, trying to detect the player
if (you) // detected an entity?
{
if (my.skill2 > 0) // this door needs a key?
{
if (player.skill70 == my.skill2) // the player has got the proper key? then let's open the door!
{
open_doors(); // this function opens the doors
break; // the action stops afterwards
}
}
else // this door doesn't need a key
{
open_doors(); // this function opens the doors
break; // the action stops afterwards
}
}
wait (1);
}
}
Please test this code for issues. You may be noticing a sound issue by now. I'll leave that little bit to you. MOVE the snd_play() into the brackets with my.skill89 =1; in them...
Last edited by Malice; 09/09/15 22:46.
|
|
|
Re: Shoots to the moon
[Re: ]
#454542
09/10/15 00:02
09/10/15 00:02
|
Malice
Unregistered
|
Malice
Unregistered
|
While it either doesn't work or it works and your busy on something else.
Have fun and code on.
|
|
|
Re: Shoots to the moon
[Re: ]
#454573
09/10/15 16:33
09/10/15 16:33
|
Malice
Unregistered
|
Malice
Unregistered
|
I would like to thank you for engaging in this problem, having me work hard to communicate, having me write actual code and then simple going silent.
Good luck, but I will not be taking my time again to help you.
Mal
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|