2 registered members (TipmyPip, 1 invisible),
18,731
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: switch player question?
[Re: lomeniki]
#79917
06/29/06 22:41
06/29/06 22:41
|
Joined: May 2004
Posts: 1,510 Denmark
Claus_N
Serious User
|
Serious User
Joined: May 2004
Posts: 1,510
Denmark
|
While looking at the mouse_toggle function (menu.wdl), I found out, that you should just do it this way Code:
function showPlslPan() { plSelectionPan.pos_x = (screen_size.x - bmap_width(plSelectionPan.bmap)) / 2; plSelectionPan.pos_y = (screen_size.y - bmap_height(plSelectionPan.bmap)) / 2; plSelectionPan.visible = on; mouse_mode = 2; mouse_on(); }
I have no clue atm about what happened to the animations :S Maybe your other models don't have those animations..?? (I know it's the same model just with different skins... But that's the only reason I can think of right now  ) I don't know how to avoid the movement... Post in the templates forum about that 
|
|
|
Re: switch player question?
[Re: Claus_N]
#79918
06/29/06 23:07
06/29/06 23:07
|
Joined: Jun 2006
Posts: 32
lomeniki
OP
Newbie
|
OP
Newbie
Joined: Jun 2006
Posts: 32
|
1000x Thanks
For mdl`s you were right.i checked them -there are frames but when i played them nothing happens.I done something wrong(but i only change skin) & save them as mdl5.
2 more: How to add some wav`s (for each button when highlited so we hear player names...) & and little transparency for background and butons. Can they be a tga with alpha ch.(or some your sugestion for better pic format)?
P.S.If you haven`t time now i`ll wait.Thanks anyway.
Edit: I checked original cbabe.mdl in MED.It`s a mdl4 file, and i only have mdl5 & mdl7 save option. Q:Can A5_template work with mdl5 or 7?
Last edited by lomeniki; 06/29/06 23:53.
|
|
|
Re: switch player question?
[Re: lomeniki]
#79919
06/30/06 08:50
06/30/06 08:50
|
Joined: May 2004
Posts: 1,510 Denmark
Claus_N
Serious User
|
Serious User
Joined: May 2004
Posts: 1,510
Denmark
|
For the sound: Code:
///////////////////////////////////////// sound pl1_snd = <SOUND>; sound pl2_snd = <SOUND>; sound pl3_snd = <SOUND>; sound pl4_snd = <SOUND>; function pl_sound(but,pan) { if(but == 1) {snd_play(pl1_snd,100,10);} if(but == 2) {snd_play(pl2_snd,100,10);} if(but == 3) {snd_play(pl3_snd,100,10);} if(but == 4) {snd_play(pl4_snd,100,10);} } ///////////////////////////////////////// panel plSelectionPan { flags = refresh; button = 20,20,pl1_hover,pl1_normal,pl1_hover,plSelect,null,pl_sound; button = 20,50,pl2_hover,pl2_normal,pl2_hover,plSelect,null,pl_sound; button = 20,80,pl3_hover,pl3_normal,pl3_hover,plSelect,null,pl_sound; button = 20,110,pl4_hover,pl4_normal,pl4_hover,plSelect,null,pl_sound; button = 20,140,pl4_hover,pl4_normal,pl4_hover,plSelect,null,pl_sound; button = 20,170,cancel_but,cancel_but,cancel_but,plSelect_cancel,null,null; } /////////////////////////////////////////
Yep, you need to use a tga with alpha channel  (Or setting transparent and the alpha value of the panel, though I'd recommend using an alpha channel) I don't know much about the model formats. I think you should use mdl7, but I dunno.
|
|
|
Re: switch player question?
[Re: lomeniki]
#79921
06/30/06 14:13
06/30/06 14:13
|
Joined: May 2004
Posts: 1,510 Denmark
Claus_N
Serious User
|
Serious User
Joined: May 2004
Posts: 1,510
Denmark
|
Okay, this should do it. It doesn't stop the sound when the mouse is moved away from the buttons, but it stops the previous sound when you move the mouse over another button. Code:
///////////////////////////////////////// sound pl1_snd = <SOUND>; sound pl2_snd = <SOUND>; sound pl3_snd = <SOUND>; sound pl4_snd = <SOUND>; sound cancel_snd = <SOUND>;
var_nsave pl_snd_handle; function pl_sound(but,pan) { if(pl_snd_handle != 0) { snd_stop(pl_snd_handle); } if(but == 1) {pl_snd_handle = snd_play(pl1_snd,100,10);} if(but == 2) {pl_snd_handle = snd_play(pl2_snd,100,10);} if(but == 3) {pl_snd_handle = snd_play(pl3_snd,100,10);} if(but == 4) {pl_snd_handle = snd_play(pl4_snd,100,10);} if(but == 5) {pl_snd_handle = snd_play(cancel_snd,100,10);} } ///////////////////////////////////////// panel plSelectionPan { flags = refresh; button = 20,20,pl1_hover,pl1_normal,pl1_hover,plSelect,null,pl_sound; button = 20,50,pl2_hover,pl2_normal,pl2_hover,plSelect,null,pl_sound; button = 20,80,pl3_hover,pl3_normal,pl3_hover,plSelect,null,pl_sound; button = 20,110,pl4_hover,pl4_normal,pl4_hover,plSelect,null,pl_sound; button = 20,140,pl4_hover,pl4_normal,pl4_hover,plSelect,null,pl_sound; button = 20,170,cancel_but,cancel_but,cancel_but,plSelect_cancel,null,pl_sound; } ///////////////////////////////////////// Code:
///////////////////////////////////////// sound pl1_sel_snd = <SOUND>; sound pl2_sel_snd = <SOUND>; sound pl3_sel_snd = <SOUND>; sound pl4_sel_snd = <SOUND>; sound cancel_sel_snd = <SOUND>;
function plSelect(but,pan) { if(!player) {return;} if(!ptrs_set) {setStrings();} if(but <= 0 || but > numStrings) {return;} ptr_string = ptr_for_handle(string_ptrs[but - 1]); ent_morph(player,ptr_string); if(pl_snd_handle != 0) { snd_stop(pl_snd_handle); } if(but == 1) {pl_snd_handle = snd_play(pl1_sel_snd,100,10);} if(but == 2) {pl_snd_handle = snd_play(pl2_sel_snd,100,10);} if(but == 3) {pl_snd_handle = snd_play(pl3_sel_snd,100,10);} if(but == 4) {pl_snd_handle = snd_play(pl4_sel_snd,100,10);} if(but == 5) {pl_snd_handle = snd_play(cancel_sel_snd,100,10);} plSelectionPan.visible = off; mouse_mode = 0; } /////////////////////////////////////////
|
|
|
Re: switch player question?
[Re: Claus_N]
#79922
06/30/06 20:24
06/30/06 20:24
|
Joined: Jun 2006
Posts: 32
lomeniki
OP
Newbie
|
OP
Newbie
Joined: Jun 2006
Posts: 32
|
Everything work exept when cick "cancel button" there is no sound.
Here is the code so far, so you can check it. Is this good to place "sound comand" in 2 diferent places?
Code: ///////////////////////////////////////// // On mouse-over bmap pl1_hover = <pl1-h.bmp>; bmap pl2_hover = <pl2-h.bmp>; bmap pl3_hover = <pl3-h.bmp>; bmap pl4_hover = <pl4-h.bmp>; // Normal bmap pl1_normal = <play1.bmp>; bmap pl2_normal = <play2.bmp>; bmap pl3_normal = <play3.bmp>; bmap pl4_normal = <play4.bmp>; // Other bmaps bmap cancel_but = <cancel.bmp>; bmap plSelectMap = <backg.bmp>; ///////////////////////////////////////// // Player models string pl1_mdl = <pl1.mdl>; string pl2_mdl = <pl2.mdl>; string pl3_mdl = <pl3.mdl>; string pl4_mdl = <pl4.mdl>; string* ptr_string; // String pointer ///////////////////////////////////////// // Constants define numStrings,4; ///////////////////////////////////////// // Variables var ptrs_set = 0; var string_ptrs[numStrings]; ///////////////////////////////////////// // Function prototypes function plSelect(but,pan); function plSelect_cancel(); ///////////////////////////////////////// //Sound settings sound pl1_snd = <c1.wav>; sound pl2_snd = <c2.wav>; sound pl3_snd = <c3.wav>; sound pl4_snd = <c4.wav>; sound cancel_snd = <cancel.wav>;
var_nsave pl_snd_handle; function pl_sound(but,pan) { if(pl_snd_handle != 0) { snd_stop(pl_snd_handle); } if(but == 1) {pl_snd_handle = snd_play(pl1_snd,100,10);} if(but == 2) {pl_snd_handle = snd_play(pl2_snd,100,10);} if(but == 3) {pl_snd_handle = snd_play(pl3_snd,100,10);} if(but == 4) {pl_snd_handle = snd_play(pl4_snd,100,10);} if(but == 5) {pl_snd_handle = snd_play(cancel_snd,100,10);} } ///////////////////////////////////////// panel plSelectionPan { bmap = plSelectMap; flags = refresh; button = 20,20,pl1_hover,pl1_normal,pl1_hover,plSelect,null,pl_sound; button = 20,60,pl2_hover,pl2_normal,pl2_hover,plSelect,null,pl_sound; button = 20,100,pl3_hover,pl3_normal,pl3_hover,plSelect,null,pl_sound; button = 20,140,pl4_hover,pl4_normal,pl4_hover,plSelect,null,pl_sound; button = 20,180,cancel_but,cancel_but,cancel_but,plSelect_cancel,null,pl_sound; } ///////////////////////////////////////// function setStrings() { string_ptrs[0] = handle(pl1_mdl); string_ptrs[1] = handle(pl2_mdl); string_ptrs[2] = handle(pl3_mdl); string_ptrs[3] = handle(pl4_mdl); ptrs_set = 1; } ///////////////////////////////////////// sound pl1_sel_snd = <sel1.wav>; sound pl2_sel_snd = <sel2.wav>; sound pl3_sel_snd = <sel3.wav>; sound pl4_sel_snd = <sel4.wav>; sound cancel_sel_snd = <selcan.wav>;
function plSelect(but,pan) { if(!player) {return;} if(!ptrs_set) {setStrings();} if(but <= 0 || but > numStrings) {return;} ptr_string = ptr_for_handle(string_ptrs[but - 1]); ent_morph(player,ptr_string); if(pl_snd_handle != 0) { snd_stop(pl_snd_handle); } if(but == 1) {pl_snd_handle = snd_play(pl1_sel_snd,100,10);} if(but == 2) {pl_snd_handle = snd_play(pl2_sel_snd,100,10);} if(but == 3) {pl_snd_handle = snd_play(pl3_sel_snd,100,10);} if(but == 4) {pl_snd_handle = snd_play(pl4_sel_snd,100,10);} if(but == 5) {pl_snd_handle = snd_play(cancel_sel_snd,100,10);} plSelectionPan.visible = off; mouse_mode = 0; } ///////////////////////////////////////// function plSelect_cancel() { plSelectionPan.visible = off; mouse_mode = 0; } ///////////////////////////////////////// function showPlslPan() { plSelectionPan.pos_x = (screen_size.x - bmap_width(plSelectionPan.bmap)) / 2; plSelectionPan.pos_y = (screen_size.y - bmap_height(plSelectionPan.bmap)) / 2; plSelectionPan.visible = on; mouse_mode = 2; mouse_on(); } on_mouse_right = showPlslPan; /////////////////////////////////////////
|
|
|
Re: switch player question?
[Re: lomeniki]
#79923
07/02/06 17:38
07/02/06 17:38
|
Joined: May 2004
Posts: 1,510 Denmark
Claus_N
Serious User
|
Serious User
Joined: May 2004
Posts: 1,510
Denmark
|
Moved the line: if(but == 5) {pl_snd_handle = snd_play(cancel_sel_snd,100,10);} from function plSelect, to function plSelect_cancel, and modified it a bit. Quote:
Is this good to place "sound comand" in 2 diferent places?
That might be a matter of taste. I (and most others, I think) prefer the variable/bmap/sound/etc. definitions in the beginning/start of the script 
Code:
///////////////////////////////////////// // On mouse-over bmap pl1_hover = <pl1-h.bmp>; bmap pl2_hover = <pl2-h.bmp>; bmap pl3_hover = <pl3-h.bmp>; bmap pl4_hover = <pl4-h.bmp>; // Normal bmap pl1_normal = <play1.bmp>; bmap pl2_normal = <play2.bmp>; bmap pl3_normal = <play3.bmp>; bmap pl4_normal = <play4.bmp>; // Other bmaps bmap cancel_but = <cancel.bmp>; bmap plSelectMap = <backg.bmp>; ///////////////////////////////////////// // Player models string pl1_mdl = <pl1.mdl>; string pl2_mdl = <pl2.mdl>; string pl3_mdl = <pl3.mdl>; string pl4_mdl = <pl4.mdl>; string* ptr_string; // String pointer ///////////////////////////////////////// // Constants define numStrings,4; ///////////////////////////////////////// // Variables var ptrs_set = 0; var string_ptrs[numStrings]; var_nsave pl_snd_handle; ///////////////////////////////////////// // Function prototypes function plSelect(but,pan); function plSelect_cancel(); ///////////////////////////////////////// //Sound settings sound pl1_snd = <c1.wav>; sound pl2_snd = <c2.wav>; sound pl3_snd = <c3.wav>; sound pl4_snd = <c4.wav>; sound cancel_snd = <cancel.wav>; sound pl1_sel_snd = <sel1.wav>; sound pl2_sel_snd = <sel2.wav>; sound pl3_sel_snd = <sel3.wav>; sound pl4_sel_snd = <sel4.wav>; sound cancel_sel_snd = <selcan.wav>; ///////////////////////////////////////// function pl_sound(but,pan) { if(pl_snd_handle != 0) { snd_stop(pl_snd_handle); } if(but == 1) {pl_snd_handle = snd_play(pl1_snd,100,10);} if(but == 2) {pl_snd_handle = snd_play(pl2_snd,100,10);} if(but == 3) {pl_snd_handle = snd_play(pl3_snd,100,10);} if(but == 4) {pl_snd_handle = snd_play(pl4_snd,100,10);} if(but == 5) {pl_snd_handle = snd_play(cancel_snd,100,10);} } ///////////////////////////////////////// panel plSelectionPan { bmap = plSelectMap; flags = refresh; button = 20,20,pl1_hover,pl1_normal,pl1_hover,plSelect,null,pl_sound; button = 20,60,pl2_hover,pl2_normal,pl2_hover,plSelect,null,pl_sound; button = 20,100,pl3_hover,pl3_normal,pl3_hover,plSelect,null,pl_sound; button = 20,140,pl4_hover,pl4_normal,pl4_hover,plSelect,null,pl_sound; button = 20,180,cancel_but,cancel_but,cancel_but,plSelect_cancel,null,pl_sound; } ///////////////////////////////////////// function setStrings() { string_ptrs[0] = handle(pl1_mdl); string_ptrs[1] = handle(pl2_mdl); string_ptrs[2] = handle(pl3_mdl); string_ptrs[3] = handle(pl4_mdl); ptrs_set = 1; } ///////////////////////////////////////// function plSelect(but,pan) { if(!player) {return;} if(!ptrs_set) {setStrings();} if(but <= 0 || but > numStrings) {return;} ptr_string = ptr_for_handle(string_ptrs[but - 1]); ent_morph(player,ptr_string); if(pl_snd_handle != 0) { snd_stop(pl_snd_handle); } if(but == 1) {pl_snd_handle = snd_play(pl1_sel_snd,100,10);} if(but == 2) {pl_snd_handle = snd_play(pl2_sel_snd,100,10);} if(but == 3) {pl_snd_handle = snd_play(pl3_sel_snd,100,10);} if(but == 4) {pl_snd_handle = snd_play(pl4_sel_snd,100,10);} plSelectionPan.visible = off; mouse_mode = 0; } ///////////////////////////////////////// function plSelect_cancel() { if(pl_snd_handle != 0) { snd_stop(pl_snd_handle); } pl_snd_handle = snd_play(cancel_sel_snd,100,10); plSelectionPan.visible = off; mouse_mode = 0; } ///////////////////////////////////////// function showPlslPan() { plSelectionPan.pos_x = (screen_size.x - bmap_width(plSelectionPan.bmap)) / 2; plSelectionPan.pos_y = (screen_size.y - bmap_height(plSelectionPan.bmap)) / 2; plSelectionPan.visible = on; mouse_mode = 2; mouse_on(); } on_mouse_right = showPlslPan; /////////////////////////////////////////
|
|
|
Re: switch player question?
[Re: Claus_N]
#79924
07/02/06 22:06
07/02/06 22:06
|
Joined: Jun 2006
Posts: 32
lomeniki
OP
Newbie
|
OP
Newbie
Joined: Jun 2006
Posts: 32
|
Hi Claus,many stars for you and thank you man.Code works 100%:) I was thinking about another code ,prety similar(maybe?) to this one with some more advanced functions. If/When you have time do it please. It take me time to concept this, to be precise on what exactly i wont: we have 4 diferent entity(mdl`s) on screen -only when mouse over entity = enable right mouse click to call "atched" panel. (when rmb click anywhere else= just show mouse pointer) -when right mouse click over the entity(sound perhaps) = panell with 5 buttons apear(specific to that entity only) (it`ll be very convinient for panel to be near the entity (not infront) so we can see it) -button click function= replace that mdl with another one,at diferent position in the level(or the same position, we can edit position in the script) This (position) thing is very important. Include two sounds for each button (highlite and click) When buton clicked=meny pannel disapear (we can call panel when right click on the changed mdl only) note: each entity(on screen) have 5 mdl`s to switch when we make choice in panel. Mdl control: - each of that 5 mdl`s have 6 sequence of animation inside (idle,spin,bounce,open...). Idle animation start inmediatly when we switch to that mdl. Other sequence are "keyboard dependent" Need 6 keys on keyboard(q,w,e,a,s,d for example) to call & loop those sequences,only when specific model is on the screen. Metod: When nothing pressed= "idle" playing When press & hold button "q" = coresponded animation play & loop When button relesed = "idle" playing again When press "q + Shift" button(we do not need to hold it presed enymore)= "q" coresponded animation play & loop When "q" button is presed and relesed again = "idle" animation is playing again ------------------------------------------------------------------------------- Take your time  One more thanks.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|