STEAM GROUP
Left 4 Dead 2 Workshop Beta L4D2WSB
STEAM GROUP
Left 4 Dead 2 Workshop Beta L4D2WSB
2
IN-GAME
33
ONLINE
Founded
15 October, 2012
Showing 111-120 of 125 entries
75
VScript Suggestions
2
func_nav_blocker entity to block specific enemies.
75
VScript Suggestions
56
Request for Access to L4D2 Beta for New Members
75
VScript Suggestions
Originally posted by shotgunefx:
You can hook player_spawn, and also player_first_spawn. As far as usable props, most of the stuff that's new so far works in both regular campaigns and mutations, but in my tests, it "seems", not CanPickupObject(). Though you can just hook player_use and manage it that way.

Technically, we are not hooking a function unless we can modify or augment the outcome of the function. From what I've been told, we cannot modify the game event params (please confirm), but rather just "listen" for them.

Also, from what I can see in my modevents.res, there is no player_spawn, but there is a player_first_spawn, but I still have the older non-beta L4D2 installed. IMO, it's still not as solid as a hook to SurvivorBot::Spawn(), because I have seen instances where the event is never broadcasted (during my long hours of SM and HC modding). To prevent items from being picked up dynamically, I've always hooked CBaseEntity::Use(), and I have no idea if that can be done in EMS (maybe there is an alternative way or workaround, perhaps CanPickupObject). It would be helpful if Valve provided us modders with more hooks. For example, CTerrorPlayer::Weapon_CanUse(), NextBotPlayer<CTerrorPlayer>::Weapon_Equip(), SurvivorBot::Weapon_Switch() to name a few more. Again, there may be a workaround for these. I am just naming some that I have hooked in my c++ server plugin that I couldn't find with vscripts. Lastly, getting and setting netprops, e.g. sample function from my c++ valve server plugin (VSP):


static int GetEntityPropInt(lua_State* L) { OUTPUT_FUNC; edict_t* edict = CheckEntity(L, 1); if (!edict) { lua_pushnumber(L, -1); return 1; } CBaseEntity* ent = g_HCBase->EdictToBaseEntity(edict); if (!ent) { lua_pushnumber(L, -1); return 1; } IServerUnknown* pUnk = (IServerUnknown*)ent; IServerNetworkable* pNet = pUnk->GetNetworkable(); if (!pNet) { lua_pushnumber(L, -1); return 1; } char* prop = const_cast<char*>(luaL_checkstring(L, 2)); char* serverclass = const_cast<char*>(pNet->GetServerClass()->GetName()); int intval = g_HCBase->GetPropertyInt(serverclass, prop, edict); lua_pushnumber(L, intval); return 1; } int HammerCodeBase::GetPropertyInt(char* pClassname, char* pNetProp, edict_t* pEdict) { CBaseEntity* pEntity = EdictToBaseEntity(pEdict); if (!pEntity) return -1; int element = 0; int bit_count = 0; bool isDataMap = false; int size = 4; int offset = Base_FindOffset(pClassname, pNetProp, pEntity, &bit_count, &element, &isDataMap); if (!offset) return -1; bool is_unsigned = false; if (!isDataMap) { Vector data = GetBitCountData(pClassname, pNetProp, pEntity, offset); bit_count = data[0]; is_unsigned = (bool)data[3]; } // Credits for this last part go to SM if (bit_count < 1) bit_count = size * 8; if (bit_count >= 17) return *(int32_tr *)((uint8_tr *)pEntity + offset); else if (bit_count >= 9) { if (is_unsigned) return *(uint16_tr *)((uint8_tr *)pEntity + offset); else return *(int16_tr *)((uint8_tr *)pEntity + offset); } else if (bit_count >= 2) { if (is_unsigned) return *(uint8_tr *)((uint8_tr *)pEntity + offset); else return *(int8_tr *)((uint8_tr *)pEntity + offset); } else return *(bool *)((uint8_tr *)pEntity + offset) ? 1 : 0; }


I personally cannot think of any rational way of coding a function like that running off Squirrel VM :P It would be highly appreciated to have a method to modify netprops in our scripts. Maybe a wrapper function for IVEngineServer::UserMessageBegin() too! :)
14
Mutation: Tank Slayer
Showing 111-120 of 125 entries