Gamestudio Links
Zorro Links
Newest Posts
Removing outliers from files
by JeyKey II. 11/29/26 10:01
Experiences with cTrader
by JeyKey II. 11/27/26 09:04
make a complaint
by EW_bytes. 11/26/26 23:00
FXCM => AVA Trade Plugin???
by Martin_HH. 11/25/26 21:59
No connection to MT4
by Martin_HH. 11/23/26 06:38
MinMax function on History t6 file
by LucasJoshua. 11/21/26 14:28
What are you working on?
by rayp. 11/20/26 18:10
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (EvanTJ, JeyKey II), 8,576 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EvanTJ, rht, MaliceTheMaker, Haitao_Ren, JimSimons
19250 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 4 of 4 1 2 3 4
Re: Saving a modified model ingame as mdl [Re: TechMuc] #387534
11/20/11 11:41
11/20/11 11:41
Joined: Sep 2009
Posts: 1,035
Budapest
Aku_Aku Offline
Serious User
Aku_Aku  Offline
Serious User

Joined: Sep 2009
Posts: 1,035
Budapest
Any news?

Re: Saving a modified model ingame as mdl [Re: Aku_Aku] #387537
11/20/11 11:54
11/20/11 11:54
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline OP
Senior Expert
Pappenheimer  Offline OP
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
What news?
Did you try TechMuc's contribution a few posts above?
It works nicely so far, I made a test with simplysid.mdl, and it keeps the animations as well.

Don't forget to follow the instructions that TechMuc posted.

Try something like this to see the resulting model, instead of the given values in the test.c file:

c.v.y -= random(3);

Code:
function raise_terrain(ENTITY* terrain)
{
	int i = ent_status(terrain,0); // number of vertices
	for (; i>0; i--)
	{
		CONTACT* c = ent_getvertex(terrain,NULL,i);
		c.v.y -= random(3);
		ent_setvertex(terrain,c,i);
	}
}



This is the whole test, how I modified it to see a fast and easy result:
Code:
#include <acknex.h>
#include <windows.h>
#include <default.c>


//exported functions
void* LoadModel(ENTITY* ent);
void* LoadModelFromFile(STRING* str);

BOOL SaveModel(ENTITY* ent);
BOOL SaveModelWithLoader(ENTITY* ent,void* loader);
BOOL SaveModelToFileFile(ENTITY* ent,void* loader,STRING* new_fl);

BOOL FreeLoader(void* loader);

// raise all terrain vertices by 5 units
function raise_terrain(ENTITY* terrain)
{
	int i = ent_status(terrain,0); // number of vertices
	for (; i>0; i--)
	{
		CONTACT* c = ent_getvertex(terrain,NULL,i);
		c.v.y -= random(2);
		ent_setvertex(terrain,c,i);
	}
}



int main() {
	wait(1);
	level_load("");
	wait(3);
	ENTITY* ent = ent_create("simplysid.mdl",vector(10,10,10),0);
	wait(1);
	void* loader = LoadModel(ent);
	wait(1);
	raise_terrain(ent);
	wait(1);
//	SaveModelWithLoader(ent,loader);
	SaveModelToFileFile(ent, loader, "test.mdl");
	FreeLoader(loader);
	
	while(1) {
		wait(1);
	}
	return true;
}



Last edited by Pappenheimer; 11/20/11 11:55.
Page 4 of 4 1 2 3 4

Moderated by  aztec, Spirit 

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