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 (AndrewAMD, Ayumi, NewbieZorro), 13,972 guests, and 6 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 2 1 2
adding information to a non moving character?? #68439
03/28/06 11:09
03/28/06 11:09
Joined: Mar 2006
Posts: 43
J
jamesk85 Offline OP
Newbie
jamesk85  Offline OP
Newbie
J

Joined: Mar 2006
Posts: 43
Hey,
I was just wondering can anybody tell me how to add information to a non moving character model. I just need the information, in text and picture format, to pop up on a screen when the avatar gets close to the model.
Does anyone know where I could get a tutorial that explains this or even explain how to write the code?? I'm really stuck so any help would be appreciated..

Re: adding information to a non moving character?? [Re: jamesk85] #68440
03/28/06 11:29
03/28/06 11:29
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
ulillillia Offline
Senior Expert
ulillillia  Offline
Senior Expert

Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
Not likely the best way, but you could probably do something like this:

Code:

while (1)
{
if (vec_dist(nonmovingentity.x, player.x) > limit)
{
wait(1); // if non-moving entity is further than limit quants from player, wait
}

else
{
// stuff here for displaying text about the nonmovingentity entity
}
}



The "limit" variable is how close you can be at the most to activating the condition.


"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip My 2D game - release on Jun 13th; My tutorials
Re: adding information to a non moving character?? [Re: ulillillia] #68441
03/28/06 12:28
03/28/06 12:28
Joined: Mar 2006
Posts: 43
J
jamesk85 Offline OP
Newbie
jamesk85  Offline OP
Newbie
J

Joined: Mar 2006
Posts: 43
thanks for the reply.
but where do I enter in that code. into what script and how then do I attach it to the character??

Re: adding information to a non moving character?? [Re: jamesk85] #68442
03/28/06 12:51
03/28/06 12:51
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
ulillillia Offline
Senior Expert
ulillillia  Offline
Senior Expert

Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
You have a few options:

1. Have it as a function and call it every frame as part of your core components.
2. Have it in your entity's actions.
3. If common, have it as a separate function and call it every frame.

You do need to assign the pointers as necessary. Player assumes the player character. It could also be the camera, especially in first-view perspective. nonmovingentity refers to the entity that doesn't move. If within the entity's action (for the nonmoving entity), you could have "my.x" instead of the longer name. The longer name is used when the first option is chosen (which is the best option as you can have my.dynamic = off; for the entity to speed up the frame rate.


"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip My 2D game - release on Jun 13th; My tutorials
Re: adding information to a non moving character?? [Re: ulillillia] #68443
03/29/06 10:24
03/29/06 10:24
Joined: Mar 2006
Posts: 43
J
jamesk85 Offline OP
Newbie
jamesk85  Offline OP
Newbie
J

Joined: Mar 2006
Posts: 43
Hey ulillillia,
from your message above "else { // stuff here for displaying text about the nonmovingentity entity }}"
what would you put in her just to display text in a box like a scroll box would be great as well as having pictures in that box??

Re: adding information to a non moving character?? [Re: jamesk85] #68444
03/29/06 11:12
03/29/06 11:12
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
ulillillia Offline
Senior Expert
ulillillia  Offline
Senior Expert

Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
I left this out as it takes more to do so. You need a text object and a panel. For the scrolling thing, that I don't know how to do exactly. You could probably use a window in a panel for this. I've never done it before, but I happen to have quite a few tricks available. The text object would look something like this:

Code:

text textname
{
pos_x = 4; // X position from left side of screen
pos_y = 10; // Y position from top of screen
layer = 15; // things with higher layers will be drawn on top of this
string = "Type whatever text you want here.\nNew line \"quotes\";
flags = visible; // make it visible
}



A panel object would look something like this (and I work with hundreds of them - my 2D game using nothing but panels (and sometimes a few text objects)):

Code:

panel panelname
{
pos_x = 12; // same as the text object
pos_y = 38;
layer = 18;
bmap = mypicture; // the string for your bmap file to use, a picture file*
scale_x = 1; // X scale (like texture scales in WED)
scale_y = 1; // Y scale
flags = visible; // make it visible
}



* Must be BMP, PCX, or TGA, possibly DDS. I prefer TGA as you get true color and it just looks better.

Not all elements in a definition are required. Only layers cannot be dynamically altered (then again, the manual is full of mistakes with limitations - it doesn't hurt to test it), but all (other) elements can.

How precisely you alter the descriptions is up to you. Look up "window" for panels in the manual. There seems to be a sufficient chance the limits are not correctly stated in the manual as I've broken many of them without any problems.


"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip My 2D game - release on Jun 13th; My tutorials
Re: adding information to a non moving character?? [Re: ulillillia] #68445
03/29/06 12:40
03/29/06 12:40
Joined: Mar 2006
Posts: 43
J
jamesk85 Offline OP
Newbie
jamesk85  Offline OP
Newbie
J

Joined: Mar 2006
Posts: 43
Thats brilliant thanks a million,
one question with doing all this as an action which I could then attach to each individual character!

would I do the following:
action display_info1
{

}

do I put this just under the main function in the game1.wdl script which is my main script??

Re: adding information to a non moving character?? [Re: jamesk85] #68446
03/29/06 12:46
03/29/06 12:46
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
ulillillia Offline
Senior Expert
ulillillia  Offline
Senior Expert

Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
Actions are another function, but with a slight special functionality (for choosing in WED). You only need one text object, unless special formatting is used such as to change the font color or font size within the paragraph. You can place the action anywhere, so long as it's not within any definition or some other function (leftmost indentation).


"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip My 2D game - release on Jun 13th; My tutorials
Re: adding information to a non moving character?? [Re: ulillillia] #68447
03/29/06 13:54
03/29/06 13:54
Joined: Mar 2006
Posts: 43
J
jamesk85 Offline OP
Newbie
jamesk85  Offline OP
Newbie
J

Joined: Mar 2006
Posts: 43
from above:
while (1){
if (vec_dist(nonmovingentity.x, player.x) > limit)
{
wait(1); // if non-moving entity is further than limit quants from player, wait }
else
{ // stuff here for displaying text about the nonmovingentity entity }}

what do I replace nonmovingentity.x with. I know its the character that isnt moving but how do I reference that character. Player is the current player but I dont know what the character is??

Re: adding information to a non moving character?? [Re: jamesk85] #68448
03/29/06 13:57
03/29/06 13:57
Joined: Mar 2006
Posts: 43
J
jamesk85 Offline OP
Newbie
jamesk85  Offline OP
Newbie
J

Joined: Mar 2006
Posts: 43
what I have put into my code now is as follows:
action displayinfo1_player
{
while(1)
{
if(vec_dist(nonmovingentity.x, player.x) > 20)
{
wait(1)
}
else
{
text info1
{
pos_x = 4;
pos_y = 10;
layer = 15;
string = "I will enter my info here.";
flags = visible;
}
}
}
}
but it comes up that the nonmovingentity isn't a defined parameter. and it also says keyword unknown for text...thats text info1 in the code above
sorry bout all this!

Page 1 of 2 1 2

Moderated by  HeelX, rvL_eXile 

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