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
3 registered members (NewbieZorro, TipmyPip, 1 invisible), 19,045 guests, and 8 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 1 of 5 1 2 3 4 5
switch player question? #79905
06/29/06 13:26
06/29/06 13:26
Joined: Jun 2006
Posts: 32
L
lomeniki Offline OP
Newbie
lomeniki  Offline OP
Newbie
L

Joined: Jun 2006
Posts: 32
Hi,
Is it posible to replace player with another one
(eg. player1.mdl with player2.mdl) in the same room?

I`d like(imagine) to switch player with:
right mouse click to produce some pannel with buttons(player names)
so i can choose on what player i want.( and reverse option ofcourse)

I am completly noob in scripting .
I need complete code with explanation where to put it and/or where to atach that.
That is (i think) the only code that i need for my small game.
Please help

Re: switch player question? [Re: lomeniki] #79906
06/29/06 14:03
06/29/06 14:03
Joined: May 2004
Posts: 1,510
Denmark
Claus_N Offline
Serious User
Claus_N  Offline
Serious User

Joined: May 2004
Posts: 1,510
Denmark
For switching the player model, you should use ent_morph. Check out the manual
Sorry, haven't got time for an example right now.. :/

Re: switch player question? [Re: Claus_N] #79907
06/29/06 15:35
06/29/06 15:35
Joined: Jun 2006
Posts: 32
L
lomeniki Offline OP
Newbie
lomeniki  Offline OP
Newbie
L

Joined: Jun 2006
Posts: 32
I read about ent_morph thing ,
but everything is messed up in my head(where,when,why???)
Someone else...please help,this is the only code i need (complete ofcourse).
For everything else i`ll use templates.Please,please help.

Re: switch player question? [Re: lomeniki] #79908
06/29/06 16:59
06/29/06 16:59
Joined: May 2004
Posts: 1,510
Denmark
Claus_N Offline
Serious User
Claus_N  Offline
Serious User

Joined: May 2004
Posts: 1,510
Denmark
I'm back

Try this code. (Not tested, but just post any errors)
Code:
/////////////////////////////////////////
// On mouse-over
bmap pl1_hover = <YOUR_BMAP>;
bmap pl2_hover = <YOUR_BMAP>;
bmap pl3_hover = <YOUR_BMAP>;
bmap pl4_hover = <YOUR_BMAP>;
// Normal
bmap pl1_normal = <YOUR_BMAP>;
bmap pl2_normal = <YOUR_BMAP>;
bmap pl3_normal = <YOUR_BMAP>;
bmap pl4_normal = <YOUR_BMAP>;
// Other bmaps
bmap cancel_but = <YOUR_BMAP>;
/////////////////////////////////////////
// Player models
string pl1_mdl = <MODEL>;
string pl2_mdl = <MODEL>;
string pl3_mdl = <MODEL>;
string pl4_mdl = <MODEL>;
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();
/////////////////////////////////////////
panel plSelectionPan
{
flags = refresh;
button = 20,20,pl1_hover,pl1_normal,pl1_hover,plSelect,null,null;
button = 20,50,pl2_hover,pl2_normal,pl2_hover,plSelect,null,null;
button = 20,80,pl3_hover,pl3_normal,pl3_hover,plSelect,null,null;
button = 20,110,pl4_hover,pl4_normal,pl4_hover,plSelect,null,null;
button = 20,140,pl4_hover,pl4_normal,pl4_hover,plSelect,null,null;
button = 20,170,cancel_but,cancel_but,cancel_but,plSelect_cancel,null,null;
}
/////////////////////////////////////////
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);

plSelectionPan.visible = off;
}
/////////////////////////////////////////
function plSelect_cancel()
{
plSelectionPan.visible = off;
}
/////////////////////////////////////////
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;
}

on_mouse_right = showPlslPan;
/////////////////////////////////////////



Save it as player_selection.wdl, and add this to the includes in your level's WDL (LEVELNAME.wdl) file:
include <player_selection.wdl>;

Re: switch player question? [Re: Claus_N] #79909
06/29/06 17:31
06/29/06 17:31
Joined: Jun 2006
Posts: 32
L
lomeniki Offline OP
Newbie
lomeniki  Offline OP
Newbie
L

Joined: Jun 2006
Posts: 32
Thank you very much.
I`ll try ,then i`ll post results

Re: switch player question? [Re: Claus_N] #79910
06/29/06 19:25
06/29/06 19:25
Joined: Jun 2006
Posts: 32
L
lomeniki Offline OP
Newbie
lomeniki  Offline OP
Newbie
L

Joined: Jun 2006
Posts: 32
...made buttons...placed them in level folder...include code...

Stuck in run level.I don`t no what is this error and what to do next:

Error E1515
Invalid arguments in showPlslPan: plSelectionPan.ps_x=(screen_size.x-bmap_width(plSelectionPan.bmap))/2
Next error is:
Crash in showPlslPan...

What to replace with what?

Re: switch player question? [Re: lomeniki] #79911
06/29/06 20:16
06/29/06 20:16
Joined: May 2004
Posts: 1,510
Denmark
Claus_N Offline
Serious User
Claus_N  Offline
Serious User

Joined: May 2004
Posts: 1,510
Denmark
Oh sry, forgot this one

Code:
bmap plSelectMap = <YOUR_BMAP>;

panel plSelectionPan
{
bmap = plSelectMap;
flags = refresh;
button = 20,20,pl1_hover,pl1_normal,pl1_hover,plSelect,null,null;
button = 20,50,pl2_hover,pl2_normal,pl2_hover,plSelect,null,null;
button = 20,80,pl3_hover,pl3_normal,pl3_hover,plSelect,null,null;
button = 20,110,pl4_hover,pl4_normal,pl4_hover,plSelect,null,null;
button = 20,140,pl4_hover,pl4_normal,pl4_hover,plSelect,null,null;
button = 20,170,cancel_but,cancel_but,cancel_but,plSelect_cancel,null,null;
}


That should fix it... But one thing I noticed in the error msg u wrote:
Quote:

Invalid arguments in showPlslPan: plSelectionPan.ps_x=(screen_size.x-bmap_width(plSelectionPan.bmap))/2



should've been pos_x, but that's right in the code I posted, so maybe u just forgot the 'o' when writing the error message.. ;P

Re: switch player question? [Re: Claus_N] #79912
06/29/06 21:06
06/29/06 21:06
Joined: Jun 2006
Posts: 32
L
lomeniki Offline OP
Newbie
lomeniki  Offline OP
Newbie
L

Joined: Jun 2006
Posts: 32
Thank you,
first, ps_x is my writing mistake,sorry.
When right mouse click i`ve got the background with buttons,super:)
But i lost mouse poiter so now i am unable to highlite or click on buttons.
I use A5_template_project in my test.wdl.
When "uninclude" player_selection.wdl line, in test.wdl ,
i get mouse pointer back.
What to do next?

Re: switch player question? [Re: lomeniki] #79913
06/29/06 21:36
06/29/06 21:36
Joined: May 2004
Posts: 1,510
Denmark
Claus_N Offline
Serious User
Claus_N  Offline
Serious User

Joined: May 2004
Posts: 1,510
Denmark
Try this

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;
}



Re: switch player question? [Re: Claus_N] #79914
06/29/06 21:46
06/29/06 21:46
Joined: Jun 2006
Posts: 32
L
lomeniki Offline OP
Newbie
lomeniki  Offline OP
Newbie
L

Joined: Jun 2006
Posts: 32
Do not work.
Same situation like before.

oops,not like before.
Before the player walk forward when i click rmb ,now nothing happens
& when i hit "esc" button to quit game, lost higlite so must count buttons
to hit the good one.

Last edited by lomeniki; 06/29/06 21:58.
Page 1 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