Raised This Month: $ Target: $400
 0% 

DispatchKeyValue woes


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bad HAL 9000
Senior Member
Join Date: Mar 2004
Location: Minnesota, USA
Old 06-25-2004 , 21:20   DispatchKeyValue woes
Reply With Quote #1

Im pretty new at this entity stuff, I have managed to get some stuff working, but am having trouble here

Code:
@PointClass base(Target) size(-16 -16 -36, 16 16 36) color(255 125 0) = ts_powerup : "TS powerup" 
[
	pwuptype(choices) : "Powerup Type" : 0 =
	[
		0: "Random"
		1: "Slow Motion"
		2: "Infinite Clip"
		4: "Kung Fu"
		8: "Slow Pause"
		16: "Double Firerate"
		32: "Grenade"
		64: "Health"
		128: "Armor"
		256: "Low Gravity"
	]

	pwupduration(integer) : "Respawn time" : 60

	message(string) : "Message when pick up"
]
From the FDG of the ent I want to make

Now, here is my code to spawn the ent I want, most of it was from AssKickR

Code:
public create_powerup(id) {  /*Made by AssKicR.. CopyLeft 2004->Eternity*/   client_print(id,print_chat,"You have tried to spawn a powerup") new ent = create_entity("ts_powerup")   DispatchKeyValue(ent, "pwuptype", "256") // DispatchKeyValue(ent, "pwuptype", 256)  // invalid argument type, cant use int... wtf DispatchSpawn(ent)   new Float:fNewOrigin[3]   entity_get_vector(id, EV_VEC_origin, fNewOrigin)   entity_set_origin(ent, fNewOrigin) fake_touch(id,ent) fake_touch(ent,id) remove_entity(ent)     return PLUGIN_HANDLED    }
__________________
Bad HAL 9000 is offline
Send a message via ICQ to Bad HAL 9000 Send a message via AIM to Bad HAL 9000 Send a message via MSN to Bad HAL 9000 Send a message via Yahoo to Bad HAL 9000
Ryan
Senior Member
Join Date: May 2004
Location: NH, USA
Old 06-26-2004 , 03:08  
Reply With Quote #2

EDIT: I missed the part about the FGD file, my bad.
__________________
Warcraft 3: Expansion
Homepage | Downloads | Forums
Ryan is offline
Send a message via AIM to Ryan
AssKicR
Veteran Member
Join Date: Mar 2004
Location: Norway-Europe(GTM+1)
Old 06-26-2004 , 03:19  
Reply With Quote #3

wrong Ryan

This ent is not an "info_target" it is a "ts_powerup"

DELETE UR POST... IT IS TOTALLY OFFTOPIC AND WRONG!!!!
__________________
My Plugins

Got ??
AssKicR is offline
Bad HAL 9000
Senior Member
Join Date: Mar 2004
Location: Minnesota, USA
Old 06-26-2004 , 05:52  
Reply With Quote #4

hmm, yea I dont need the model, I need the functionality the ent provides... and AssKicr that seemed inaproprate, he was only trying to help
__________________
Bad HAL 9000 is offline
Send a message via ICQ to Bad HAL 9000 Send a message via AIM to Bad HAL 9000 Send a message via MSN to Bad HAL 9000 Send a message via Yahoo to Bad HAL 9000
SidLuke
Senior Member
Join Date: Mar 2004
Location: Poland, Chrzanow
Old 06-26-2004 , 11:41  
Reply With Quote #5

Create and Give Item will be in TS Module
Item needs some time to spawn so you can't remove it. Set task (1 sec ? )with ent as a parametr and then touch and remove it.
SidLuke is offline
Send a message via AIM to SidLuke Send a message via MSN to SidLuke
AssKicR
Veteran Member
Join Date: Mar 2004
Location: Norway-Europe(GTM+1)
Old 06-26-2004 , 12:41  
Reply With Quote #6

sooo.. like this

PS: Bad Hal 9000: i was just telling him that what he said was wrong.. What is inaproprate about that?

Code:
public create_powerup(id) {     /*Made by AssKicR.. CopyLeft 2004->Eternity*/     new ent = create_entity("ts_powerup")     DispatchKeyValue(ent, "pwuptype", "256")     DispatchSpawn(ent)     new parm[2]     parm[0]=id     parm[1]=ent     set_task(1.0,"give_powerup",0,"parm",2) } public give_powerup(parm[]) {     /*Made by AssKicR.. CopyLeft 2004->Eternity*/     new id = parm[0]     new ent = parm[1]     new Float:fNewOrigin[3]     entity_get_vector(id, EV_VEC_origin, fNewOrigin)     entity_set_origin(ent, fNewOrigin)     fake_touch(id,ent)     fake_touch(ent,id)     remove_entity(ent) }
__________________
My Plugins

Got ??
AssKicR is offline
SidLuke
Senior Member
Join Date: Mar 2004
Location: Poland, Chrzanow
Old 06-26-2004 , 12:51  
Reply With Quote #7

Code:
static cell AMX_NATIVE_CALL create_pwup(AMX *amx, cell *params){ // pwup ,origin[3]

	string_t item = MAKE_STRING("ts_powerup"); 
	edict_t	*pent = CREATE_NAMED_ENTITY( item );
	if ( FNullEnt( pent ) ){
		return 0;
	}

	KeyValueData pkvd;
	char szTemp[16];

	sprintf(szTemp,"%d",params[1]);

	pkvd.szClassName = (char *)STRING(pent->v.classname);
	pkvd.szKeyName = "pwuptype"; // type
	pkvd.szValue = szTemp;
	pkvd.fHandled = false;
	MDLL_KeyValue(pent, &pkvd);

	pkvd.szClassName = (char *)STRING(pent->v.classname);
	pkvd.szKeyName = "pwupduration"; // duration
	pkvd.szValue = "60";
	pkvd.fHandled = false;
	MDLL_KeyValue(pent, &pkvd);

/*
	pkvd.szClassName = (char *)STRING(pent->v.classname);
	pkvd.szKeyName = "message";
	pkvd.szValue = "";
	pMDLL_KeyValue(pEntity, &pkvd);
*/
	cell *vInput = MF_GetAmxAddr(amx,params[2]);

	float fNewX = *(float *)((void *)&vInput[0]);
	float fNewY = *(float *)((void *)&vInput[1]);
	float fNewZ = *(float *)((void *)&vInput[2]);

	vec3_t vNewValue = vec3_t(fNewX, fNewY, fNewZ);

	MDLL_Spawn(pent);
	pent->v.origin = vNewValue;

	return ENTINDEX(pent);
}

// create_pwup -> !wait! -> give_pwup
static cell AMX_NATIVE_CALL give_pwup(AMX *amx, cell *params){ // index,pwupentindex

	edict_t* pent = INDEXENT(params[2]);
	if ( FNullEnt( pent ) || strcmp("ts_powerup",STRING(pent->v.classname))!=0 ){
		return 0;
	}
	
	int id = params[1];
	if ( id<1 || id>gpGlobals->maxClients ){ 
		MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
		return 0;
	}
	CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
	if ( !pPlayer->ingame || !pPlayer->IsAlive() ){
		REMOVE_ENTITY(pent);
		return 0;
	}

	pent->v.origin = pPlayer->pEdict->v.origin;

	MDLL_Touch(pent, pPlayer->pEdict);

	REMOVE_ENTITY(pent);

	return 1;

}
SidLuke is offline
Send a message via AIM to SidLuke Send a message via MSN to SidLuke
Bad HAL 9000
Senior Member
Join Date: Mar 2004
Location: Minnesota, USA
Old 06-26-2004 , 13:03  
Reply With Quote #8

AssKicR the RED AND BOLD AND BIG TEXT!

Also, that code didnt spawn the ent,
__________________
Bad HAL 9000 is offline
Send a message via ICQ to Bad HAL 9000 Send a message via AIM to Bad HAL 9000 Send a message via MSN to Bad HAL 9000 Send a message via Yahoo to Bad HAL 9000
Bad HAL 9000
Senior Member
Join Date: Mar 2004
Location: Minnesota, USA
Old 06-28-2004 , 23:07  
Reply With Quote #9

Bumpage, this doesnt work


Code:
public create_powerup(id) {     /*Made by AssKicR.. CopyLeft 2004->Eternity*/     new ent = create_entity("ts_powerup")     new pwup[4]     format(pwup,4,"%d",256)     DispatchKeyValue(ent, "pwuptype", pwup)     DispatchKeyValue(ent, "duration", "60")     DispatchKeyValue(ent, "message", "")     DispatchSpawn(ent)     new parm[2]     parm[0]=id     parm[1]=ent     set_task(1.0,"give_powerup",0,"parm",2) } public give_powerup(parm[]) {     /*Made by AssKicR.. CopyLeft 2004->Eternity*/     new id = parm[0]     new ent = parm[1]     new Float:fNewOrigin[3]     entity_get_vector(id, EV_VEC_origin, fNewOrigin)     entity_set_origin(ent, fNewOrigin)     fake_touch(id,ent)     fake_touch(ent,id)     remove_entity(ent) }
__________________
Bad HAL 9000 is offline
Send a message via ICQ to Bad HAL 9000 Send a message via AIM to Bad HAL 9000 Send a message via MSN to Bad HAL 9000 Send a message via Yahoo to Bad HAL 9000
[FBX]
Senior Member
Join Date: May 2004
Old 06-29-2004 , 01:47  
Reply With Quote #10

key value pairs must be legit for the object you are creating, you cant just make up your own (what mod is this for???) You also must set the location of an entity before dispatchingspawn. If you are not sure what the valid key value pairs are for an entity, load a map in notepad or something (it'll take a while to load) and then search for the entity name. You should realize how entities are described in the map after you look at it for a bit and every entity's key value pair that is required will be listed. I notice that message is "" and its possible you dont even need the key value pair. Before messing with key value pairs however, try to recreate the entity that is on the map exactly at it is first.
[FBX] is offline
Reply



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 14:41.


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