Raised This Month: $ Target: $400
 0% 

[DOD][SOLVED] - replacing dod_control_point models


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
=|[76AD]|= TatsuSaisei
Junior Member
Join Date: Nov 2006
Old 11-27-2006 , 23:34   [DOD][SOLVED] - replacing dod_control_point models
Reply With Quote #1

I am working on a "Holiday" plugin that "changes" some map entities and replaces them with themed items... I have a few novel ideas but I need some physical files for some, and some help with some code on another.. I am hoping someone has something to help me...

The first and most troubling to me is writing code that edits the dod_control_point entity and replaces the current values for point_model_neutral, point_model_axis, point_model_allies (and the 3 associated body number properties)

What I found was a forward and a native that seem interesting and probably along the lines of what I need, but I can not for the life of me wrap my head around it...

From the <dodfun.inc>
Code:
 
/* called after first InitObj */
forward controlpoints_init();
Code:
 
enum CP_VALUE {
...
 CP_model_body_neutral,
 CP_model_body_allies,
 CP_model_body_axis,
...
 CP_model_neutral,
 CP_model_allies,
 CP_model_axis,
};
Code:
 
/* use this function to change control point's data */
native objective_set_data( index, CP_VALUE:key , iValue=-1, szValue[]="" );
one of my current hangups is "what is iValue=-1 ?"


and the second part of my request.... does anyone know where I can find, or simply has any Christmas themed models, or right now little gift(package) models... I am in no way a modeller, though I have been known to hack a few succesfully, so creating my own is impossible... any help here or for above would be greatly appreciated....

Last edited by =|[76AD]|= TatsuSaisei; 01-02-2007 at 01:41. Reason: solved....
=|[76AD]|= TatsuSaisei is offline
Send a message via AIM to =|[76AD]|= TatsuSaisei
=|[76AD]|= TatsuSaisei
Junior Member
Join Date: Nov 2006
Old 11-29-2006 , 13:17   Re: [DOD] - replacing dod_control_point models...
Reply With Quote #2

whoa, slow down.. not so many responses at once... lmao

Anyways, here is where I am at now... I DID get some flags to change models, but some did not, and with changing them it seemed to have "killed" the capture areas...

I added a bit of "developer" code to show information on the objectives before and after the change.. the output from this has me baffled...

Would someone knowledgable in DOD look this over and try this code out (replace christmas tree models with something you have on hand, the model itself makes no differenc, I just want them to change with a plugin)

Code:
 
#include <amxmodx>
#include <dodfun> 
 
 
#define PLUGIN "dod_christmas_trees"
#define VERSION "76.0"
#define AUTHOR "TatsuSaisei"
new CHRISTMAS_TREE_NEUTRAL[]    = "models/christmas_neutral.mdl"
new CHRISTMAS_TREE_AXIS[]    = "models/christmas_axis.mdl"
new CHRISTMAS_TREE_ALLIES[]    = "models/christmas_allies.mdl"
 
public plugin_init() 
{
 register_plugin(PLUGIN, VERSION, AUTHOR)     
 register_concmd("fixup","fixup",ADMIN_RCON,"= Fix flags...")
 register_event("SetObj","flags2trees","a")
} 
public flags2trees()
{
 new maxobj = objectives_get_num()
 for(new i=0; i<maxobj; i++)
 {
  objective_set_data( i, CP_model_body_neutral , 0 )
  objective_set_data( i, CP_model_body_axis , 0)
  objective_set_data( i, CP_model_body_allies , 0 )
  objective_set_data( i, CP_model_neutral , 0,CHRISTMAS_TREE_NEUTRAL )
  objective_set_data( i, CP_model_axis , 0,CHRISTMAS_TREE_AXIS )
  objective_set_data( i, CP_model_allies , 0,CHRISTMAS_TREE_ALLIES )
 }
 objectives_reinit()
 return PLUGIN_CONTINUE
}
public fixup(id,level,cid)
{
 new maxobj = objectives_get_num()
 client_print(id,print_chat,"Objects: %d",maxobj)
 for(new i=0; i<maxobj; i++)
 {
  new string[64]
  objective_get_data(i,CP_model_neutral,string,64)
  client_print(id,print_chat,"Neutral %s",string)
  objective_get_data(i,CP_model_axis,string,64)
  client_print(id,print_chat,"Axis %s",string)
  objective_get_data(i,CP_model_allies,string,64)
  client_print(id,print_chat,"Allies %s",string)
  client_print(id,print_chat,"Iteration %d",i)
 
 }
 return PLUGIN_CONTINUE
}
=|[76AD]|= TatsuSaisei is offline
Send a message via AIM to =|[76AD]|= TatsuSaisei
Vet
Veteran Member
Join Date: Jul 2006
Location: I|O wa
Old 12-06-2006 , 01:50   Re: [DOD] - replacing dod_control_point models...
Reply With Quote #3

The way I change models in DOD is by capturing the desired entity with a register_forward(FM_KeyValue, "your_routine") in the plugin_precache() routine, then replace the model with fm_set_kvd(), and then return as FMRES_SUPERCEDE. Note, this method uses the fakemeta and fakemeta_util includes.

The reason your control points don't work is because DOD links them to the master as they're loading. So make you're changes in precache before they get processed. Works for me anyway.
__________________
=====================================
- My Plugins -
=====================================
Vet is offline
Send a message via MSN to Vet
=|[76AD]|= TatsuSaisei
Junior Member
Join Date: Nov 2006
Old 01-02-2007 , 01:40   Re: [DOD] - replacing dod_control_point models...
Reply With Quote #4

Got it !!

Code:
 
new custom_flag[] = "models/76AD/testflags.mdl"
public plugin_init() 
{
 register_plugin(PLUGIN, VERSION, AUTHOR)
}
public plugin_precache() 
{
 register_forward(FM_KeyValue, "fm_keyvalue")
}
public fm_keyvalue(entid,handle) 
{
 if ( pev_valid(entid) )
 {
  new classname[32], key[32], value[32]
  get_kvd(handle, KV_ClassName, classname, 31)
  get_kvd(handle, KV_KeyName, key, 31)
  get_kvd(handle, KV_Value, value, 31)
  
  if(equali(value,"models/mapmodels/flags.mdl") && equali(classname,"dod_control_point"))
  {
   set_kvd(handle,KV_Value, custom_flag) 
  }
 }
}
Thanx Vet !! +Karma
__________________

Last edited by =|[76AD]|= TatsuSaisei; 01-02-2007 at 01:56.
=|[76AD]|= TatsuSaisei is offline
Send a message via AIM to =|[76AD]|= TatsuSaisei
Vet
Veteran Member
Join Date: Jul 2006
Location: I|O wa
Old 01-02-2007 , 16:56   Re: [DOD][SOLVED] - replacing dod_control_point models
Reply With Quote #5

Since not all maps use the multi-flag model, you should also consider creating, checking for, and replacing the /models/w_aflag.mdl, w_bflag, w_gflag & w_wflag models.

Our server has been using my flag replacement plugin for quite a while. Check it out by simply clicking my signature.
__________________
=====================================
- My Plugins -
=====================================

Last edited by Vet; 01-02-2007 at 17:14.
Vet is offline
Send a message via MSN to Vet
=|[76AD]|= TatsuSaisei
Junior Member
Join Date: Nov 2006
Old 01-02-2007 , 17:16   Re: [DOD][SOLVED] - replacing dod_control_point models
Reply With Quote #6

yes yes, I planned on this, plus I plan to locate some names of other flags used on some custom models.... the most important part was just getting it to work, now that I know how and understand a few more things, adding to this and making it customizable will be a breeze... again Thanx for the help !!
__________________
=|[76AD]|= TatsuSaisei is offline
Send a message via AIM to =|[76AD]|= TatsuSaisei
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:47.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode