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

( L4D2 ) help with witch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
edwinvega86
Senior Member
Join Date: Feb 2016
Old 03-22-2018 , 05:51   ( L4D2 ) help with witch
Reply With Quote #1

I have an intense headache, how could a witch be created 1 or 2 steps from the player, I try barios methods but always appears in the player's sight, also and tried to use Position I can not understand Float: pos Float: ang .

reviewed.

https://forums.alliedmods.net/showthread.php?t=166356

I did many tests but without result
maybe this is very easy for other users but I already have a week tried, my only opsion is to ask for help, forgive my english.

Any help is appreciated

Last edited by edwinvega86; 03-22-2018 at 06:07.
edwinvega86 is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 03-22-2018 , 12:36   Re: ( L4D2 ) help with witch
Reply With Quote #2

Have a look https://forums.alliedmods.net/showthread.php?p=1471101

Edit: oh you don't want it in the players sight? Spawn behind them? I guess you want the witch to spawn randomly like special infected? Isn't there a console command for that z_spawn witch ? Come to think of it, I probably use: https://forums.alliedmods.net/showthread.php?p=751952 so have a look at that.
__________________

Last edited by Silvers; 03-22-2018 at 15:06.
Silvers is offline
edwinvega86
Senior Member
Join Date: Feb 2016
Old 03-24-2018 , 20:40   Re: ( L4D2 ) help with witch
Reply With Quote #3

Gracias silver
Quote:
#include <sdktools_functions>

public OnPluginStart()
{
RegConsoleCmd("sm_Witch", sm_Witch);
}

public Action:sm_Witch(client,args)
{
SpawnWitch(client);
}
SpawnWitch(client)
{
new Float:pos[3];
new Float:ang[3];
new Float:t[3];
SetVector(pos, -5.0, 32.0, 0.0);
SetVector(ang, 0.0, 0.0, 90.0);
GetClientAbsOrigin(client, pos);
GetClientEyeAngles(client, ang);
ang[0]=0.0;
GetAngleVectors(ang, t, NULL_VECTOR,NULL_VECTOR);
NormalizeVector(t, t);
ScaleVector(t, 90.0);
AddVectors(pos, t, pos);

GetClientEyeAngles(client, t);
t[0]=0.0;
t[1]+=90.0;
{
new ent=CreateEntityByName("witch");
DispatchSpawn(ent);
TeleportEntity(ent, pos, NULL_VECTOR, NULL_VECTOR);
}
}
SetVector(Float:target[3], Float, Float:y, Float:z)
{
target[0]=x;
target[1]=y;
target[2]=z;
}
this generate barias witch on the map c11m5_runway but I do not understand why the witch dies on the c8m5_rooftop map after 1 second, any help or idea?
edwinvega86 is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 03-25-2018 , 06:08   Re: ( L4D2 ) help with witch
Reply With Quote #4

z_spawn witch on c8m5 works for me. I guess other methods should too. Maybe plugin conflict or some error while creating the witch, keep trying.
__________________
Silvers is offline
epilimic
Junior Member
Join Date: Feb 2013
Old 04-12-2018 , 22:19   Re: ( L4D2 ) help with witch
Reply With Quote #5

This is a plugin that we made for Witch Party. It spawns 3 witches in random spots surrounding you when you defib a player.

@Silvers you need to use z_spawn_old for witches now, that changed (I think) when the steampipe update happened a couple years back.

PHP Code:
#include <sourcemod>
#include <sdktools>

public Plugin:myinfo =
{
name "Defib witches",
author "epilimic, purpletreefactory",
description "Spawns witches in random points on a circle around the survivors when a defib is used.",
version "1",
url "http://github.com/epilimic"
}

new 
Handle:dw_numwitches;
new 
Handle:dw_spawnradius;

public 
OnPluginStart()
{
HookEvent("defibrillator_used"Event_Defib);
dw_numwitches CreateConVar("dw_numwitches""3""Number of witches to spawn when a defib is used.");
dw_spawnradius CreateConVar("dw_spawnradius""100""Radius of the circle in which witches spawn.");
}

public 
Action:Event_Defib(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
numWitches 0;
    new 
Float:PI 3.14159265359;
    new 
Float:proxVal 0.21;
    new 
zChg 10;
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    new 
Float:survivorPos[3];
    new 
Float:pos[3];
    new 
Float:randomVals[3];
    
GetClientAbsOrigin(clientsurvivorPos);
    for(new 
03i++) // generate 3 random floats for witch positions
    
{
        new 
Float:tmp;
        new 
valid = -1;
        while(
valid == -1// Check the proximity of the random value against previously generated values
        
{
            
tmp GetRandomFloat(0.02.0*PI);
            
valid 0;
            for(new 
0ij++)
            {
                if(
FloatAbs(tmp randomVals[j]) < proxVal || (2*PI FloatAbs(tmp randomVals[j])) < proxVal)
                    
valid = -1;
            }
        }
        
randomVals[i] = tmp;
    }
    while (
numWitches <= GetConVarInt(dw_numwitches))
    {
        
pos[0] = survivorPos[0] + Sine(randomVals[numWitches]) * GetConVarInt(dw_spawnradius);
        
pos[1] = survivorPos[1] + Cosine(randomVals[numWitches]) * GetConVarInt(dw_spawnradius);
        
pos[2] = survivorPos[2] + zChg;
        new 
ent=CreateEntityByName("witch");
        
DispatchSpawn(ent);
        
//PrintToChatAll("witch #%d, %f, %f, %f", numWitches, pos[0], pos[1], pos[2]);
        
TeleportEntity(entposNULL_VECTORNULL_VECTOR);
        
numWitches++;
    }
    return 
Plugin_Continue;

epilimic is offline
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 16:46.


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