Hey I was wondering if anyone had some code, or could show me how to send a skill of an entity created in wed? In short, I am trying to make a weapon pickup code and I am having some trouble. This is what I have so far...

Code:
function scan_event() 
{
	if (event_type == EVENT_SCAN) 
	{
		if(my.weaponToSpawn == 1 && my.weaponAmmoPickup > 0 && my.weaponPickup == 1)
		{
			weaponInventory[0] = 1;
			reloading = 0;
			reloadSfxOnce = 0;
			shootAnimationSpeed = 100;
			user.currentWeapon = 1;
			drawWeaponAnimation = 0;
			weaponReady = 0;
			snd_play(assaultDeploy,100*(sfxVolume/100),0);
			my.weaponPickup = 0;
			my.weaponRespawnTime = 100;
		}
	}
}

function spawnWeapon()
{
	set(my,PASSABLE);
	my.scale_x = 1.5;
	my.scale_y = my.scale_x;
	my.scale_z = my.scale_x;
	add_light(vector(my.x,my.y,my.z+10), vector(106,255,253), 20);
	my.material = glowShader;
	my.skill41 = floatv(0.02); // adjust the stength of the glow
	while(1)
	{
		my.pan += 5*time_step;
		wait(1);
	}
}

void weaponSpawnz()
{
	while(enet_ent_globpointer(my) == ANET_ERROR) {wait(1);} //wait until the entity gets a global pointer
	ENTITY* ent;
	var sendVarPickup = 0;
	my.emask |= ENABLE_SCAN;
	my.weaponRespawnTime = 0;
	my.weaponToSpawn = 1;
	my.weaponPickup = 0;
	set(my,PASSABLE|SHADOW);
	weaponSpawnerBaseEmitter();
	my.event = scan_event;
	if(my.weaponToSpawn == 1)
	{
		ent = ent_create("w_MK19.mdl", vector(my.x,my.y,my.z+40), spawnWeapon);
		my.weaponAmmoPickup = 30;
	}
	while(1)
	{
		if(my.weaponRespawnTime>0)
		{
			my.weaponRespawnTime-=1*time_step;
		}
		else
		{
			my.weaponRespawnTime = 0;
			my.weaponPickup = 1;
			sendVarPickup = 0;
		}
		if(my.weaponPickup == 0)
		{
			if(ent!=NULL && sendVarPickup == 0)
			{
				set(ent,INVISIBLE);
				enet_send_skills(enet_ent_globpointer(my),22,22,BROADCAST); 
				sendVarPickup = 1;
			}
		}
		else
		{
			if(ent!=NULL)
			{
				reset(ent,INVISIBLE);
			}
		}
		wait(1);
	}
}
//ent_create("placeholder.mdl",vector(0,0,0),weaponSpawnerFunc);
action weaponSpawnerFunc()
{
	set(my,PASSABLE|INVISIBLE);
	if(MY_CONNECTION == SERVER_MODE)
	{
		enet_svent_create(WEAPON_SPAWNER,vector(my.x,my.y,my.z));
	}
	else
	{
		enet_clent_create(WEAPON_SPAWNER,vector(my.x,my.y,my.z));
	}
}



I get a Bad Global Pointer error when I initiate the pickup script. So what am I doing wrong? Is there anyone who can help me figure this out?

What I am looking for is some way where...

- Player asks server "Hey can I pick this up?"
- Server says Yes or No based on whether THAT PARTICULAR weapon spawners "available" skill = 1;
- After the player has recieved the Yes/No, they take the appropriate action.


Last edited by exile; 06/03/12 09:56.