Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Welcome, Guest!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign in to follow this  
Pwn Call

Poke Grant Ammo?

Recommended Posts

So this will be for a mini console that when poked will grant you some ammo.




Cost - cost of ammo

Team - GDI or NOd

Price -

Amount - amount of ammo to grant

Buy sound - sound when bought ammo

Denied sound - sound when you are denied purchase because of funds

Preset - Maybe the preset of the ammo that the gun takes?  I don't know if you would need this param or not.

Share this post

Link to post
Share on other sites

Unsure if this is what you want(ed), but here's my take. (Also necro post by a month!)


Source file: (don't forget to include engine.h/scripts.h)

void zbl_Refill_Buy_Poke::Created(GameObject *o){	m_sBuySound = Get_Parameter("Buy_Sound");	m_sDeniedSound = Get_Parameter("Denied_Sound");	m_sInsufficientFunds = Get_Parameter("Insufficient_Funds_Sound");	m_sPowerup = Get_Parameter("Ammo_PowerUp");	m_iCost = Get_Int_Parameter("Cost");	m_iPlayerType = Get_Int_Parameter("Player_Type");}void zbl_Refill_Buy_Poke::Poked(GameObject *o, GameObject *poker){	if (Get_Player_Type(poker) == m_iPlayerType)	{		cPlayer *plr = Find_Player(Get_Player_ID(poker));		if (!plr) return;		if (plr->Purchase_Item(m_iCost))		{			Grant_Powerup(poker, m_sPowerup);			Create_2D_Sound_Player(poker, m_sBuySound);		}		else		{			Create_2D_Sound_Player(poker, m_sInsufficientFunds);		}	}	else	{		Create_2D_Sound_Player(poker, m_sDeniedSound);	}}

Header file:

class zbl_Refill_Buy_Poke : public ScriptImpClass{	int m_iCost;	int m_iPlayerType;	StringClass m_sBuySound;	StringClass m_sDeniedSound;	StringClass m_sInsufficientFunds;	StringClass m_sPowerup;public:	void Created(GameObject *o);	void Poked(GameObject *obj, GameObject *poker);};

Registrant: (including my handy macro)

#define Register_Script(ClassName,Params) ScriptRegistrant<ClassName> ClassName##_Registrant(#ClassName,Params)Register_Script(zbl_Refill_Buy_Poke, "Cost:int,Player_Type:int,Buy_Sound:string,Denied_Sound:string,Insufficient_Funds_Sound:string,Ammo_PowerUp:string");

Compiled binaries attached for LE only. The script body is not compiled into the body as I just compile a script stub (essentially just the registrant with the parameters required to be filled out for LE.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.