#Pwn Call Posted August 24, 2013 Share Posted August 24, 2013 So this will be for a mini console that when poked will grant you some ammo. Parameters Cost - cost of ammoTeam - GDI or NOdPrice -Amount - amount of ammo to grantBuy sound - sound when bought ammoDenied sound - sound when you are denied purchase because of fundsPreset - Maybe the preset of the ammo that the gun takes? I don't know if you would need this param or not. Link to comment Share on other sites More sharing options...
&Genesis2001 Posted September 26, 2014 Share Posted September 26, 2014 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.scripts.dll.zip zunnie and Hunter-Seeker 2 Link to comment Share on other sites More sharing options...
!zunnie Posted September 26, 2014 Share Posted September 26, 2014 Nice, will add it to our code soonish. Good work Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now