Can you spot the glitch? [message #485624] |
Mon, 03 February 2014 20:24 |
Stallion
Messages: 222 Registered: April 2006
Karma:
|
Recruit |
|
|
Ok, so I have a script I made (more of reversed engineered and altered). I finally got it to compile and it shows up in level editor, but the spot that is supposed to drop down in the scripts selection section won't show the Get_parameter().
Can you spot the glitch?
*****The intent is to stop a weapon from being able to be used via selection in l.e. scripts drop down setting of "Deployable_Beacon_Preset_Name"
My script:
Stallion.h:
class ST_Deployable_Prevention_Zone : public ScriptImpClass {
void Entered(GameObject *obj,GameObject *enter);
void Timer_Expired(GameObject *obj,int number);
void Remove_Weapon_Safely(GameObject *obj,const char *WeaponName);
};
Stallion.cpp:
#include "general.h"
#include "scripts.h"
#include "engine.h"
#include "VehicleGameObj.h"
#include "Stallion.h"
void ST_Deployable_Prevention_Zone::Entered(GameObject *obj,GameObject *enter)
{
Commands->Start_Timer(obj,this,0.1f,Commands->Get_ID(enter));
}
void ST_Deployable_Prevention_Zone::Timer_Expired(GameObject *obj,int number)
{
const char *i;
i = Get_Parameter("Deployable_Beacon_Preset_Name");
GameObject* checkplayerobj = Commands->Find_Object(number);
if ( IsInsideZone(obj,checkplayerobj))
{
if (Get_Total_Bullets(checkplayerobj, i))
{
const char* currentweapon = Get_Current_Weapon(checkplayerobj);
if (strcmp(currentweapon, i) == 0 && Get_Current_Bullets(checkplayerobj) > 0)
{
Commands->Select_Weapon(checkplayerobj,"");
Commands->Select_Weapon(checkplayerobj,i);
}
Commands->Start_Timer(obj,this,0.5,number);
}
}
}
void ST_Deployable_Prevention_Zone::Remove_Weapon_Safely(GameObject *obj,const char *WeaponName)
{
const char *CurrentWeapon = Get_Current_Weapon(obj);
if (CurrentWeapon)
{
if (!_stricmp(CurrentWeapon,WeaponName))
{
if (Has_Weapon(obj,"Weapon_Pistol_Player"))
{
Commands->Select_Weapon(obj,"Weapon_Pistol_Player");
Remove_Weapon(obj,WeaponName);
Commands->Select_Weapon(obj,"Weapon_Pistol_Player");
}
}
}
}
ScriptRegistrant<ST_Deployable_Prevention_Zone> ST_Deployable_Prevention_Zone_Registrant("ST_Deployable_Prevention_Zone", "");
Level edit is my play ground
|
|
|