Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
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
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 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
view ent #429582
09/14/13 18:34
09/14/13 18:34
Joined: Apr 2012
Posts: 106
G
GaniX Offline OP
Member
GaniX  Offline OP
Member
G

Joined: Apr 2012
Posts: 106
hi , i have a question :
if i use a view entity to make a coltshell of the gun . when i use a machinegun for example , i must declarate all of the coltshell or i can reuse the first original?
Code:
ENTITY*coltshell=
{
	type = "coltshell.mdl";
	
	flags2 = OVERLAY |PASSABLE;
 	layer = 0;
	scale_x = 1.5;
	scale_y = 1.5;
	scale_z = 1.5;
	x = 30;
	y = -6;
	z = -2;
}


function animate_gun()
{
...
	if (gun_percent<50)//no shot or coltshell in the air
	{
	coltshell.alpha = 0;
	coltshell.flags2 |= INVISIBLE |TRANSLUCENT;
	coltshell.tilt =  0;
	coltshell.y	  = -6;
	coltshell.z    = -2;		
	coltshell.x	  = 30;	
	coltshell.pan  =  0;
	
	}else{
		sonidodisp+=1;
	if(sonidodisp==1)snd_play(shot, 100, 0);// shoot or //coltshell in t air
		coltshell.flags2 |= SHOW; 
		coltshell.pan+=(2+random(20))*time_step;
		coltshell.tilt+=(2+random(20))*time_step;
		coltshell.y-=(1.7+random(1))*time_step;
		coltshell.z+=(1.7+random(1))*time_step;
 ...


Last edited by GaniX; 09/14/13 18:36.
Re: view ent [Re: GaniX] #429583
09/14/13 18:50
09/14/13 18:50
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
U mean u change the weapon and the coltshell changes with it ?
If so
Code:
ent_morph

should do the trick


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: view ent [Re: rayp] #429678
09/16/13 16:14
09/16/13 16:14
Joined: Apr 2012
Posts: 106
G
GaniX Offline OP
Member
GaniX  Offline OP
Member
G

Joined: Apr 2012
Posts: 106
tks for your help rayp.
but i try to do other thing.
when the player is shoot with a machinegun, the machinegun expulse multiples coltshell, its say i can see more of 1 coltshell in the air ,the question is: i need declarate all the coltshell like a new entitty or i can reuse the old entity.

Last edited by GaniX; 09/16/13 18:26.
Re: view ent [Re: GaniX] #429801
09/18/13 19:51
09/18/13 19:51
Joined: Apr 2012
Posts: 106
G
GaniX Offline OP
Member
GaniX  Offline OP
Member
G

Joined: Apr 2012
Posts: 106
i do the effect of the colltshell pulse using an animation in the med .
is any other way to do that?

Last edited by GaniX; 09/18/13 19:56.
Re: view ent [Re: GaniX] #429822
09/19/13 07:46
09/19/13 07:46
Joined: Jan 2006
Posts: 968
EpsiloN Offline
User
EpsiloN  Offline
User

Joined: Jan 2006
Posts: 968
Create a static shell for a bullet, without animations.
You can create more than one shell using
Code:
ent_createlayer(STRING* filename, var flags2, var layer)


Look for the function in the manual.
After creating the shell, give it a layer and position on the screen and animate it through script.
Add initial velocity upwards and right (for example) and then decrease the upwards velocity until a gravity effect is simulated.
If you want you can use world entities (ent_create) but then you have to make then spawn exactly at a specific point on the screen (possibly converting screen cordinates X,Y to world coordinates with a Z distance value).
This has the advantage that the shells can be left on the ground for the player to look at for a few seconds before fading away.

I hope this helps you.

PS.: vec_for_screen (convert screen coordinatess to world coordinatess) example
This isnt tested, but it should work. Write your own code for the animation after the comment line using c_move and a decreasing skill for z velocity...
Code:
function animate_shell()
{
    my.skill10 = 250; //lifespan
    while(my.skill10 > 0)
    {
      // animate it here
      // ...

      my.skill10 -= 1;
      wait(1);
    }
}

// In player action (if a mouse_left input)
    shell_spawn.x = 640; // Middle of resolution 1280x1024
    shell_spawn.y = 512;
    shell_spawn.z = 10; // Distance from screen
    vec_for_screen(shell_spawn.x,camera);
    ent_create("shell.mdl",shell_spawn.x,animate_shell);



Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: view ent [Re: EpsiloN] #430837
10/02/13 23:27
10/02/13 23:27
Joined: Apr 2012
Posts: 106
G
GaniX Offline OP
Member
GaniX  Offline OP
Member
G

Joined: Apr 2012
Posts: 106
hi epsilon; tks for help me.
i´d tried with some codes like your code of your up post , and others using vec to screen and others codes using rel_to_screen but i have not the result i´m looking for.
wath i want is to move a coltshell mdl in the screen monitor using xyz position relative to the view, and not to the world.
i found a solution using 5 different entities (ENTITY*a)and in the player code this. if mouse left ....b=ent_create_layer(...), a=ent_create_layer(.....) and then animate a.pan +=1 ...; and re use this entities coltshell .
any other way more easy to Make This and not Declarate five different entities?.

tks for your atention

Last edited by GaniX; 10/03/13 18:35.

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