2 registered members (Akow, tomaslolo),
1,536
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
quick question
#147723
08/13/07 20:16
08/13/07 20:16
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
i am working on a recharge code and am useing morrowing as an example, i have the recharge and panels all working ok, and i wrote this bit of code as a small test, what should happen is the charge goes back to 0 and a sound should play, but neither happens, could someone point out were i`ve gone wrong please Code:
function beam_weapons { if ((mouse_left == 1) && (player.phaser == 70)) { player.phaser = 0; snd_play (beam_wav, 50, 0); } }
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
Re: quick question
[Re: jigalypuff]
#147724
08/13/07 22:09
08/13/07 22:09
|
Joined: May 2006
Posts: 398
Bot190
Senior Member
|
Senior Member
Joined: May 2006
Posts: 398
|
well, the phasers energy has to be 70, guessing that player.phaser is the phasers energy. other than that i don't know. oh and try "on" instead of 1.
Last edited by Bot190; 08/13/07 22:12.
Wait, there isn't a "Make My Game Now" button?
|
|
|
Re: quick question
[Re: Bot190]
#147725
08/13/07 22:14
08/13/07 22:14
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
well ya but the phaser energy is up, that is all working ok, here`s the code for that. Code:
panel Phaser_pan { bmap = charge_pan_tga; pos_x = 945; pos_y = 567; window = 3, 2, 74, 7, charge_tga, player.phaser, 0; // can range from 0 to 74 flags = refresh, visible; }
function init_player_startup() { while (player == null) {wait (1);} player.phaser = 74; while (1) { player.phaser += 0.4 * time; // increase power slowly player.phaser = min(74, player.phaser); // limit phaser power 74 wait (1); } }
all this seems to work, and i assume at least the sound should play when i press the left mouse button.
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
Re: quick question
[Re: jigalypuff]
#147726
08/13/07 22:17
08/13/07 22:17
|
Joined: May 2006
Posts: 398
Bot190
Senior Member
|
Senior Member
Joined: May 2006
Posts: 398
|
well the way your code is writen the player.phaser has to be at 70 no more no less... so if its at 74 it won't work. and obviusly you have to have the sound file in the same foler. try switching the mouse thing.
[Edit] you didn't call the function that checks if you pressed the mouse button... or is it called somewhere? [Edit]
Last edited by Bot190; 08/14/07 00:06.
Wait, there isn't a "Make My Game Now" button?
|
|
|
Re: quick question
[Re: LogantheHogan]
#147728
08/14/07 14:02
08/14/07 14:02
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
i am useing on_mouse_left to activate the function. logan i have tried what you suggested but it did not work, i suspect this is my fault though lol, how would you suggest i use the int() function? i don`t recall seeing that in the morrowing code at all. here is what i tried. Code:
function beam_weapons { if ((mouse_left == 1) && (player.phaser >68 && player.phaser <72)) { player.phaser = 0; snd_play (beam_wav, 50, 0); } }
on_mouse_left = beam_weapons;
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
Re: quick question
[Re: jigalypuff]
#147729
08/14/07 15:36
08/14/07 15:36
|
Joined: Sep 2002
Posts: 700 Orange County, CA
LogantheHogan
Developer
|
Developer
Joined: Sep 2002
Posts: 700
Orange County, CA
|
maybe if((mouse_left == 1) && int(player.phaser) == 70) {}
but I'd use an easier thing just for testing, and just say if((mouse_left == 1) && player.phaser > 70){}. See if that works.
Also, like Bot said, I saw no reference to the beam_weapons function in the other code you posted. make sure you're calling it somewhere, or make sure it's running somehow. if you're not, that is your problem.
EDIT: never mind. I just saw your last post when you referenced on_mouse_left. So that's not the problem.
Last edited by LogantheHogan; 08/14/07 15:36.
|
|
|
Re: quick question
[Re: LogantheHogan]
#147730
08/14/07 15:42
08/14/07 15:42
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
woohoo cheers guys, it now works, any thoughts on how to get the energy to slowly deplete while the mouse button si pressed lol.
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
Re: quick question
[Re: LogantheHogan]
#147732
08/14/07 21:57
08/14/07 21:57
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
that works with just one little problem, when the power has been decreased i can keep fireing, it needs to actually not be able t owork if there is no power. thanks for your help.
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
|