Raised This Month: $ Target: $400
 0% 

Restart Round? [Solved]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 11-21-2007 , 18:41   Restart Round? [Solved]
Reply With Quote #1

In both Counter-Strike and Day of Defeat, restarting the round not only respawns all players (and resets flags in dod) but it also resets all entities.

This includes func_breakables, and other triggers in the map that were set off. These all return to their default state on round restarting.

Does anyone know how to achieve this without restarting the round through a console command, which would also respawn everyone?


I have tried looping through all entities and executing hamsandwich's Ham_DOD_RoundRespawn, but the plugin dies mid-loop and doesn't make it to the echo. When I perform it on an individual func_breakable, it makes it to the echo but nothing happens to the entity at all.

Code:
    static maxents;     maxents = global_get( glb_maxEntities );             for( new i = 1; i < maxents; i++ )         if( pev_valid(i) ) ExecuteHam( Ham_DOD_RoundRespawn, i );             console_print( id, "Reset All %i Entities", maxents );

One thing I did notice was that a func_breakable's pev_health is set to 100.0 or 150.0 before it is broken, when it is set to 0.0 or negative, depending on the damage done to it. In addition, after it "breaks," its pev_deadflag is set to 2. I have tried setting the health back to 100.0 and the deadflag back to 0 and using DLLFunc_Spawn on it, but all that happens is I can no longer walk through it - but there is no window there, visually.


Thanks in advance gents.
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician

Last edited by Wilson [29th ID]; 11-22-2007 at 11:35.
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 11-22-2007 , 05:50   Re: Restart Round?
Reply With Quote #2

You did call Ham_DOD_RoundRespawnEnt, and not Ham_DOD_RoundRespawn, right?

The include file has it listed as Ham_DOD_RoundRespawn in the "Execute Params" but I suspect a typo.

I would assume it started the loop (and happily called RoundRespawn on the first 32 player ents) and then died when it hit a real ent.

Otherwise, I can't really help - sadly I have absolutely no time to do anything fun / investigative with AMX ... I can only write what I know how to do, as I cannot test anything.
(Coding at work ;-) )

Last edited by purple_pixie; 11-22-2007 at 05:53.
purple_pixie is offline
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 11-22-2007 , 09:32   Re: Restart Round?
Reply With Quote #3

It's amazing what a bloody typo can do to you.

I was so aware of the differences in these two...I guess I copied and pasted or something..not sure how this one slipped by.

Well, respawning an ent works perfectly now that I added "Ent" to the end. The problem is, the loop still doesn't work.

Code:
    static maxents;     maxents = global_get( glb_maxEntities );             for( new i = 1; i < maxents; i++ )         if( pev_valid(i) && !is_user_connected(i) ) ExecuteHam( Ham_DOD_RoundRespawnEnt, i );             console_print( id, "Reset All %i Entities", maxents );

It still never gets to the echo. I added the is_user_connected to make sure it wasn't a player.

Is there any way to check if the entity is a map-entity that is supposed to be respawned? Or another check I can do so that this loop works?
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician

Last edited by Wilson [29th ID]; 11-22-2007 at 09:45.
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-22-2007 , 10:05   Re: Restart Round?
Reply With Quote #4

spawnflags ?

Also you can start to loop at maxplayers + 1
ConnorMcLeod is offline
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 11-22-2007 , 10:11   Re: Restart Round?
Reply With Quote #5

Step one would be to put in:

"Attempting Respawn on ent %i ( %s )",ent,classname
execute_ham()
"Success"

So at least you know where it crashes.

Then you can look what's special about that first ent it didn't do, and maybe work out why.
purple_pixie is offline
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 11-22-2007 , 11:36   Re: Restart Round? [Solved]
Reply With Quote #6

Thanks conorr, I started at maxplayers+1 and the loop works fine.
I was about to do what you suggested purple_pixie, but then...it worked

Thanks again for the help guys.
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode