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,435 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
Page 3 of 5 1 2 3 4 5
Re: switch player question? [Re: lomeniki] #79925
07/02/06 22:20
07/02/06 22:20
Joined: May 2004
Posts: 1,510
Denmark
Claus_N Offline
Serious User
Claus_N  Offline
Serious User

Joined: May 2004
Posts: 1,510
Denmark
Np mate
It's getting quite late here.. I'll have a look at tomorrow

Re: switch player question? [Re: Claus_N] #79926
07/03/06 00:37
07/03/06 00:37
Joined: Jun 2006
Posts: 32
L
lomeniki Offline OP
Newbie
lomeniki  Offline OP
Newbie
L

Joined: Jun 2006
Posts: 32
When ever you like,it`s no rush
Cheers

Re: switch player question? [Re: lomeniki] #79927
07/05/06 15:26
07/05/06 15:26
Joined: May 2004
Posts: 1,510
Denmark
Claus_N Offline
Serious User
Claus_N  Offline
Serious User

Joined: May 2004
Posts: 1,510
Denmark
Hi again

The wireless connection I've used the last few days was very bad; and I couldn't get online at all yesterday :S
But well, now I'm at home again

I've made a script (tested with v6.31.4) that should do the most of what you want. I'll post it when I get from my laptop.
I think it'll need some changes to fit your needs, but then just tell what needs to get changed

Re: switch player question? [Re: Claus_N] #79928
07/05/06 21:17
07/05/06 21:17
Joined: May 2004
Posts: 1,510
Denmark
Claus_N Offline
Serious User
Claus_N  Offline
Serious User

Joined: May 2004
Posts: 1,510
Denmark
Okay, here ya go

(Sry for double-posting )

Click on an entity to "activate" it (the "active" ent will show another animation when you press "q"). Rightclick an ent to switch.
Code:
/////////////////////////////////////////
// Player Selection/Switching script
//
// (c) 2006 by Claus N.
// Nighthawk Arts
// www.nighthawk.dk
/////////////////////////////////////////
define anim_state,skill21;
define active,flag1;

// Define all your animation states below
define state_stand,0;
define state_walk,1;
define state_run,2;
define state_spin,3;
define state_bounce,4;
// Animation names
string anim_stand = "stand";
string anim_walk = "walk";
string anim_run = "run";
string anim_spin = "attack";
string anim_bounce = "bounce";
/////////////////////////////////////////
bmap selBG_map = <bg_pan.bmp>;
bmap but1_map = <but1.bmp>;
bmap but2_map = <but2.bmp>;
bmap but3_map = <but3.bmp>;
bmap but4_map = <but4.bmp>;
bmap but5_map = <but5.bmp>;
bmap butc_map = <cancel_but.bmp>;
bmap but1_over_map = <but1.bmp>;
bmap but2_over_map = <but2.bmp>;
bmap but3_over_map = <but3.bmp>;
bmap but4_over_map = <but4.bmp>;
bmap but5_over_map = <but5.bmp>;
bmap butc_over_map = <cancel_but.bmp>;
/////////////////////////////////////////
sound pl1_snd = <wham.wav>;
sound pl2_snd = <wham.wav>;
sound pl3_snd = <wham.wav>;
sound pl4_snd = <wham.wav>;
sound pl5_snd = <wham.wav>;
sound cancel_snd = <wham.wav>;
sound pl1_over_snd = <tap.wav>;
sound pl2_over_snd = <tap.wav>;
sound pl3_over_snd = <tap.wav>;
sound pl4_over_snd = <tap.wav>;
sound pl5_over_snd = <tap.wav>;
sound cancel_over_snd = <tap.wav>;
/////////////////////////////////////////
string pl1_mdl = <cbabe.mdl>;
string pl2_mdl = <woman.mdl>;
string pl3_mdl = <witch.mdl>;
string pl4_mdl = <elf.mdl>;
string pl5_mdl = <warlock.mdl>;
/////////////////////////////////////////
var_nsave snd_handle;
var actorHandle;
/////////////////////////////////////////
string level_str = <level.wmb>;
/////////////////////////////////////////
function butOver(but,pan);
function butClick(but,pan);
/////////////////////////////////////////
panel selectionPan
{
bmap = selBG_map;
flags = refresh;
button = 20,30,but1_map,but1_map,but1_over_map,butClick,null,butOver;
button = 20,60,but2_map,but2_map,but2_over_map,butClick,null,butOver;
button = 20,90,but3_map,but3_map,but3_over_map,butClick,null,butOver;
button = 20,120,but4_map,but4_map,but4_over_map,butClick,null,butOver;
button = 20,150,but5_map,but5_map,but5_over_map,butClick,null,butOver;
button = 20,180,butc_map,butc_map,butc_over_map,butClick,null,butOver;
}
/////////////////////////////////////////
function butOver(but,pan)
{
if(snd_handle != 0)
{
snd_stop(snd_handle);
}
if(but == 1) {snd_handle = snd_play(pl1_over_snd,100,10);}
if(but == 2) {snd_handle = snd_play(pl2_over_snd,100,10);}
if(but == 3) {snd_handle = snd_play(pl3_over_snd,100,10);}
if(but == 4) {snd_handle = snd_play(pl4_over_snd,100,10);}
if(but == 5) {snd_handle = snd_play(pl5_over_snd,100,10);}
if(but == 6) {snd_handle = snd_play(cancel_over_snd,100,10);}
}
/////////////////////////////////////////
function butClick(but,pan)
{
if(actorHandle == 0) {return;}
you = ptr_for_handle(actorHandle);
actorHandle = 0;
if(!you) {return;}

if(snd_handle != 0)
{
snd_stop(snd_handle);
}
if(but == 1) {snd_handle = snd_play(pl1_snd,100,10);ent_morph(you,pl1_mdl);}
if(but == 2) {snd_handle = snd_play(pl2_snd,100,10);ent_morph(you,pl2_mdl);}
if(but == 3) {snd_handle = snd_play(pl3_snd,100,10);ent_morph(you,pl3_mdl);}
if(but == 4) {snd_handle = snd_play(pl4_snd,100,10);ent_morph(you,pl4_mdl);}
if(but == 5) {snd_handle = snd_play(pl5_snd,100,10);ent_morph(you,pl5_mdl);}
if(but == 6) {snd_handle = snd_play(cancel_snd,100,10);}
selectionPan.visible = off;
}
/////////////////////////////////////////
// Call this function from "main()"!!
function init_mouse()
{
mouse_mode = 2;
mouse_on();
}
/////////////////////////////////////////
function selPan_Show(ent)
{
if(ent == 0) {return;}
you = ptr_for_handle(ent);
if(!you) {return;}

temp.x = you.x;
temp.y = you.y;
temp.z = you.z + you.min_z;

vec_to_screen(temp,camera);

selectionPan.pos_x = clamp(temp.x,0,screen_size.x - bmap_width(selectionPan.bmap));
selectionPan.pos_y = clamp(temp.y,0,screen_size.y - bmap_height(selectionPan.bmap));

actorHandle = ent;

selectionPan.visible = on;
}
/////////////////////////////////////////
function animateMe()
{
while(my)
{
if(my.anim_state == state_stand)
{
ent_animate(my,anim_stand,my.skill46,ANM_CYCLE);
my.skill46 += 2 * time;
}
if(my.anim_state == state_walk)
{
ent_animate(my,anim_walk,my.skill46,ANM_CYCLE);
my.skill46 += 6 * time;
}
if(my.anim_state == state_run)
{
ent_animate(my,anim_run,my.skill46,ANM_CYCLE);
my.skill46 += 10 * time;
}
if(my.anim_state == state_spin)
{
ent_animate(my,anim_spin,my.skill46,ANM_CYCLE);
my.skill46 += 8 * time;
}
if(my.anim_state == state_bounce)
{
ent_animate(my,anim_bounce,my.skill46,ANM_CYCLE);
my.skill46 += 8 * time;
}
my.skill46 %= 100;
wait(1);
}
}
/////////////////////////////////////////
function actorClicked
{
if(event_type == event_rightclick)
{
selPan_Show(handle(my));
}
if(event_type == event_click)
{
while(mouse_left) {wait(1);}
my.active = on;
while(!mouse_left) {wait(1);}
my.active = off;
}
}
/////////////////////////////////////////
action plActor
{
animateMe();
my.enable_click = on;
my.enable_rightclick = on;
my.event = actorClicked;
while(my)
{
if(my.active)
{
my.ambient = 100;
my.anim_state = state_stand;

if(key_q) {my.anim_state = state_spin;}
}
else
{
my.ambient = 0;
my.anim_state = state_stand;
}
wait(1);
}
}
/////////////////////////////////////////
on_mouse_right = init_mouse;
/////////////////////////////////////////



Re: switch player question? [Re: Claus_N] #79929
07/06/06 00:50
07/06/06 00:50
Joined: Jun 2006
Posts: 32
L
lomeniki Offline OP
Newbie
lomeniki  Offline OP
Newbie
L

Joined: Jun 2006
Posts: 32
Wow!It`s a looong one.Thanks:)
I`ll try to understand (test) this code & than i`ll post report(needs...)
Sory for no reply in short notice.I had power loss problem in whole building
where i live.
Code::)
---------------
if no electricity = no PC / no Internet
_____________________
Thank you one more time.

P.S. Is this code working with 3DGS v6.22 ?

Re: switch player question? [Re: lomeniki] #79930
07/06/06 10:40
07/06/06 10:40
Joined: May 2004
Posts: 1,510
Denmark
Claus_N Offline
Serious User
Claus_N  Offline
Serious User

Joined: May 2004
Posts: 1,510
Denmark
Np

Quote:

P.S. Is this code working with 3DGS v6.22



Dunno; only tried with v6.31.4. But I think it does

Re: switch player question? [Re: Claus_N] #79931
07/06/06 14:25
07/06/06 14:25
Joined: Jun 2006
Posts: 32
L
lomeniki Offline OP
Newbie
lomeniki  Offline OP
Newbie
L

Joined: Jun 2006
Posts: 32
Hi, Claus ,you are genie! Ewerything works perfect, thank you very,very much
I need just a little "tuning" of this code for my game,whenever you have time.

-Once clicked rmb,i can`t swich mouse off at anytime/anywhere
(i need that anywhere on screen exept entity ofcourse).
By default(a5_template) switch mouse off is by press rmb again.

-When i click rmb(on entity) pnel apear(that`s ok- i asked that).
Is it posible to switchoff muose pointer and panel also,
whereever i click(lmb) on screen, exept in panel area?

-I need 4 more diferent sounds when click on entity with:
1. right mouse button
2. left mouse

3. when press "q" key (only this time, when relese "q" sound stop)
4. when entity is in "idle" position loop some sound.

- I found some z-material code (i tested it & suits my needs).
Originally posted by Dan Silverman.I changed only few "name related" things.
Can you add this code for our models (each of them use this material)?

Code:
_________________________________________________
function mtl_xzmaterijal_init
{
vec_set(mtl.emissive_blue,mat_model.emissive_blue);
vec_set(mtl.ambient_blue,mat_model.ambient_blue);
vec_set(mtl.diffuse_blue,mat_model.diffuse_blue);
vec_set(mtl.specular_blue,mat_model.specular_blue);
mtl.power=mat_model.power;
mtl.albedo=mat_model.albedo;
mtl.skill1=pixel_for_vec(vector(0,0,0),0,8888);//first was 128
}

material mtl_xzmaterijal
{
event=mtl_xzmaterijal_init;
effect=
"
texture entSkin1;
dword mtlSkill1;

technique xzmaterijal
{
pass p0
{
Texture[0]=<entSkin1>;
ZWriteEnable=True;
AlphaBlendEnable=True;//was False
AlphaTestEnable=True;
AlphaRef=<mtlSkill1>;
AlphaFunc=Greater;
CullMode=CCW;

ColorArg1[0]=Texture;
ColorOp[0]=Modulate2X;
ColorArg2[0]=Diffuse;
}
}
technique fallback{pass p0{}}
";
}

action zmaterial
{
my.transparent=off;
my.flare=off;
my.material=mtl_mojzmaterijal;
}
____________________________________________________________________

Cheers

Re: switch player question? [Re: lomeniki] #79932
07/06/06 15:51
07/06/06 15:51
Joined: May 2004
Posts: 1,510
Denmark
Claus_N Offline
Serious User
Claus_N  Offline
Serious User

Joined: May 2004
Posts: 1,510
Denmark
Okay, try this

Code:____________________________________________________________________________________________
/////////////////////////////////////////
// Player Selection/Switching script
//
// (c) 2006 by Claus N.
// Nighthawk Arts
// www.nighthawk.dk
/////////////////////////////////////////
define anim_state,skill21;
define active,flag1;

// Define all your animation states below
define state_stand,0;
define state_walk,1;
define state_run,2;
define state_spin,3;
define state_bounce,4;
// Animation names
string anim_stand = "stand";
string anim_walk = "walk";
string anim_run = "run";
string anim_spin = "attack";
string anim_bounce = "bounce";
/////////////////////////////////////////
bmap selBG_map = <bg_pan.bmp>;
bmap but1_map = <but1.bmp>;
bmap but2_map = <but2.bmp>;
bmap but3_map = <but3.bmp>;
bmap but4_map = <but4.bmp>;
bmap but5_map = <but5.bmp>;
bmap butc_map = <cancel_but.bmp>;
bmap but1_over_map = <but1.bmp>;
bmap but2_over_map = <but2.bmp>;
bmap but3_over_map = <but3.bmp>;
bmap but4_over_map = <but4.bmp>;
bmap but5_over_map = <but5.bmp>;
bmap butc_over_map = <cancel_but.bmp>;
/////////////////////////////////////////
sound pl1_snd = <wham.wav>;
sound pl2_snd = <wham.wav>;
sound pl3_snd = <wham.wav>;
sound pl4_snd = <wham.wav>;
sound pl5_snd = <wham.wav>;
sound cancel_snd = <wham.wav>;
sound pl1_over_snd = <tap.wav>;
sound pl2_over_snd = <tap.wav>;
sound pl3_over_snd = <tap.wav>;
sound pl4_over_snd = <tap.wav>;
sound pl5_over_snd = <tap.wav>;
sound cancel_over_snd = <tap.wav>;
sound ent_rightclick = <tap.wav>;
sound ent_leftclick = <tap.wav>;
sound sound_on_q = <tap.wav>;
sound sound_on_idle = <wham.wav>;
/////////////////////////////////////////
string pl1_mdl = <cbabe.mdl>;
string pl2_mdl = <woman.mdl>;
string pl3_mdl = <witch.mdl>;
string pl4_mdl = <elf.mdl>;
string pl5_mdl = <warlock.mdl>;
/////////////////////////////////////////
var_nsave snd_handle;
var actorHandle;
/////////////////////////////////////////
string level_str = <level.wmb>;
/////////////////////////////////////////
function butOver(but,pan);
function butClick(but,pan);
/////////////////////////////////////////
panel selectionPan
{
bmap = selBG_map;
flags = refresh;
button = 20,30,but1_map,but1_map,but1_over_map,butClick,null,butOver;
button = 20,60,but2_map,but2_map,but2_over_map,butClick,null,butOver;
button = 20,90,but3_map,but3_map,but3_over_map,butClick,null,butOver;
button = 20,120,but4_map,but4_map,but4_over_map,butClick,null,butOver;
button = 20,150,but5_map,but5_map,but5_over_map,butClick,null,butOver;
button = 20,180,butc_map,butc_map,butc_over_map,butClick,null,butOver;
}
/////////////////////////////////////////
function butOver(but,pan)
{
if(snd_handle != 0)
{
snd_stop(snd_handle);
}
if(but == 1) {snd_handle = snd_play(pl1_over_snd,100,10);}
if(but == 2) {snd_handle = snd_play(pl2_over_snd,100,10);}
if(but == 3) {snd_handle = snd_play(pl3_over_snd,100,10);}
if(but == 4) {snd_handle = snd_play(pl4_over_snd,100,10);}
if(but == 5) {snd_handle = snd_play(pl5_over_snd,100,10);}
if(but == 6) {snd_handle = snd_play(cancel_over_snd,100,10);}
}
/////////////////////////////////////////
function butClick(but,pan)
{
if(actorHandle == 0) {return;}
you = ptr_for_handle(actorHandle);
actorHandle = 0;
if(!you) {return;}

if(snd_handle != 0)
{
snd_stop(snd_handle);
}
if(but == 1) {snd_handle = snd_play(pl1_snd,100,10);ent_morph(you,pl1_mdl);}
if(but == 2) {snd_handle = snd_play(pl2_snd,100,10);ent_morph(you,pl2_mdl);}
if(but == 3) {snd_handle = snd_play(pl3_snd,100,10);ent_morph(you,pl3_mdl);}
if(but == 4) {snd_handle = snd_play(pl4_snd,100,10);ent_morph(you,pl4_mdl);}
if(but == 5) {snd_handle = snd_play(pl5_snd,100,10);ent_morph(you,pl5_mdl);}
if(but == 6) {snd_handle = snd_play(cancel_snd,100,10);}
selectionPan.visible = off;
}
/////////////////////////////////////////
// Call this function from "main()"!!
function init_mouse()
{
mouse_mode = 2;
mouse_on();
}
/////////////////////////////////////////
function selPan_Show(ent)
{
if(ent == 0) {return;}
you = ptr_for_handle(ent);
if(!you) {return;}

temp.x = you.x;
temp.y = you.y;
temp.z = you.z + you.min_z;

vec_to_screen(temp,camera);

selectionPan.pos_x = clamp(temp.x,0,screen_size.x - bmap_width(selectionPan.bmap));
selectionPan.pos_y = clamp(temp.y,0,screen_size.y - bmap_height(selectionPan.bmap));

actorHandle = ent;

selectionPan.visible = on;
}
/////////////////////////////////////////
function animateMe()
{
while(my)
{
if(my.anim_state == state_stand)
{
ent_animate(my,anim_stand,my.skill46,ANM_CYCLE);
my.skill46 += 2 * time;
}
if(my.anim_state == state_walk)
{
ent_animate(my,anim_walk,my.skill46,ANM_CYCLE);
my.skill46 += 6 * time;
}
if(my.anim_state == state_run)
{
ent_animate(my,anim_run,my.skill46,ANM_CYCLE);
my.skill46 += 10 * time;
}
if(my.anim_state == state_spin)
{
ent_animate(my,anim_spin,my.skill46,ANM_CYCLE);
my.skill46 += 8 * time;
}
if(my.anim_state == state_bounce)
{
ent_animate(my,anim_bounce,my.skill46,ANM_CYCLE);
my.skill46 += 8 * time;
}
my.skill46 %= 100;
wait(1);
}
}
/////////////////////////////////////////
function actorClicked
{
if(snd_handle != 0)
{
snd_stop(snd_handle);
}

if(event_type == event_rightclick)
{
snd_handle = snd_play(ent_rightclick,100,10);
selPan_Show(handle(my));
}
if(event_type == event_click)
{
snd_handle = snd_play(ent_leftclick,100,10);
while(mouse_left) {wait(1);}
my.active = on;
while(!mouse_left) {wait(1);}
my.active = off;
}
}
/////////////////////////////////////////
function mtl_xzmaterijal_init
{
vec_set(mtl.emissive_blue,mat_model.emissive_blue);
vec_set(mtl.ambient_blue,mat_model.ambient_blue);
vec_set(mtl.diffuse_blue,mat_model.diffuse_blue);
vec_set(mtl.specular_blue,mat_model.specular_blue);
mtl.power=mat_model.power;
mtl.albedo=mat_model.albedo;
mtl.skill1=pixel_for_vec(vector(0,0,0),0,8888);//first was 128
}

material mtl_xzmaterijal
{
event=mtl_xzmaterijal_init;
effect=
"
texture entSkin1;
dword mtlSkill1;

technique xzmaterijal
{
pass p0
{
Texture[0]=<entSkin1>;
ZWriteEnable=True;
AlphaBlendEnable=True;//was False
AlphaTestEnable=True;
AlphaRef=<mtlSkill1>;
AlphaFunc=Greater;
CullMode=CCW;

ColorArg1[0]=Texture;
ColorOp[0]=Modulate2X;
ColorArg2[0]=Diffuse;
}
}
technique fallback{pass p0{}}
";
}
/////////////////////////////////////////
action plActor
{
my.material=mtl_xzmaterijal;
animateMe();
my.enable_click = on;
my.enable_rightclick = on;
my.event = actorClicked;
while(my)
{
if(my.active)
{
my.ambient = 100;
my.anim_state = state_stand;

if(key_q)
{
my.anim_state = state_spin;
snd_stop(my.skill22);
if(!snd_playing(my.skill32))
{
my.skill32 = snd_loop(sound_on_q,100,10);
}
}
else
{
snd_stop(my.skill32);
if(!snd_playing(my.skill22))
{
my.skill22 = snd_loop(sound_on_idle,100,10);
}
}
}
else
{
snd_stop(my.skill22);
snd_stop(my.skill32);
my.ambient = 0;
my.anim_state = state_stand;
}
wait(1);
}
}
/////////////////////////////////////////
//on_mouse_right = init_mouse;
/////////////////////////////////////////
_________________________________________________________________________________________________

Quote:

-When i click rmb(on entity) pnel apear(that`s ok- i asked that).
Is it posible to switchoff muose pointer and panel also,
whereever i click(lmb) on screen, exept in panel area?



Eh, didn't get that...

Re: switch player question? [Re: Claus_N] #79933
07/06/06 18:06
07/06/06 18:06
Joined: Jun 2006
Posts: 32
L
lomeniki Offline OP
Newbie
lomeniki  Offline OP
Newbie
L

Joined: Jun 2006
Posts: 32
Sorry, my English eh....hm...

Like:
rmb on entity to change it> panel apear on screen,
i i click on panel buttons to change entity(ok we allready have that in your code)
But, when ((panel is on screen)) i (exidently or on purpose)click enywhere
else in the screen (not on panel),i would like for pannel and mouse pointer to disapear "automaticly"

Re: switch player question? [Re: lomeniki] #79934
07/06/06 19:44
07/06/06 19:44
Joined: May 2004
Posts: 1,510
Denmark
Claus_N Offline
Serious User
Claus_N  Offline
Serious User

Joined: May 2004
Posts: 1,510
Denmark
Okay, here ya go

Code:
/////////////////////////////////////////
// Player Selection/Switching script
//
// (c) 2006 by Claus N.
// Nighthawk Arts
// www.nighthawk.dk
/////////////////////////////////////////
define anim_state,skill21;
define active,flag1;

// Define all your animation states below
define state_stand,0;
define state_walk,1;
define state_run,2;
define state_spin,3;
define state_bounce,4;
// Animation names
string anim_stand = "stand";
string anim_walk = "walk";
string anim_run = "run";
string anim_spin = "attack";
string anim_bounce = "bounce";
/////////////////////////////////////////
bmap selBG_map = <bg_pan.bmp>;
bmap but1_map = <but1.bmp>;
bmap but2_map = <but2.bmp>;
bmap but3_map = <but3.bmp>;
bmap but4_map = <but4.bmp>;
bmap but5_map = <but5.bmp>;
bmap butc_map = <cancel_but.bmp>;
bmap but1_over_map = <but1.bmp>;
bmap but2_over_map = <but2.bmp>;
bmap but3_over_map = <but3.bmp>;
bmap but4_over_map = <but4.bmp>;
bmap but5_over_map = <but5.bmp>;
bmap butc_over_map = <cancel_but.bmp>;
/////////////////////////////////////////
sound pl1_snd = <wham.wav>;
sound pl2_snd = <wham.wav>;
sound pl3_snd = <wham.wav>;
sound pl4_snd = <wham.wav>;
sound pl5_snd = <wham.wav>;
sound cancel_snd = <wham.wav>;
sound pl1_over_snd = <tap.wav>;
sound pl2_over_snd = <tap.wav>;
sound pl3_over_snd = <tap.wav>;
sound pl4_over_snd = <tap.wav>;
sound pl5_over_snd = <tap.wav>;
sound cancel_over_snd = <tap.wav>;
sound ent_rightclick = <tap.wav>;
sound ent_leftclick = <tap.wav>;
sound sound_on_q = <tap.wav>;
sound sound_on_idle = <wham.wav>;
/////////////////////////////////////////
string pl1_mdl = <cbabe.mdl>;
string pl2_mdl = <woman.mdl>;
string pl3_mdl = <witch.mdl>;
string pl4_mdl = <elf.mdl>;
string pl5_mdl = <warlock.mdl>;
/////////////////////////////////////////
var_nsave snd_handle;
var actorHandle;
/////////////////////////////////////////
string level_str = <level.wmb>;
/////////////////////////////////////////
function butOver(but,pan);
function butClick(but,pan);
/////////////////////////////////////////
panel selectionPan
{
bmap = selBG_map;
flags = refresh;
button = 20,30,but1_map,but1_map,but1_over_map,butClick,null,butOver;
button = 20,60,but2_map,but2_map,but2_over_map,butClick,null,butOver;
button = 20,90,but3_map,but3_map,but3_over_map,butClick,null,butOver;
button = 20,120,but4_map,but4_map,but4_over_map,butClick,null,butOver;
button = 20,150,but5_map,but5_map,but5_over_map,butClick,null,butOver;
button = 20,180,butc_map,butc_map,butc_over_map,butClick,null,butOver;
}
/////////////////////////////////////////
function butOver(but,pan)
{
if(snd_handle != 0)
{
snd_stop(snd_handle);
}
if(but == 1) {snd_handle = snd_play(pl1_over_snd,100,10);}
if(but == 2) {snd_handle = snd_play(pl2_over_snd,100,10);}
if(but == 3) {snd_handle = snd_play(pl3_over_snd,100,10);}
if(but == 4) {snd_handle = snd_play(pl4_over_snd,100,10);}
if(but == 5) {snd_handle = snd_play(pl5_over_snd,100,10);}
if(but == 6) {snd_handle = snd_play(cancel_over_snd,100,10);}
}
/////////////////////////////////////////
function butClick(but,pan)
{
if(actorHandle == 0) {return;}
you = ptr_for_handle(actorHandle);
actorHandle = 0;
if(!you) {return;}

if(snd_handle != 0)
{
snd_stop(snd_handle);
}
if(but == 1) {snd_handle = snd_play(pl1_snd,100,10);ent_morph(you,pl1_mdl);}
if(but == 2) {snd_handle = snd_play(pl2_snd,100,10);ent_morph(you,pl2_mdl);}
if(but == 3) {snd_handle = snd_play(pl3_snd,100,10);ent_morph(you,pl3_mdl);}
if(but == 4) {snd_handle = snd_play(pl4_snd,100,10);ent_morph(you,pl4_mdl);}
if(but == 5) {snd_handle = snd_play(pl5_snd,100,10);ent_morph(you,pl5_mdl);}
if(but == 6) {snd_handle = snd_play(cancel_snd,100,10);}
selectionPan.visible = off;
}
/////////////////////////////////////////

function init_mouse()
{
if((mouse_pos.x < selectionPan.pos_x
|| mouse_pos.x > selectionPan.pos_x + bmap_width(selectionPan.bmap))
|| (mouse_pos.y < selectionPan.pos_y
|| mouse_pos.y > selectionPan.pos_y + bmap_height(selectionPan.bmap)))
{
selectionPan.visible = off;
}
mouse_toggle();
}

/////////////////////////////////////////
function selPan_Show(ent)
{
if(ent == 0) {return;}
you = ptr_for_handle(ent);
if(!you) {return;}

temp.x = you.x;
temp.y = you.y;
temp.z = you.z + you.min_z;

vec_to_screen(temp,camera);

selectionPan.pos_x = clamp(temp.x,0,screen_size.x - bmap_width(selectionPan.bmap));
selectionPan.pos_y = clamp(temp.y,0,screen_size.y - bmap_height(selectionPan.bmap));

actorHandle = ent;

selectionPan.visible = on;
}
/////////////////////////////////////////
function animateMe()
{
while(my)
{
if(my.anim_state == state_stand)
{
ent_animate(my,anim_stand,my.skill46,ANM_CYCLE);
my.skill46 += 2 * time;
}
if(my.anim_state == state_walk)
{
ent_animate(my,anim_walk,my.skill46,ANM_CYCLE);
my.skill46 += 6 * time;
}
if(my.anim_state == state_run)
{
ent_animate(my,anim_run,my.skill46,ANM_CYCLE);
my.skill46 += 10 * time;
}
if(my.anim_state == state_spin)
{
ent_animate(my,anim_spin,my.skill46,ANM_CYCLE);
my.skill46 += 8 * time;
}
if(my.anim_state == state_bounce)
{
ent_animate(my,anim_bounce,my.skill46,ANM_CYCLE);
my.skill46 += 8 * time;
}
my.skill46 %= 100;
wait(1);
}
}
/////////////////////////////////////////
function actorClicked
{
if(snd_handle != 0)
{
snd_stop(snd_handle);
}

if(event_type == event_rightclick)
{
snd_handle = snd_play(ent_rightclick,100,10);
selPan_Show(handle(my));
}
if(event_type == event_click)
{
snd_handle = snd_play(ent_leftclick,100,10);
while(mouse_left) {wait(1);}
my.active = on;
while(!mouse_left) {wait(1);}
my.active = off;
}
}
/////////////////////////////////////////
function mtl_xzmaterijal_init
{
vec_set(mtl.emissive_blue,mat_model.emissive_blue);
vec_set(mtl.ambient_blue,mat_model.ambient_blue);
vec_set(mtl.diffuse_blue,mat_model.diffuse_blue);
vec_set(mtl.specular_blue,mat_model.specular_blue);
mtl.power=mat_model.power;
mtl.albedo=mat_model.albedo;
mtl.skill1=pixel_for_vec(vector(0,0,0),0,8888);//first was 128
}

material mtl_xzmaterijal
{
event=mtl_xzmaterijal_init;
effect=
"
texture entSkin1;
dword mtlSkill1;

technique xzmaterijal
{
pass p0
{
Texture[0]=<entSkin1>;
ZWriteEnable=True;
AlphaBlendEnable=True;//was False
AlphaTestEnable=True;
AlphaRef=<mtlSkill1>;
AlphaFunc=Greater;
CullMode=CCW;

ColorArg1[0]=Texture;
ColorOp[0]=Modulate2X;
ColorArg2[0]=Diffuse;
}
}
technique fallback{pass p0{}}
";
}
/////////////////////////////////////////
action plActor
{
my.material=mtl_xzmaterijal;
animateMe();
my.enable_click = on;
my.enable_rightclick = on;
my.event = actorClicked;
while(my)
{
if(my.active)
{
my.ambient = 100;
my.anim_state = state_stand;

if(key_q)
{
my.anim_state = state_spin;
snd_stop(my.skill22);
if(!snd_playing(my.skill32))
{
my.skill32 = snd_loop(sound_on_q,100,10);
}
}
else
{
snd_stop(my.skill32);
if(!snd_playing(my.skill22))
{
my.skill22 = snd_loop(sound_on_idle,100,10);
}
}
}
else
{
snd_stop(my.skill22);
snd_stop(my.skill32);
my.ambient = 0;
my.anim_state = state_stand;
}
wait(1);
}
}
/////////////////////////////////////////
on_mouse_right = init_mouse;
/////////////////////////////////////////



Page 3 of 5 1 2 3 4 5

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