Raised This Month: $32 Target: $400
 8% 

[L4D2] Detect first and last map of campaign?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 01-08-2018 , 21:12   [L4D2] Detect first and last map of campaign?
Reply With Quote #1

Title is pretty descriptive. I need a way to detect the first and last map of the campaign. Method would be used in a versus environment. Hardcoding the map names is not an option for me, as I run tons of custom maps.

Anyone got any ideas?
__________________
Spirit_12 is offline
xerox8521
Senior Member
Join Date: Sep 2011
Old 01-09-2018 , 08:15   Re: [L4D2] Detect first and last map of campaign?
Reply With Quote #2

You could try to get the return value of CDirector::IsFirstMapInScenario (_ZNK9CDirector20IsFirstMapInScenarioEv)

For last map maybe check for finale ? Though might be tricky if you have maps that have mutliple finales through out the campaign.

Edit: Found CTerrorGameRules::IsMissionFinalMap (_ZN16CTerrorGameRules17IsMissionFinalMapEv)

Last edited by xerox8521; 01-09-2018 at 08:23.
xerox8521 is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 01-09-2018 , 16:27   Re: [L4D2] Detect first and last map of campaign?
Reply With Quote #3

PHP Code:
CDirector::IsFirstMapInScenario(CDirector *__hidden this
Not sure what parameters to pass for CDirector members. This didn't work for me, but I'm a novice when it comes to SDK calls. Any help?

PHP Code:
If the call type is GameRulesthen nothing special needs to be passed
PHP Code:
handle hIsMissionFinalMap;
    
// Preparing SDK Call for IsFirstMapInScenario
hGameConf LoadGameConfigFile("sdkcalltest");
StartPrepSDKCall(SDKCall_GameRules);
PrepSDKCall_SetFromConf(hGameConfSDKConf_Signature"CTerrorGameRules::IsMissionFinalMap");
PrepSDKCall_SetReturnInfo(SDKType_BoolSDKPass_ByValue);
hIsFirstMapInScenarioEndPrepSDKCall();
if(
hIsMissionFinalMap== INVALID_HANDLE)
{
    
ThrowError("Failed to find CTerrorGameRules::IsMissionFinalMap signature.");
}

SDKCall(hIsMissionFinalMap
__________________

Last edited by Spirit_12; 01-09-2018 at 16:30.
Spirit_12 is offline
Vit_amin
Senior Member
Join Date: Dec 2015
Location: Russian Federation
Old 01-09-2018 , 19:49   Re: [L4D2] Detect first and last map of campaign?
Reply With Quote #4

Check info_changelevel || trigger_changelevel on map ? (For Finale)
Vit_amin is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 01-09-2018 , 20:33   Re: [L4D2] Detect first and last map of campaign?
Reply With Quote #5

Quote:
Originally Posted by Spirit_12 View Post
PHP Code:
CDirector::IsFirstMapInScenario(CDirector *__hidden this
Not sure what parameters to pass for CDirector members. This didn't work for me, but I'm a novice when it comes to SDK calls. Any help?
None. It takes no parameters. What you pasted from IDA is telling you it's a non-static member function.

Quote:
PHP Code:
If the call type is GameRulesthen nothing special needs to be passed
If you're calling a plain non-member function (or I guess a static member function), you just pass the parameters to SDKCall. If you're calling a normal member function, SM needs to know which thing to call it on. But when you call StartPrepSDKCall saying it's a game rules call, SM already knows what to do.
Fyren is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 01-09-2018 , 21:17   Re: [L4D2] Detect first and last map of campaign?
Reply With Quote #6

Quote:
Originally Posted by Vit_amin View Post
Check info_changelevel || trigger_changelevel on map ? (For Finale)
Would it work on all maps? Just checking, if some custom maps may have used some other triggers?

Quote:
Originally Posted by Fyren View Post
None. It takes no parameters. What you pasted from IDA is telling you it's a non-static member function.

If you're calling a plain non-member function (or I guess a static member function), you just pass the parameters to SDKCall. If you're calling a normal member function, SM needs to know which thing to call it on. But when you call StartPrepSDKCall saying it's a game rules call, SM already knows what to do.
In that case, how do I retrieve the return value? I would assume this sort of function would return a boolean value. How and where do I store that value?
__________________
Spirit_12 is offline
Timocop
AlliedModders Donor
Join Date: Mar 2013
Location: Germany
Old 01-09-2018 , 21:22   Re: [L4D2] Detect first and last map of campaign?
Reply With Quote #7

Why so complicated. May wanna add trigger_changelevel too tho.

PHP Code:
stock bool IsFinalMap()
{
    return (
FindEntityByClassname(-1"info_changelevel") == -1
                
&& FindEntityByClassname(-1"trigger_changelevel") == -1);


Last edited by Timocop; 01-09-2018 at 21:37. Reason: trigger_changelevel
Timocop is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 01-10-2018 , 15:16   Re: [L4D2] Detect first and last map of campaign?
Reply With Quote #8

Your method would work, but I want to learn SDK calls. Just not sure why it’s not working.
__________________
Spirit_12 is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 01-10-2018 , 16:52   Re: [L4D2] Detect first and last map of campaign?
Reply With Quote #9

Quote:
Originally Posted by Spirit_12 View Post
In that case, how do I retrieve the return value? I would assume this sort of function would return a boolean value. How and where do I store that value?
The return value of the function will be SDKCall's return value in cases where it's not a string/array.
Fyren is offline
Reply


Thread Tools
Display Modes

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 11:45.


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