Objectives
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Objectives
My game's demo is nearly finnished! I just want to make some things before I release it (the menu is not ready yet).
I'm not really sure where to post this,because..I think it will need scripting,level editing and painting both.You remember when playing halo and when you had an objective? Something like a corona appeared on your screen,and it pointed to a destination,and the player could see it through the walls! That would look really cool in my game,I really wanna make something like that,because it will help the player a lot sometimes. Is it possible to do it and how if yes?
i couldn't find pictures of it,so I hope you remember what I'm talking about.
I'm not really sure where to post this,because..I think it will need scripting,level editing and painting both.You remember when playing halo and when you had an objective? Something like a corona appeared on your screen,and it pointed to a destination,and the player could see it through the walls! That would look really cool in my game,I really wanna make something like that,because it will help the player a lot sometimes. Is it possible to do it and how if yes?
i couldn't find pictures of it,so I hope you remember what I'm talking about.
Re: Objectives
Yes! It is possible!
Just make the place where the corona should be shown an invisible pawn and then get its Screen coordinates with
GetEntityScreenX(char *szEntityName );
GetEntityScreenY(char *szEntityName );
And draw a flipbook image showing a corona at that point!
You could even make the pawn own the script to show the corona. Then you can add it in any level you want it.
Just make the place where the corona should be shown an invisible pawn and then get its Screen coordinates with
GetEntityScreenX(char *szEntityName );
GetEntityScreenY(char *szEntityName );
And draw a flipbook image showing a corona at that point!
You could even make the pawn own the script to show the corona. Then you can add it in any level you want it.
Everyone can see the difficult, but only the wise can see the simple.
-----
-----
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Objectives
OK,so I started working on the code,but I just can't handle it myself yet .If this what I did is correct,when the player activates the trigger with szentity name "objective1",the "objective" flipbook should appear on the screen..and I'm not sure that it will work (haven't tested it).I couldn't understand whant is that int ImageIndex thing in the DrawFlipbookImage command from reading the manual.And how do I use theese in the script?
And also..how can I remove the objective image once I get to the place?I'll put another trigger at the objective point and name it for example: "end_objective1".Than in the script I'll make this:
and after that I don't know what...somehow I'll have to remove the flipbook from the screen,I searched for commands in the manual (searched for "RemoveFlipBookImage" etc.) ,but with no luck.
I'm sure I have mistakes in the script,but this is oe of my first attempts of making something scripted and as always,I started the script,but I can't finnish it so I need a little help,please
Code: Select all
GetEntityScreenX(char *szEntityName );
GetEntityScreenY(char *szEntityName );
Code: Select all
if(GetEventState("end_objective1");
I'm sure I have mistakes in the script,but this is oe of my first attempts of making something scripted and as always,I started the script,but I can't finnish it so I need a little help,please
Code: Select all
Spawn[ ()
{
Console(true);
PawnRender(false);
LowLevel(execute);
}
execute[ ()
{
if(GetEventState("objective1");
{
PlaySound("youhavenewobjective.wav");
DrawFlipbookImage(objective, int ImageIndex, 0, 0, 200, 255, 255, 255, 0 );
...................
Re: Objectives
When you have a flipbook called 'objectives' (which can hold all objective pictures you can have) then you can draw any picture from this flipbook at any point on the screen anytime you like.
It doesn't matter where in space the flipbook entity is, because the DrawFlipBookImage method just looks at the flipbook as a collection of images, it only sees the raw files, objectives0.bmp, objectives1.bmp... The number after the 'main word' it gets from the variable 'int ImageIndex'. So
DrawFlipbookImage("objective", X, 0, 0, 200, 255, 255, 255, 0 );
would draw the image number X from the "objective" FlipBook entity.
It also only renders them one time, in the current frame. You can't switch it 'on' and 'off'. You either render it or not.
The GetEntityScreenX and GetEntityScreenY are needed because you have to somehow get where the 'objective pawn' is and then draw the picture there (remember that the place of the flipbook entity does not make any difference?) Then for example you would write:
And when you are finished you set the state of the objective to false.
SetEventState("objective1",false);
One thing with the GetEntityScreen commands is that they seem to have problems recognizing if the entity you ask for is on screen or 'behind' it.
It doesn't matter where in space the flipbook entity is, because the DrawFlipBookImage method just looks at the flipbook as a collection of images, it only sees the raw files, objectives0.bmp, objectives1.bmp... The number after the 'main word' it gets from the variable 'int ImageIndex'. So
DrawFlipbookImage("objective", X, 0, 0, 200, 255, 255, 255, 0 );
would draw the image number X from the "objective" FlipBook entity.
It also only renders them one time, in the current frame. You can't switch it 'on' and 'off'. You either render it or not.
The GetEntityScreenX and GetEntityScreenY are needed because you have to somehow get where the 'objective pawn' is and then draw the picture there (remember that the place of the flipbook entity does not make any difference?) Then for example you would write:
Code: Select all
if(GetEventState("objective1")=true)
{
SCREENX=GetEntityScreenX("ObjectivePawn");
SCREENY=GetEntityScreenY("ObjectivePawn");
FLIPBOOKNUMBER=0;
DrawFlipbookImage("objective", FLIPBOOKNUMBER, SCREENX, SCREENY, 200, 255, 255, 255, 0 );
}
SetEventState("objective1",false);
One thing with the GetEntityScreen commands is that they seem to have problems recognizing if the entity you ask for is on screen or 'behind' it.
Everyone can see the difficult, but only the wise can see the simple.
-----
-----
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Objectives
Thanks for the help Jay,but I still seem to have some difficulties.
I made a simple level,and I put there a pawn named "ObjectivePawn",a flipbook named "objective" and a trigger named "objective1". Of course I didn't forget to set the script in the pawn entity. When I ran the level,nothing was changed,I touched the trigger model,but the flipbook did't appear.I don't know what am I missing,I asked the script to show me the console ( Console(true); ),but the console didn't appear.
that's the script,am I missing something?
I made a simple level,and I put there a pawn named "ObjectivePawn",a flipbook named "objective" and a trigger named "objective1". Of course I didn't forget to set the script in the pawn entity. When I ran the level,nothing was changed,I touched the trigger model,but the flipbook did't appear.I don't know what am I missing,I asked the script to show me the console ( Console(true); ),but the console didn't appear.
Code: Select all
Spawn[ ()
{
Console(true);
LowLevel(execute);
} ]
execute[ ()
if(GetEventState("objective1")=true)
{
SCREENX=GetEntityScreenX("ObjectivePawn");
SCREENY=GetEntityScreenY("ObjectivePawn");
FLIPBOOKNUMBER=0;
DrawFlipbookImage("objective", FLIPBOOKNUMBER, SCREENX, SCREENY, 200, 255, 255, 255, 0 );
}
} ]
}
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Objectives
oh,I've missed to copy this in my previous post.So the script has no mistakes,right? because there's no effect when I start the level.I forgot to mention also that sometimes the level even crashes before it has loaded.
Re: Objectives
Code: Select all
LowLevel(execute);
Code: Select all
LowLevel("execute");
Code: Select all
SCREENX [0]
SCREENY [0]
FLIPBOOKNUMBER [0]
Last edited by Juutis on Sun Oct 05, 2008 2:26 pm, edited 1 time in total.
Pain is only psychological.
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Objectives
OK,so now it's :
And the pawn isn't rendered and there's no effect again.Sorry,it's really annoying that you and Jay are trying to help me and I still can't do it.If I have to,I'll make an archive with the level,the script and the flipbook images and upload it.{
SCREENX [0];
SCREENY [0];
FLIPBOOKNUMBER [0];
Spawn[ ()
{
Console(true);
LowLevel("execute");
} ]
execute[ ()
if(GetEventState("objective1")=true)
{
GetEntityScreenX("ObjectivePawn");
GetEntityScreenY("ObjectivePawn");
DrawFlipbookImage("objective", FLIPBOOKNUMBER, SCREENX, SCREENY, 200, 255, 255, 255, 0 );
}
} ]
}
Re: Objectives
Alright...
You mustn't put ; after variable declarations.
Something I didn't notice earlier. You don't have a opening bracket { in the execute order. Every low level order should also have the 'ThinkTime = ... ' line.
Here's a fixed version:
I tested that and it worked. If you still have problems then it's probably your FlipBook or Pawn entities.
Code: Select all
SCREENX [0];
SCREENY [0];
FLIPBOOKNUMBER [0];
Something I didn't notice earlier. You don't have a opening bracket { in the execute order. Every low level order should also have the 'ThinkTime = ... ' line.
Here's a fixed version:
Code: Select all
{
SCREENX [0]
SCREENY [0]
FLIPBOOKNUMBER [0]
Spawn[ ()
{
Console(true);
LowLevel("execute");
} ]
execute[ ()
{
ThinkTime = 0;
if(GetEventState("objective1"))
{
SCREENX=GetEntityScreenX("ObjectivePawn");
SCREENY=GetEntityScreenY("ObjectivePawn");
FLIPBOOKNUMBER=0;
DrawFlipBookImage("objective",FLIPBOOKNUMBER,SCREENX,SCREENY,200,255,255,255,1);
}
} ]
}
Pain is only psychological.
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Objectives
Thanks,I'm still getting use to Simkin,the web languages I was dealing before seem much more easy to me,but Simkin is much more interesting. And about the variables,it' because I copied it and didn't notice it after that ,ok I'll use the fixed version..actually I'll fix the mistakes myself,because that helps me to get used to simkin!
Re: Objectives
Oh ya. That was my bad.And about the variables,it' because I copied it and didn't notice it after that
Pain is only psychological.
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Objectives
OK,it works! Now I got another question: Is it possible to display in the filpbook image the distance that remains till the player collides with the pawn that's holding the script?
Re: Objectives
Yap, should be possible with these commands:
float DistanceBetweenEntities(string FromEntityName, string ToEntityName);
float DistanceBetweenEntities(string FromEntityName, string ToEntityName, bool IgnoreY);
Returns the distance between 2 entities (Pawn, StaticEntityProxy, Attribute, Player). If the flag IgnoreY is present and true the Y-distance will be ignored. For the player use "Player" as one of the entity names.
ShowText(int Text#, string EntityName, string Animation, string Text, int Font#, string Sound, int ScreenX, int ScreenY, string Align, float Alpha);
Draws a text string attached to an entity (Pawn, Attribute, StaticEntityproxy) or the player. If the entity is moving, the string will keep the relative position towards the entity.
Text# is a number between 0 and 19 that is used to distinguish between different ShowText commands within one Order.
EntityName defines the entity you attach a text to. If EntityName is "Player", the text is attached to the player, else the text is attached to the specified entity. If EntityName is left empty (""), fixed screen-coordinates are used and there is no attachment to any entity or player.
Animation defines the name of the animation the entity/player has to play while the text is shown. If Animation is left empty ("") the previous active animation will continue.
Text defines the text to be displayed.
Font# defines the number of the font to be used to display the text with.
Sound defines the sound file played once during the time the text is displayed. Typically this is used to 'speak' the text you display.
ScreenX, ScreenY define the offset relative to the entity's/player's origin the text is displayed at. When EntityName is left empty, ScreenX and ScreenY define the absolute screen position where the text will be placed.
Align can be "left", "right" or "center" and defines the alignment relative to the origin of the entity/player.
Alpha defines the alpha of the text displayed (0 to 255, where 0 is fully transparent, 255 is fully solid)
NOTE: When you use multiple ShowText/ShowTextDelay commands in one order then you need to assign each command to a unique TextNumber, otherwise only the last text will be displayed! In a next order, you can re-use previous assigned TextNumbers. The assigned TextNumbers are common for ALL scripts! Orders running simultaneously require to use different TextNumbers.
The text displayed using this command will be placed on top of anything. You can display a text in multiple lines by using <CR> as a separator.
Pain is only psychological.
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: Objectives
That seems a little compliicated,but if I don't manage to make it,I'll leave it like that,because that's not that important.
OK,that's done! One step closer to releasing the demo! Now I'm off to creating another - big hard to accomplish question,and if I get the help I neen,I'll release the demo maybe that or the next week! (just hope the musucian gives me the level soundtracks)
OK,that's done! One step closer to releasing the demo! Now I'm off to creating another - big hard to accomplish question,and if I get the help I neen,I'll release the demo maybe that or the next week! (just hope the musucian gives me the level soundtracks)