Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » How to Turn the Ped on after a specific time
How to Turn the Ped on after a specific time [message #446321] Thu, 28 April 2011 11:59 Go to next message
kamuixmod is currently offline  kamuixmod
Messages: 211
Registered: July 2010
Karma: 0
Recruit
Is it possible to Turn the Ped on after a specific Delay such as 1 Hour. When the Game starts, the Ped is turned off in the settings and if possible it should enable when 1 Horu passes. Any way to make it possible?

http://img46.imageshack.us/img46/5836/kmauixsignature.png
Re: How to Turn the Ped on after a specific time [message #446325 is a reply to message #446321] Thu, 28 April 2011 12:45 Go to previous messageGo to next message
iRANian is currently offline  iRANian
Messages: 4308
Registered: April 2011
Karma: 0
General (4 Stars)
try playing around with bool cGameDataCnc::BaseDestructionEndsGame inside engine_game.h

Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases
Re: How to Turn the Ped on after a specific time [message #446329 is a reply to message #446321] Thu, 28 April 2011 13:02 Go to previous messageGo to next message
kamuixmod is currently offline  kamuixmod
Messages: 211
Registered: July 2010
Karma: 0
Recruit
no idea about it since i didnt lua code or c++ code yet. Could someone do it Very Happy

http://img46.imageshack.us/img46/5836/kmauixsignature.png
Re: How to Turn the Ped on after a specific time [message #446333 is a reply to message #446321] Thu, 28 April 2011 15:19 Go to previous messageGo to next message
Hex is currently offline  Hex
Messages: 858
Registered: March 2004
Karma: 0
Colonel
afaik, no.

goztow wrote on Tue, 11 May 2010 08:00

If we had to ban all who ever cheated or ever created a cheat (obj3cts and such) then I don't think there would be many members left here (sad fact).


reborn wrote on Fri, 29 January 2010 23:37

std is for pro's. Razz
Re: How to Turn the Ped on after a specific time [message #446336 is a reply to message #446321] Thu, 28 April 2011 16:50 Go to previous messageGo to next message
Nightma12 is currently offline  Nightma12
Messages: 2593
Registered: August 2003
Karma: 0
General (2 Stars)
Category Moderator
Could you try moving the pedestal script area via code?
Re: How to Turn the Ped on after a specific time [message #446650 is a reply to message #446321] Sat, 07 May 2011 06:20 Go to previous messageGo to next message
zunnie is currently offline  zunnie
Messages: 2959
Registered: September 2003
Location: Netherlands
Karma: 0
General (2 Stars)

why not add a scriptzone on top of the beaconzone that will
take away a players Ion/Nuke beacon if he has one, and gives it
back when he exits the zone again...
THen they cannot place it :V

Then after 20mins you destroy the zone that does that...

something like this but im not sure how this will handle when
there are more than 1 person on the ped, probly not too well... lol

void z_Prevent_Ped_Beacons_Time::Created(GameObject *obj)
{ 
	currentguy = 0;
	ion = false;
	nuke = false;
	time = Get_Float_Parameter("Time_Seconds");
	Commands->Start_Timer(obj,this,time,1003943);
}
void z_Prevent_Ped_Beacons_Time::Entered(GameObject *obj, GameObject *enter)
{
	if (!currentguy)
	{
		currentguy = enter;
		if (Has_Weapon(enter,"CnC_Weapon_IonCannonBeacon_Player"))
		{
			ion = true;
			Remove_Weapon(enter,"CnC_Weapon_IonCannonBeacon_Player");
		}
		if (Has_Weapon(enter,"CnC_Weapon_NukeBeacon_Player"))
		{
			nuke = true;
			Remove_Weapon(enter,"CnC_Weapon_NukeBeacon_Player");
		}
	}
}
void z_Prevent_Ped_Beacons_Time::Exited(GameObject *obj, GameObject *exit)
{
	if (currentguy)
	{
		if (ion)
		{
			Commands->Give_Powerup(exit,"CnC_POW_IonCannonBeacon_Player",false);
		}
		if (nuke)
		{
			Commands->Give_Powerup(exit,"CnC_POW_Nuclear_Missle_Beacon",false);
		}
		currentguy = 0;
		ion = false;
		nuke = false;
	}
	else 
	{
		currentguy = 0;
		ion = false;
		nuke = false;
	}
}
void z_Prevent_Ped_Beacons_Time::Timer_Expired(GameObject *obj, int number)
{
	if (number == 1003943)
	{
		Destroy_Script();
	}
}

void z_Prevent_Ped_Beacons_Time::Register_Auto_Save_Variables()
{
	Auto_Save_Variable(1,5,&ion);
	Auto_Save_Variable(1,5,&nuke);
	Auto_Save_Variable(1,5,&time);
	Auto_Save_Variable(1,5,&currentguy);
}
ScriptRegistrant<z_Prevent_Ped_Beacons_Time> z_Prevent_Ped_Beacons_Time_Registrant("z_Prevent_Ped_Beacons_Time","Time_Seconds=600000:float");


class z_Prevent_Ped_Beacons_Time : public ScriptImpClass {
	void Entered(GameObject *obj, GameObject *enter);
	void Created(GameObject *obj);
	void Timer_Expired(GameObject *obj, int number);
	void Exited(GameObject *obj, GameObject *exit);
	void Register_Auto_Save_Variables();
	GameObject *currentguy;
	float time;
	bool ion;
	bool nuke;
};


https://multiplayerforums.com/uploads/monthly_2018_03/TCW2_Signature.png.6236a0dbc6e1e53472a18fe8cd15e47b.png

[Updated on: Sat, 07 May 2011 07:02]

Report message to a moderator

Re: How to Turn the Ped on after a specific time [message #451190 is a reply to message #446650] Wed, 10 August 2011 13:11 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3809
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
>>>Updated version in later post<<<

Revised your code a bit Zunnie, hope you don't mind.
Now it supports multiple players, also added in a bit to prevent the FDS from crashing when you remove a weapon that the player is currently holding (you have to switch to another weapon before you remove a weapon that is currently in a players hands). Finally, I also made it give any beacons back to any players standing in the zone on the script's death.


[Updated on: Wed, 10 August 2011 21:16]

Report message to a moderator

Re: How to Turn the Ped on after a specific time [message #451197 is a reply to message #446321] Wed, 10 August 2011 13:33 Go to previous messageGo to next message
iRANian is currently offline  iRANian
Messages: 4308
Registered: April 2011
Karma: 0
General (4 Stars)
iran_scripts.cpp:
#include "scripts.h"
#include "engine.h"
#include "iran_scripts.h"

void Iran_Beaconing_Prevention_Zone::Entered(GameObject *obj,GameObject *enter) 
{																		 
	Commands->Start_Timer(obj,this,0.1,Commands->Get_ID(enter));
}

void Iran_Beaconing_Prevention_Zone::Timer_Expired(GameObject *obj,int number)
{
	GameObject* checkplayerobj = Commands->Find_Object(number);
	if ( IsInsideZone(obj,checkplayerobj)) 
	{
		Commands->Start_Timer(obj,this,0.5,number);		
		const char* currentweapon = Get_Current_Weapon(checkplayerobj);
		if (strcmp(currentweapon, "CnC_Weapon_NukeBeacon_Player") == 0 && Get_Current_Bullets(checkplayerobj) > 0) 
		{
			Remove_Weapon(checkplayerobj,"CnC_Weapon_NukeBeacon_Player");
			Grant_Powerup(checkplayerobj,"CnC_POW_Nuclear_Missle_Beacon");
		}
		else if (strcmp(currentweapon,"CnC_Weapon_IonCannonBeacon_Player") == 0 && Get_Current_Bullets(checkplayerobj) > 0) 
		{
			Remove_Weapon(checkplayerobj,"CnC_Weapon_IonCannonBeacon_Player");
			Grant_Powerup(checkplayerobj,"CnC_POW_IonCannonBeacon_Player");
		}	
	}
}


iran_scripts.h:
class Iran_Beaconing_Prevention_Zone : public ScriptImpClass {
	void Entered(GameObject *obj,GameObject *enter);
	void Timer_Expired(GameObject *obj,int number);
};


Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases

[Updated on: Wed, 10 August 2011 14:04]

Report message to a moderator

Re: How to Turn the Ped on after a specific time [message #451199 is a reply to message #451197] Wed, 10 August 2011 13:50 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3809
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
Think I just said something about fds crashing if you didn't make sure your not removing the weapon their currently holding... and something about my above version being able to handle multiple people at once and returning weapons on turn off.

Otherwise you have the right idea (timer expired is just a bit more resource intensive). But you can't use number like that, I'll explain more later, have to go now.


Re: How to Turn the Ped on after a specific time [message #451200 is a reply to message #446321] Wed, 10 August 2011 13:57 Go to previous messageGo to next message
iRANian is currently offline  iRANian
Messages: 4308
Registered: April 2011
Karma: 0
General (4 Stars)
My version handles multiple people and doesn't crsah the FDS, JonWil's scripts uses timer numbers like that too. Your version will also give people free beacons if they enter the zone when their beacon "bullet count" is zero.

EDIT: Yeah, you're right. I didn't think about trying it that way. Gonna see if your function prevents that crash.

EDIT2: Nvm, the crash is something else that I resolved. What I have now is:


void Iran_Beaconing_Prevention_Zone::Entered(GameObject *obj,GameObject *enter) 
{																		 
	Commands->Start_Timer(obj,this,0.1,Commands->Get_ID(enter));
}

void Iran_Beaconing_Prevention_Zone::Timer_Expired(GameObject *obj,int number)
{
	GameObject* checkplayerobj = Commands->Find_Object(number);
	if ( IsInsideZone(obj,checkplayerobj)) 
	{	
		//if (Has_Weapon(checkplayerobj, "CnC_Weapon_NukeBeacon_Player"))
		if (Get_Total_Bullets(checkplayerobj, "CnC_Weapon_NukeBeacon_Player"))
		{
			const char* currentweapon = Get_Current_Weapon(checkplayerobj);
			if (strcmp(currentweapon, "CnC_Weapon_NukeBeacon_Player") == 0 && Get_Current_Bullets(checkplayerobj) > 0) 
			{
				Remove_Weapon(checkplayerobj,"CnC_Weapon_NukeBeacon_Player");
				Grant_Powerup(checkplayerobj,"CnC_POW_Nuclear_Missle_Beacon");
			}
		Commands->Start_Timer(obj,this,0.1,number);	
		}
		else if (Get_Total_Bullets(checkplayerobj, "CnC_Weapon_IonCannonBeacon_Player"))
		//else if (Has_Weapon(checkplayerobj, "CnC_Weapon_IonCannonBeacon_Player"))
		{
			const char* currentweapon = Get_Current_Weapon(checkplayerobj);
			if(strcmp(currentweapon,"CnC_Weapon_IonCannonBeacon_Player") == 0 && Get_Current_Bullets(checkplayerobj) > 0) 
			{
				Remove_Weapon(checkplayerobj,"CnC_Weapon_IonCannonBeacon_Player");
				Grant_Powerup(checkplayerobj,"CnC_POW_IonCannonBeacon_Player");
			}
		Commands->Start_Timer(obj,this,0.1,number);	
		}		
	}
}


Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases

[Updated on: Thu, 11 August 2011 06:46]

Report message to a moderator

Re: How to Turn the Ped on after a specific time [message #451224 is a reply to message #451200] Wed, 10 August 2011 20:59 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3809
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
Here you go then.

void JMG_Prevent_Ped_Beacons_Time::Created(GameObject *obj)
{
	for (int x = 0;x < 128;x++)
	{
       	ion[x] = false;
		nuke[x] = false;
	}
	Commands->Start_Timer(obj,this,Get_Float_Parameter("Time_Seconds"),1003943);
}

void JMG_Prevent_Ped_Beacons_Time::Entered(GameObject *obj, GameObject *enter)
{
	int PlayerID = Get_Player_ID(enter);
	if (!PlayerID)
		return;
	if (Has_Weapon(enter,"CnC_Weapon_IonCannonBeacon_Player") && Get_Current_Bullets(enter) > 0)
	{
		if (!Remove_Weapon_Safely(enter,"CnC_Weapon_IonCannonBeacon_Player","CNC_Weapon_Pistol_Player "))
			return;
		ion[PlayerID] = true;
	}
	if (Has_Weapon(enter,"CnC_Weapon_NukeBeacon_Player") && Get_Current_Bullets(enter) > 0)
	{
		if (!Remove_Weapon_Safely(enter,"CnC_Weapon_NukeBeacon_Player","CNC_Weapon_Pistol_Player "))
			return;
		nuke[PlayerID] = true;
	}
}

void JMG_Prevent_Ped_Beacons_Time::Exited(GameObject *obj, GameObject *exit)
{
	int PlayerID = Get_Player_ID(exit);
	if (!PlayerID)
		return;
	if (ion[PlayerID])
		Commands->Give_Powerup(exit,"CnC_POW_IonCannonBeacon_Player",false);
	if (nuke[PlayerID])
		Commands->Give_Powerup(exit,"CnC_POW_Nuclear_Missle_Beacon",false);
	ion[PlayerID] = false;
	nuke[PlayerID] = false;
}

void JMG_Prevent_Ped_Beacons_Time::Timer_Expired(GameObject *obj, int number)
{
	if (number == 1003943)
	{
		for (int x = 1;x < 128;x++)
		{
			GameObject *Player = Get_GameObj(x);
			if (!Player)
				continue;
			if (ion[x])
				Commands->Give_Powerup(Player,"CnC_POW_IonCannonBeacon_Player",false);
			if (nuke[x])
				Commands->Give_Powerup(Player,"CnC_POW_Nuclear_Missle_Beacon",false);
		}
		Remove_Script(obj,"z_Prevent_Ped_Beacons_Time");
	}
}

bool JMG_Prevent_Ped_Beacons_Time::Remove_Weapon_Safely(GameObject *obj,const char *WeaponName,const char *SelectWeapon)
{
	const char *CurrentWeapon = Get_Current_Weapon(obj);
	if (CurrentWeapon)
		if (!_stricmp(CurrentWeapon,WeaponName))
		{
			if (Has_Weapon(obj,SelectWeapon))
			{
				Commands->Select_Weapon(obj,SelectWeapon);
				Remove_Weapon(obj,WeaponName);
				Commands->Select_Weapon(obj,SelectWeapon);
				return true;
			}
		}
		else
		{
			Remove_Weapon(obj,WeaponName);
			return true;
		}
	return false;
}

ScriptRegistrant<JMG_Prevent_Ped_Beacons_Time> JMG_Prevent_Ped_Beacons_Time("JMG_Prevent_Ped_Beacons_Time","Time_Seconds=600000:float ");


class JMG_Prevent_Ped_Beacons_Time : public ScriptImpClass {
	bool ion[128];
	bool nuke[128];
	void Created(GameObject *obj);
	void Timer_Expired(GameObject *obj, int number);
	void Entered(GameObject *obj, GameObject *enter);
	void Exited(GameObject *obj, GameObject *exit);
	bool Remove_Weapon_Safely(GameObject *obj,const char *WeaponName,const char *SelectWeapon);
};


But there you go beings you are so picky, a version that checks for ammo and does not give you a beacon if its empty, in addition, it does potentially 3,599 less useless checks in a 30 minute game per player in zone.

I will admit I did not really read though your original post, and though you called the timer originally from created instead of entered.

And yours still can crash the fds if the player/entering object has no weapon.
And will fail to do anything if they are not holding the beacon, and if they are the server can crash when it removes the beacon.

Also, if you could time jumping or walking in and out of the zone you could set off multiple copies of the timer that slowly flooding the server with more and more pointless checks.

Finally, your script doesn't deactivate after a certain amount of time, which was rather the point of this thread in the first place...


[Updated on: Wed, 10 August 2011 22:16]

Report message to a moderator

Re: How to Turn the Ped on after a specific time [message #451244 is a reply to message #446321] Thu, 11 August 2011 06:45 Go to previous messageGo to next message
iRANian is currently offline  iRANian
Messages: 4308
Registered: April 2011
Karma: 0
General (4 Stars)
It's impossible to crash the FDS or set off multiple timers when the time runs every 0.1 seconds but okay. My script checks if the guy has the beacons before doing anything so it can't crash when they don't have any weapons, unless there's an issue with Get_Total_Bullets().

The deactivating is easy to add with a second script that destroys the zone object after an hour, or by using 1 as the timer number number and in ::Timer_Expired() do a check if the number is 1 else do the code I shown, when the timer is 1 use Destroy_Script().

How does the script zone logic handle people dying while inside them, does it trigger ::Exited() and if it does, it trigger it before or after respawning?


Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases
Re: How to Turn the Ped on after a specific time [message #451261 is a reply to message #451244] Thu, 11 August 2011 11:12 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3809
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
iRANian wrote on Thu, 11 August 2011 07:45

It's impossible to crash the FDS or set off multiple timers when the time runs every 0.1 seconds but okay.

Course timers won't crash FDS, I'm just trying to point out that its more efficient to use two 128 length arrays (for a total of 0.000244140625 megabytes of ram usage) rather than have the CPU do a bunch of unnecessary work that can simply be avoided by using a function that triggers on exactly what you want. In addition, if the code was complex enough inside these timer calls it could bog down the FDS (granted this isn't even close to being able to do that, but I'm just trying to make a point).

iRANian wrote on Thu, 11 August 2011 07:45


My script checks if the guy has the beacons before doing anything so it can't crash when they don't have any weapons


When you call this code.
const char* currentweapon = Get_Current_Weapon(checkplayerobj);
			if (strcmp(currentweapon, "CnC_Weapon_NukeBeacon_Player") == 0

It Get_Current_Weapon gets what weapon your currently holding, you need to check if currentweapon is null before you use it otherwise stricmp will crash (guess I'm not sure about strcmp but I'd assume it's the same beings stricmp is built off of it). Furthermore, if you aren't holding a beacon (which is what your checking for (note, !_stricmp = match, _stricmp = different, and yes I know that might seem backward when you think of logical comparisons, but that's how it works)) so if you don't have a beacon in your hands, it won't be removed. Thus, the only time it can be removed is when you switch it into your hands, at which point you'll be left with empty hands, and from my experience that does a pretty good job crashing the server. The easy way to fix this is by switching to another gun if the player is currently holding the weapon you want to remove before you remove it, if they aren't holding it you just remove it like normal.
iRANian wrote on Thu, 11 August 2011 07:45


unless there's an issue with Get_Total_Bullets().


I'm pretty sure its fine, I just do the has weapon check out of habit. Pretty sure if you don't have the weapon it returns 0 just fine.

iRANian wrote on Thu, 11 August 2011 07:45


The deactivating is easy to add with a second script that destroys the zone object after an hour, or by using 1 as the timer number number and in ::Timer_Expired() do a check if the number is 1 else do the code I shown, when the timer is 1 use Destroy_Script().

Beings you're not using player ID's for zone enter you definitely could do it that way, but by not checking if it's a star that entered, or grabbing the ID of their enterer, you risk applying this script to every object that enters the zone (whether it be Human, vehicle, or an object attached to a human/vehicle). Also, you don't need to remove beacons before you grant them, beings they have a max ammo count of 1 you won't be able to give the player 2.

iRANian wrote on Thu, 11 August 2011 07:45


How does the script zone logic handle people dying while inside them, does it trigger ::Exited() and if it does, it trigger it before or after respawning?

When you die in a script zone you don't exit until your char is "Destroyed" (what happens after the fade effect). It happens right before destroyed is called, just like enter happens just after created is called if it's created inside a zone.


...
Although your code does have the potential to do something slightly different for the same result. Beings your script fires over and over again, instead of removing the players gun, you could check if they were holding a beacon, if they are you'd do something like this;
Commands->Select_Weapon(player,"");
Commands->Select_Weapon(player,"beaconName");

By doing that, the player keeps the beacon but can't use it. This is because when you switch between nothing and then to a weapon it triggers the exited/enter sequences of the beacon which means you have to wait the weapon switch time before you can use it; beings your script keeps firing, you'd never be able to use it while in the zone.

Note: You'd only want to call that code if they already hand the beacon in their hands, obviously, you don't want to force switch them to the beacon if they aren't holding it.
Note: If you did do it that way, make sure the empty select is always called first and immanently following by a select with a weapon, otherwise the games code has time to jump across a player with no weapon, and once again, that seems to make the game like to crash.


Re: How to Turn the Ped on after a specific time [message #451262 is a reply to message #451261] Thu, 11 August 2011 11:15 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3809
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
Although... we're all thinking too hard about this, all you really do is get the id's of the beacon zones and move them off the map, then when a timer expires you place them back on the map.

Re: How to Turn the Ped on after a specific time [message #451263 is a reply to message #446321] Thu, 11 August 2011 11:24 Go to previous messageGo to next message
iRANian is currently offline  iRANian
Messages: 4308
Registered: April 2011
Karma: 0
General (4 Stars)
With the Get_Total_Bullets() check I don't restart the timer if the guy if the guy doesn't have any of the beacons, or if the ammo count for it is zero.

The reason the timer repeats every 0.1 secs is because the FDS crashes when the beacon is being deployed while you remove it, I'll take a look if your Select_Weapon() method works with a timer that repeats every 1, 2 or 3 seconds, which'll mean that the performance penalty is greatly reduced.

Most standard libraries implements stricmp() as doing upper-casing for both string and then applying strcmp().


Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases

[Updated on: Thu, 11 August 2011 11:26]

Report message to a moderator

Re: How to Turn the Ped on after a specific time [message #451266 is a reply to message #451263] Thu, 11 August 2011 11:45 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3809
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
iRANian wrote on Thu, 11 August 2011 12:24

With the Get_Total_Bullets() check I don't restart the timer if the guy if the guy doesn't have any of the beacons, or if the ammo count for it is zero.


You need to stop updating your code, its just making a confusing mess out of this discussion, it was 0.5, removing and granting the weapon still doesn't get around the crash as if the player is holding it they get left holding nothing, you have to do a select before you remove a weapon they are holding.

iRANian wrote on Thu, 11 August 2011 12:24


The reason the timer repeats every 0.1 secs is because the FDS crashes when the beacon is being deployed while you remove it.


You can remove any weapon, even if its being deployed, as long as you select another weapon first, only issue is if you switch and then remove a weapon while the player is scoping, then they are stuck in scope until they get a weapon that has a scope.

iRANian wrote on Thu, 11 August 2011 12:24


I'll take a look if your Select_Weapon() method works with a timer that repeats every 1, 2 or 3 seconds, which well mean that the performance penalty is greatly reduced.

It does, but you are going to have to do it faster than 3 seconds for sure, play rp2, it fires that code off while swimming more than 10 times a second. I would say you could even do it 100 times a second if you like, but 0.01 doesn't' actually time to be that...

iRANian wrote on Thu, 11 August 2011 12:24


Most standard libraries implements stricmp() as doing upper-casing for both string and then applying strcmp().

Which just means it doesn't check for null strings and tries to compare the first char of both strings even if one is null.


In the end, the best way to do this is still move the beacon zones off the map and not interfere with the player at all.


Re: How to Turn the Ped on after a specific time [message #451270 is a reply to message #446321] Thu, 11 August 2011 12:56 Go to previous messageGo to next message
iRANian is currently offline  iRANian
Messages: 4308
Registered: April 2011
Karma: 0
General (4 Stars)
Well if the guy can actually start deploying the beacon, it will crash the FDS if you switch his weapon or use your "safely remove weapon" code once the beacon is deployed. :/

I'm looking for a method that can stop the beacon deploy process so I can run this script every 3 seconds.



Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases
Re: How to Turn the Ped on after a specific time [message #451273 is a reply to message #451270] Thu, 11 August 2011 13:28 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3809
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
iRANian wrote on Thu, 11 August 2011 13:56

Well if the guy can actually start deploying the beacon, it will crash the FDS if you switch his weapon or use your "safely remove weapon" code once the beacon is deployed. :/

I'm looking for a method that can stop the beacon deploy process so I can run this script every 3 seconds.



Incorrect I've done it plenty; only thing you have to watch out for is the beacon gets returned to your inventory if you remove it and then move if it's in process of being deployed.

If it's crashing it's because you're not switching before and after the remove to an existing weapon in your inventory.

I strongly recommend testing your code before you start telling me how mine works.

And we're still way off topic, best way to make a timed no beacons script is simply move the script zones off the map, then replace them onto the map beacon place time+beacon strike time after the time when beacon zones are enabled.


Re: How to Turn the Ped on after a specific time [message #451275 is a reply to message #446321] Thu, 11 August 2011 14:08 Go to previous messageGo to next message
iRANian is currently offline  iRANian
Messages: 4308
Registered: April 2011
Karma: 0
General (4 Stars)
How amazing it might seem I did test the code, the reason it was crashing is because the FDS apparently crashes when a beacon gets deployed inside a Script_Zone_Star, but it doesn't when deployed in a Script_Zone_All. :/ Which I just found out.

Knowing this I can use the switch weapon method you recommended every 0.5 seconds. I was looking for another method because of the crash issue with what I have now, not knowing it's because of the scriptzone type I was using.


Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases
Re: How to Turn the Ped on after a specific time [message #451302 is a reply to message #446321] Thu, 11 August 2011 22:30 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3809
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
I suggest you read my previous point about making sure you check that the entering object is a star, followed by the rest of my suggestions and points.

Or in further detail, crash is occurring because the beacon enters the zone on create, your script fires and starts a timer with the beacon id, beings you don't check and make sure the weapon string isn't null (and it is going to be as a beacon has no weapon) it attempts to make the comparison and the server dies.



[Updated on: Thu, 11 August 2011 22:33]

Report message to a moderator

Re: How to Turn the Ped on after a specific time [message #451303 is a reply to message #446321] Thu, 11 August 2011 22:37 Go to previous messageGo to next message
iRANian is currently offline  iRANian
Messages: 4308
Registered: April 2011
Karma: 0
General (4 Stars)
I replaced the code for the script with nothing nd it still happened, even with star zones without scripts on them, but if you use Script_Zone_All with the same script, it works. (I set the timer to 3.0 seconds so it will always crash because you can deploy the beacon). So it is indeed a bug in the fds that causes it to happen.

Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases
Re: How to Turn the Ped on after a specific time [message #451308 is a reply to message #451303] Thu, 11 August 2011 22:48 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3809
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
Odd, the code I showed works fine in rp2, guess in the end its easiest to just move the beacon zone off the map, then put it back on the map once you allow game win by ped.

Re: How to Turn the Ped on after a specific time [message #451309 is a reply to message #446321] Thu, 11 August 2011 22:52 Go to previous messageGo to next message
iRANian is currently offline  iRANian
Messages: 4308
Registered: April 2011
Karma: 0
General (4 Stars)
Yeah, indeed. I couldn't even imagine it crashing the FDS for some reason, which is why I thought why your switching weapons method crashes the FDS when you put the timer higher, which is NOT the case. That weapon selecting idea works really great and I'm using it for my beaconing prevention script for the server-side map fixes pack I'm working on.

Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases

[Updated on: Thu, 11 August 2011 22:53]

Report message to a moderator

Re: How to Turn the Ped on after a specific time [message #451311 is a reply to message #451309] Thu, 11 August 2011 23:23 Go to previous message
Jerad2142 is currently offline  Jerad2142
Messages: 3809
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
iRANian wrote on Thu, 11 August 2011 23:52

Yeah, indeed. I couldn't even imagine it crashing the FDS for some reason, which is why I thought why your switching weapons method crashes the FDS when you put the timer higher, which is NOT the case. That weapon selecting idea works really great and I'm using it for my beaconing prevention script for the server-side map fixes pack I'm working on.

I still recommend finding the beacon zones by name and then moving them up 100, then back down 100 when the timer expires; that way it wouldn't matter if they were placed on the ped until timer expired. However, as long as you have found something that works for you and the people that play on your server that's really all that matters.


Previous Topic: Need someone familiar with vehicle boning
Next Topic: Having some issues modifying the Airstrip waypoints serverside
Goto Forum:
  


Current Time: Sat Nov 09 06:04:45 MST 2024

Total time taken to generate the page: 0.01180 seconds