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

[TF2 & L4D & L4D2] Actions


Post New Thread Reply   
 
Thread Tools Display Modes
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
Old 05-30-2022 , 06:50   Re: [L4D & L4D2] Actions
Reply With Quote #41

sm 1.10 compile error

Code:
include\actions.inc(319) : error 092: number of arguments does not match definition
PHP Code:
319StoreToAddress(view_as<Address>(this) + view_as<Address>(offset), datatypeupdateMemAccess); 
__________________

Last edited by HarryPotter; 05-30-2022 at 06:53.
HarryPotter is offline
BHaType
Great Tester of Whatever
Join Date: Jun 2018
Old 05-30-2022 , 21:38   Re: [L4D & L4D2] Actions
Reply With Quote #42

Quote:
Originally Posted by HarryPotter View Post
Code:
include\actions.inc(319) : error 092: number of arguments does not match definition
Thanks, fixed.

Updated
PHP Code:
Fixed compilation error for SourceMod version 11.0 
__________________
cry

Last edited by BHaType; 05-30-2022 at 21:38.
BHaType is offline
Send a message via AIM to BHaType
jackz
Junior Member
Join Date: Oct 2019
Old 07-27-2022 , 00:23   Re: [L4D & L4D2] Actions
Reply With Quote #43

I'm trying to convert the witch force attack command you had made for your old l4d2_behavior plugin to this, but I'm not seeing an easy way to do it, as I want to do it on demand and not based on an event.

I got it kind of working but depending on the witch's current action it would not find the action (ActionsManager.GetAction returns INVALID_ACTION), or it would work but then the witch would be stuck on WitchExecAction forever and is unkillable.

In addition, the plugin had gamedata for WitchAttack but behavior doesn't, would I still need that?

Code: https://gist.github.com/Jackzmc/c12b...b28b127005d6b9
__________________
jackz is offline
BHaType
Great Tester of Whatever
Join Date: Jun 2018
Old 07-27-2022 , 02:25   Re: [L4D & L4D2] Actions
Reply With Quote #44

Quote:
Originally Posted by jackz View Post
I'm trying to convert the witch force attack command you had made for your old l4d2_behavior plugin to this, but I'm not seeing an easy way to do it, as I want to do it on demand and not based on an event.

I got it kind of working but depending on the witch's current action it would not find the action (ActionsManager.GetAction returns INVALID_ACTION), or it would work but then the witch would be stuck on WitchExecAction forever and is unkillable.

Code: https://gist.github.com/Jackzmc/c12b...b28b127005d6b9
Whenever witch spawn her first action is WitchExecAction which creates WitchBehavior which creates WitchIdle/WitchWander (depends on sv_force_time_of_day and witch_force_wander convars) and so on. WitchExecAction and WitchBehavior are her first actions and they are handling her fire and death states you should never change or suspend them until you really want it.

So this is witch actions when she spawned:
WitchExecAction -> WitchBehavior -> WitchIdle/WitchWander/WitchAttack/...

As you can see the best way is to always get next action after WitchBehavior.
You can easily do this by using action child property.
PHP Code:
BehaviorAction GetBestSuspendable(int witch)
{
    
BehaviorAction action ActionsManager.GetAction(witch"WitchBehavior");
    return 
action.Child;

or you can change only specific actions. Check code below.
code


One more note about StorePendingEventResult. I highly recommend to don't use it until next version because for now it keeps default purpose and stores new result without propagating to other actions this can lead to the loss of actions.

Quote:
Originally Posted by jackz View Post
In addition, the plugin had gamedata for WitchAttack but behavior doesn't, would I still need that?
You need gamedata otherwise you won't be able to call the WitchAttack constructor.
__________________
cry
BHaType is offline
Send a message via AIM to BHaType
jackz
Junior Member
Join Date: Oct 2019
Old 07-27-2022 , 13:05   Re: [L4D & L4D2] Actions
Reply With Quote #45

Thanks, I was just looking at ext_actions_dump but didn't realize they were a hierarchically.

Works great now, thanks for explaining it.
__________________
jackz is offline
BHaType
Great Tester of Whatever
Join Date: Jun 2018
Old 08-24-2022 , 20:16   Re: [L4D & L4D2] Actions
Reply With Quote #46

Updated
PHP Code:
Added Team Fortress 2 support
Added contextual query hooks
Added natives to effectively change event result
Added new convars
Added new commands
Fixed string type args for event handlers
Fixed OnEnteredSpit event handler
Changed StorePendingEventResult to propagate result but it still doesn't respect result priority
- Changed from hardcoded offsets to use gamedata 
__________________
cry
BHaType is offline
Send a message via AIM to BHaType
L4D2Noob
AlliedModders Donor
Join Date: Mar 2020
Location: Moscow
Old 08-25-2022 , 02:21   Re: [TF2 & L4D & L4D2] Actions
Reply With Quote #47

Code:
[06] <FAILED> file "actions.ext.2.l4d2.so": /game/left4dead2/addons/sourcemod/extensions/actions.ext.2.l4d2.so: undefined symbol: _ZSt24__throw_out_of_range_fmtPKcz
__________________
L4D2Noob is offline
Send a message via ICQ to L4D2Noob Send a message via Skype™ to L4D2Noob
BHaType
Great Tester of Whatever
Join Date: Jun 2018
Old 08-25-2022 , 04:50   Re: [TF2 & L4D & L4D2] Actions
Reply With Quote #48

Updated
PHP Code:
Fixed linux link error (Thanks to L4D2Noob for report
__________________
cry
BHaType is offline
Send a message via AIM to BHaType
Gazyi
Junior Member
Join Date: Apr 2016
Old 08-25-2022 , 15:29   Re: [TF2 & L4D & L4D2] Actions
Reply With Quote #49

Thanks for extension and TF2 support update.
I've tried to port TF2 version of extension to Insurgency. I guess, their NextBots are based on TF2 version because they have all same functions and offsets as TF2 one, but there's also some INS specific actions. However, server crashes because "OnIntentionReset" function loops and stack overflows.

Code:
 	actions.ext.2.insurgency.dll!OnIntentionReset()Line 27	C++
 	actions.ext.2.insurgency.dll!fastdelegate::FastDelegate<void>::InvokeStaticFunction()Line 968	C++
 	actions.ext.2.insurgency.dll!fastdelegate::FastDelegate<void>::operator()()Line 928	C++
 	actions.ext.2.insurgency.dll!__SourceHook_MFHCls_OnIntentionReset::CMyDelegateImpl::Call()Line 7	C++
 	actions.ext.2.insurgency.dll!__SourceHook_MFHCls_OnIntentionReset::Func()Line 7	C++
Any ideas what's cause that? Or maybe you have plans for adding INS and DOI support?

Here's gamedata. The address and signatures are based on what I've seen in TF2 gamedata.
Code:
"Games"
{
	"#default"
	{
		"Offsets"
		{
			"Destructor"
			{
				"linux" "1"
				"windows" "0"
			}
		}
	}
	
	"insurgency"
	{
		"Offsets"
		{
			"IIntention::Reset"
			{
				"linux" "46"
				"windows" "45"
			}
			
			// IIntention offsets?
			"ShouldPickUp"
			{
				"linux" "2"
				"windows" "1"
			}
			"ShouldHurry"
			{
				"linux" "3"
				"windows" "2"
			}
			"ShouldRetreat"
			{
				"linux" "4"
				"windows" "3"				
			}
			"ShouldAttack"
			{
				"linux" "5"
				"windows" "4"				
			}			
			"IsHindrance"
			{
				"linux" "6"
				"windows" "5"
			}
			"SelectTargetPoint"
			{
				"linux" "7"
				"windows" "6"
			}
			"IsPositionAllowed"
			{
				"linux" "8"
				"windows" "7"
			}
			"SelectMoreDangerousThreat"
			{
				"linux" "9"
				"windows" "8"
			}
			"ShouldWalk"
			{
				"linux" "10"
				"windows" "9"
			}
			"ShouldIronsight"
			{
				"linux" "11"
				"windows" "10"
			}
			"ShouldProne"
			{
				"linux" "12"
				"windows" "11"
			}
			"ShouldPursue"
			{
				"linux" "13"
				"windows" "12"
			}

			// MainAction offsets
			"OnStart"
			{
				"linux" "49"
				"windows" "48"
			}
			"Update"
			{
				"linux" "50"
				"windows" "49"
			}
			"OnEnd"
			{
				"linux" "51"
				"windows" "50"
			}
			"OnSuspend"
			{
				"linux" "52"
				"windows" "51"
			}
			"OnResume"
			{
				"linux" "53"
				"windows" "52"
			}
			"InitialContainedAction"
			{
				"linux" "54"
				"windows" "53"
			}
			"OnLeaveGround"
			{
				"linux" "55"
				"windows" "54"
			}
			"OnLandOnGround"
			{
				"linux" "56"
				"windows" "55"
			}
			"OnContact"
			{
				"linux" "57"
				"windows" "56"
			}
			"OnMoveToSuccess"
			{
				"linux" "58"
				"windows" "57"
			}
			"OnMoveToFailure"
			{
				"linux" "59"
				"windows" "58"
			}
			"OnStuck"
			{
				"linux" "60"
				"windows" "59"
			}
			"OnUnStuck"
			{
				"linux" "61"
				"windows" "60"
			}
			"OnPostureChanged"
			{
				"linux" "62"
				"windows" "61"
			}
			"OnAnimationActivityComplete"
			{
				"linux" "63"
				"windows" "62"
			}
			"OnAnimationActivityInterrupted"
			{
				"linux" "64"
				"windows" "63"
			}
			"OnAnimationEvent"
			{
				"linux" "65"
				"windows" "64"
			}
			"OnIgnite"
			{
				"linux" "66"
				"windows" "65"
			}
			"OnInjured"
			{
				"linux" "67"
				"windows" "66"
			}
			"OnKilled"
			{
				"linux" "68"
				"windows" "67"
			}
			"OnOtherKilled"
			{
				"linux" "69"
				"windows" "68"
			}
			"OnSight"
			{
				"linux" "70"
				"windows" "69"
			}
			"OnLostSight"
			{
				"linux" "71"
				"windows" "70"
			}
			"OnSound"
			{
				"linux" "72"
				"windows" "71"
			}
			"OnSpokeConcept"
			{
				"linux" "73"
				"windows" "72"
			}
			"OnWeaponFired"
			{
				"linux" "74"
				"windows" "73"
			}			
			"OnNavAreaChanged"
			{
				"linux" "75"
				"windows" "64"
			}
			"OnModelChanged"
			{
				"linux" "76"
				"windows" "75"
			}
			"OnPickUp"
			{
				"linux" "77"
				"windows" "76"
			}
			"OnDrop"
			{
				"linux" "78"
				"windows" "77"
			}
			"OnActorEmoted"
			{
				"linux" "79"
				"windows" "78"
			}			
			"OnShoved"
			{
				"linux" "87"
				"windows" "86"
			}
			"OnBlinded"
			{
				"linux" "88"
				"windows" "87"
			}
			"OnCommandAttack"
			{
				"linux" "80"
				"windows" "79"
			}
			"OnCommandApproachVector"
			{
				"linux" "81"
				"windows" "81"
			}
			"OnCommandApproachEntity"
			{
				"linux" "82"
				"windows" "80"
			}
			"OnCommandRetreat"
			{
				"linux" "83"
				"windows" "82"
			}
			"OnCommandPause"
			{
				"linux" "84"
				"windows" "83"
			}
			"OnCommandResume"
			{
				"linux" "85"
				"windows" "84"
			}
			"OnCommandString"
			{
				"linux" "86"
				"windows" "85"
			}
			"IsAbleToBlockMovementOf"
			{
				"linux" "97"
				"windows" "96"
			}
			"OnTerritoryContested"
			{
				"linux" "89"
				"windows" "88"
			}
			"OnTerritoryCaptured"
			{
				"linux" "90"
				"windows" "89"
			}
			"OnTerritoryLost"
			{
				"linux" "91"
				"windows" "90"				
			}
			"OnWin"
			{
				"linux" "92"
				"windows" "91"				
			}
			"OnLose"
			{
				"linux" "93"
				"windows" "92"				
			}
			"OnHeardFootsteps"
			{
				"linux" "94"
				"windows" "93"				
			}
			"OnSeeSomethingSuspicious"
			{
				"linux" "95"
				"windows" "94"				
			}
			"OnOrderReceived"
			{
				"linux" "96"
				"windows" "95"				
			}	
		}
		"Addresses"
		{
			"CINSNextBot::CINSNextBotIntention::Reset"
			{	
				"signature" "CINSNextBot::CINSNextBotIntention::Reset"
				"linux"
				{
					"offset" "8"
				}
				"windows"
				{
					"read" "4"
				}
			}
		}
		"Signatures"
		{
			"CINSNextBot::CINSNextBotIntention::Reset"
			{
				// first xref to "const CINSNextBot::CINSNextBotIntention::`vftable'"
				// push 	50h
				// mov 		dword ptr [esi], offset ??_7CINSNextBotIntention@CINSNextBot@@6B@
				// 6A 50 C7 06 F8 F3 54 10 C7 46
				"windows" "\x6A\x50\xC7\x06\xF8\xF3\x2A\x2A\xC7\x46"
				"linux" "@_ZN11CINSNextBot20CINSNextBotIntentionC2EPS_"
			}
		}
	}
}

Last edited by Gazyi; 08-25-2022 at 17:20.
Gazyi is offline
BHaType
Great Tester of Whatever
Join Date: Jun 2018
Old 08-28-2022 , 04:42   Re: [TF2 & L4D & L4D2] Actions
Reply With Quote #50

Quote:
Originally Posted by Gazyi View Post
Thanks for extension and TF2 support update.
I've tried to port TF2 version of extension to Insurgency. I guess, their NextBots are based on TF2 version because they have all same functions and offsets as TF2 one, but there's also some INS specific actions. However, server crashes because "OnIntentionReset" function loops and stack overflows.
Any ideas what's cause that? Or maybe you have plans for adding INS and DOI support?
For now I don't plan to add support for INS or DOI, maybe someday. As for crash, it could be anything. I suggest to debug Intention interface to be sure you are hooking right function.
__________________
cry
BHaType is offline
Send a message via AIM to BHaType
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:46.


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