Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (Ayumi), 662 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Panel Over Entity #236732
11/16/08 08:54
11/16/08 08:54
Joined: Jul 2008
Posts: 56
I
iam_ufo973 Offline OP
Junior Member
iam_ufo973  Offline OP
Junior Member
I

Joined: Jul 2008
Posts: 56
Hi
After a long time i started using 3dgs again. but facing a problem in my script where i want to display the value of a variable(Ex Health) over an entity. Can somebody help me please.
Thanx

Re: Panel Over Entity [Re: iam_ufo973] #236733
11/16/08 09:09
11/16/08 09:09
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline
Serious User
jigalypuff  Offline
Serious User

Joined: Nov 2005
Posts: 1,007
this was in one of the aum magazines, try looking in those


Why does everyone like dolphins? Never trust a species which smiles all the time!
Re: Panel Over Entity [Re: jigalypuff] #236734
11/16/08 09:10
11/16/08 09:10
Joined: Jul 2008
Posts: 56
I
iam_ufo973 Offline OP
Junior Member
iam_ufo973  Offline OP
Junior Member
I

Joined: Jul 2008
Posts: 56
which one?

Re: Panel Over Entity [Re: iam_ufo973] #236737
11/16/08 10:02
11/16/08 10:02
Joined: Jul 2008
Posts: 56
I
iam_ufo973 Offline OP
Junior Member
iam_ufo973  Offline OP
Junior Member
I

Joined: Jul 2008
Posts: 56
Ok i got the script to show global variable over entity but what about local variables is there any way you can show local variables. Example there is only one action attached to all enemies and you want to display there health over there head? Any Idea?

Re: Panel Over Entity [Re: iam_ufo973] #236741
11/16/08 10:36
11/16/08 10:36
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
make temporary global variables, which you keep swapping with local variables..?


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: Panel Over Entity [Re: Helghast] #236902
11/17/08 02:27
11/17/08 02:27
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Local variables can't be shown in panels for good reasons: They are only valid local and therfore it can neither be guaranteed, that at least any of these local variables exists, nor can be distinguished between multiple instances of the same local variable. So Helghast's suggestion is the way to go.


Always learn from history, to be sure you make the same mistakes again...
Re: Panel Over Entity [Re: Uhrwerk] #237035
11/17/08 18:45
11/17/08 18:45
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
maybe use text_draw for local vars (skills)?

This may work:
- define a local string (outside the while loop of the enemy)
- get the world coordinates of the position you want the text to be shown at
- translate the coordinates to screen coordinates using vec_to_screen
- inside the while loop, translate the skill to string using str_for_num function
- draw the sting using draw_text and the screen coordinates plus the string

Re: Panel Over Entity [Re: Xarthor] #237285
11/19/08 13:33
11/19/08 13:33
Joined: Jul 2008
Posts: 56
I
iam_ufo973 Offline OP
Junior Member
iam_ufo973  Offline OP
Junior Member
I

Joined: Jul 2008
Posts: 56
Xarthor it works perfect thank you very much. it was almost impossible to show local variables over entities but you solved it in a very easy way laugh
But the str_for_num doesn't work it gives error can you give me an small example please.

Last edited by iam_ufo973; 11/19/08 13:49.
Re: Panel Over Entity [Re: iam_ufo973] #237350
11/19/08 19:45
11/19/08 19:45
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Code:
action enemy_act()
{
  VECTOR my_pos;
  STRING* my_health;

  while(me)
  {
    if(vec_for_screen(my.x,camera))
    {
      vec_set(my_pos,my.x);
      my_pos.z += 50; // z-offset
      vec_to_screen(my_pos,camera);
      str_for_num(my_health,my.skill22); // replace my.skill22 with your health skill
      draw_text(my_health,my_pos.x,my_pos.y,vector(255,255,255));
    }
    wait(1);
  }
}

Attention: not tested

Re: Panel Over Entity [Re: Xarthor] #237460
11/20/08 08:23
11/20/08 08:23
Joined: Jul 2008
Posts: 56
I
iam_ufo973 Offline OP
Junior Member
iam_ufo973  Offline OP
Junior Member
I

Joined: Jul 2008
Posts: 56
It gives the following error!



Last edited by iam_ufo973; 11/20/08 08:24.
Page 1 of 2 1 2

Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | chip programmers | 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