Page 1 of 3

how to add a model to an entity (newbie)

Posted: April 5th, 2012, 3:42 pm
by doctorface
sorry i kind of already asked this but wasn't my original question in post (thi is my second post)

i have looked and can't find the tutorial as well

im wanting to attatch the entity 'box' or 'barrel' to a model, how is this done? (i know how to make my own model and import it into game)
in game play i want to be able to walk upto and push a box so i can use it as a step up jumping platform but you have to push it in the right position as a pussle type of thing

either in the cfg file of the model or edit mode,

also im not sure which mode is beter FPS or RPG i don't really understand why they are different
i do want to make a 3rd person perspective shooter game.... eventually, so im presuming FPS is better but after reading some posts RPG seems to have more editable options is this correct? as i do want to use the health and mana options but like i said eventually, ill start with pushing a box haha

thank you

Re: how to add a model to an entity (newbie)

Posted: April 6th, 2012, 12:08 am
by Sircameron
Ok so first thing.. Go to the "data/rpg/games/base" folder now look for a folder named "obstacles" if its not inside there its okay just create a folder named "obstacles", and then open it.. Now make a "#.cfg" (in this case "0.cfg") now open it up in notepad and insert the following code

Code: Select all

r_obstacle_mdl dcp/barrel ///location/name of model for obstacle
r_obstacle_script # //# is the number of the script you want it to use
r_obstacle_name "insertname" // put it inside of the " "..
r_obstacle_flags $OBS_MOVABLE /// can be changed to "$OBS_STATIONARY" if you dont want it to move

now open up RPG mode, select your map, and open up the console in edit mode by pressing the "/" button and type "newent obstacle 0 0" (without the quotes) and there ya go! You now have a movable obstacle..
WARNING: this is for rpg mode 2.7.0! Should work fine in 2.7.1 though

Re: how to add a model to an entity (newbie)

Posted: April 7th, 2012, 2:10 am
by doctorface
sorry bro i tried it but it didn't work

i think im not understanding your very clear instructions which will be complettely my fault, i feel really dumb as i said im a pretty advanced user of gamemaker but sandbox seems to be so forign

so i did what you said and it made an entity with no model...

my model is in packages/models/brick ( if i just create a model it works using //mmodel brick... so not model problem)

this is what i did

_obstacle_mdl dcp/barrel /brick//location/name of model for obstacle
r_obstacle_script 1//# is the number of the script you want it to use
r_obstacle_name "brick" // put it inside of the " "..
r_obstacle_flags $OBS_MOVABLE /// can be changed to "$OBS_STATIONARY" if you dont want it to move

im very sorry can you re-paste code with exactly what i need to put in if model is called brick

thanks

Re: how to add a model to an entity (newbie)

Posted: April 7th, 2012, 3:11 am
by Sircameron

Code: Select all

r_obstacle_mdl brick/brick
r_obstacle_script #
r_obstacle_name "brick"
r_obstacle_flags $OBS_MOVABLE


There ya go.. You still need to change the "#" to a script number.. You may even be able to take that line out. Sorry for the bad instructions.

Re: how to add a model to an entity (newbie)

Posted: April 7th, 2012, 3:51 am
by doctorface
don't apoligise it will be my fault i can't work it out

for some reason its not displaying the model still but is dispalying the entity in edit mode and i run 'mmodel brick' and it displays nothing so must be a model issue and i havn't changed any settings since i last used this program so can't work out why

i think i just need to restart program and maybe myself have a sleep, as im sure i must be doing somehting wrong thats probably pretty obvious

im sure im doing everything right how frustrating

ill let you know once i work it out

Re: how to add a model to an entity (newbie)

Posted: April 7th, 2012, 4:12 am
by Sircameron
Hmm.. So a few questions for ya.
1. Is your model in one of the supported formats?
2. Do you have a .cfg file inside the folder with your model?
If you cant get your model to work just change "r_obstacle_mdl brick/brick" to "r_obstacle_mdl dcp/barrel" (that model comes with sandbox) if that model works then we know its a problem with your model.. If not then i didnt give you good enough instructions haha we'll get it figured out anways

Re: how to add a model to an entity (newbie)

Posted: April 7th, 2012, 3:12 pm
by doctorface
its kind of working but its using my player model ? and it falls so it has gravity but i can't push it?

Under rpg/games/base/obstacle/brick i have 3 files 0.cfg(have tryed changing this to obj.cfg as well) with your code, skin.bmp, tris.obj

tryed loading it by ` /newent obstacle 0 0 which created my player model for some reason and it falls if i spawn it in the sky, but it doesn't move if i push it and wrong model

the obj works fine in FPS mode loading it as a standard non moving model as i usually have it in packages/models/brick and my obj.cfg file is usually emtpty as all the scalling etc i have done while creating the model.

can you see what im doing wrong ?

thanks for your patience

Re: how to add a model to an entity (newbie)

Posted: April 7th, 2012, 4:20 pm
by Sircameron
Cool i know what you're doing wrong.. The same thing happened to me with my first custom model.. You need an obj.cfg in the same folder as your model.. Then you also need the "0.cfg" in the obstacles folder.. Now the best way for me to tell you what goes inside of the "obj.cfg" is to have you open up one of the other model folders, and look at the "md3.cfg" file. And everywhere it says something like "md3load". "Md3skin" just change the "md3" part to "obj".. Im at work at the moment so when i get home in 4hrs i'll explain it further if you dont figure it out before

Re: how to add a model to an entity (newbie)

Posted: April 7th, 2012, 5:31 pm
by doctorface
thanks for that, i did that and its still not working and came up with this error ingame "obstacle type 0 does not exsist" (probably always has said that)
and it creates my player model at the place where i put the ent - which is under models/rc ( i renamed my model as rc so i could use my model as a player model in game) which is a tris.obj, skin.bmp and obj.cfg. and that model isn't pushable

i have no idea why its grabbing that rc file and not the brick file

so i have a folder under sandbox/packages/models/brick/ - this has my tris.obj,skin.bmp and obj.cfg with the below written in it

objload tris.obj

objskin brick "./skin.bmp"

mdlbb 5
mdlscale 75
mdlcollide 0
mdlspec -1
mdlambient 35
mdlcullface 0
mdlalphatest 0.7
mdlalphablend 0
mdlellipsecollide 0

then i have a file under sandbox/data/rpg/games/base/obstacles/ (is it obstacle or obstacles i had to create this) in there this a 0.cfg

with this in it

r_obstacle_mdl brick/tris
r_obstacle_name "brick"
r_obstacle_flags $OBS_MOVABLE

i took out that line you said may not be needed

also for another approach after reading the wiki i tryed in FPS edit mode typing "/newent box 1 brick 10" - this created a tree for some reason and its also not moveable where as the "box" ent should be moveable so im obviously doing that wrong

thanks Sircameron

Re: how to add a model to an entity (newbie)

Posted: April 7th, 2012, 7:57 pm
by Sircameron
Ok just need a lil more info from you, and i can solve this..
1. Is you model file named "tris.obj"? (I need the name of the file itself)
2. Which mode are you using?
My instructions will only work in rpg mode. What i can tell you for sure is that you're doing the "obj.cfg" wrong. And the "obstacles" folder name is correct..