AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Create wall (https://forums.alliedmods.net/showthread.php?t=20252)

Basic-Master 11-04-2005 16:10

Create wall
 
Hello,
how can you create custom walls (if possible without custom models)? I've already searched on the forums but didn't find anything about it (except 2 buggy plugins).
Thanks in advance

Batman/Gorlag 11-04-2005 17:34

Code:
new wall = create_entity("func_wall") //I suppose you can use a random number generator to get x, y,  and z to set sizes for the wall, then decide what model to use if a wall is of a particular size.... new Float:x, Float:y, Float:z new chooser = random_num(a, b) new someModel[] switch(chooser){    case a: x = x'   //Where x', y', and z' can be any arbitrary numbers               y = y'                z = z'                someModel = "whatever" /* You can add more to the list of what x, y, and z could be here and decide what model the wall should be. . . . . .     case b: blah     default: blah */ new Float:min[3] = {-x, -y, -z} new Float:max[3] = {x, y, z} entity_set_size(wall, min, max) //If you want the wall right in front of you new Float:someOrigin[3] entity_get_vector(id, EV_VEC_origin, someOrigin) //You can offset the origin here. new offset = 200  //Can be any number new Float:adjustPos[3] velocity_by_aim(id, offset, adjustPos)  //To offset the origin to place wall in front of you //This prevents the wall from spawning in the current position of the user and make it spawn farther away from the user. someOrigin[0] += adjustPos[0]   someOrigin[1] += adjustPos[1] someOrigin[2] += adjustPos[2] entity_set_origin(wall, someOrigin) entity_set_model(wall, someModel)

I hope that answers your question of making a custom wall. You can use any models in the .gcf files so that the user doesn't have to load up any models.

Or there's always hammer to make walls if you're making a map :wink: .

XxAvalanchexX 11-04-2005 19:45

Re: Create wall
 
Quote:

Originally Posted by Basic-Master
how can you create custom walls (if possible without custom models)?

The only way you can do it is to make an entity, make it solid, and give it a model to display over it. You can't create a real "wall" with amxx.

Basic-Master 11-05-2005 05:28

okay, thanks :)
but unfortunately I can't turn the wall with EV_VEC_angles (well the model turns but not the "basic" object you can collide with). here is my current function:
Code:
public cmdWall(id) {     new wall = create_entity("func_wall")     entity_set_model(wall, "models/wall.mdl") // I found it somewhere in the forums     // Set size and absmin+absmax values     new Float:mins[3]     mins = Float:{-100.0, -10.0, -75.0}     new Float:maxs[3]     maxs = Float:{100.0, -10.0, 75.0}     entity_set_vector(wall, EV_VEC_mins, mins)     entity_set_vector(wall, EV_VEC_maxs, maxs)     entity_set_vector(wall, EV_VEC_absmin, mins)     entity_set_vector(wall, EV_VEC_absmax, maxs)     // Turn model     new Float:vRetVector[3]     entity_get_vector(id, EV_VEC_v_angle, vRetVector)     vRetVector[0] = 0.0     entity_set_vector(wall, EV_VEC_angles, vRetVector)     // Get user origin     new Float:someOrigin[3]     entity_get_vector(id, EV_VEC_origin, someOrigin)     // You can offset the origin here.     new offset = 200     new Float:adjustPos[3]     velocity_by_aim(id, offset, adjustPos)     // This prevents the wall from spawning in the current position of the user and make it spawn farther away from the user.     someOrigin[0] += adjustPos[0]       someOrigin[1] += adjustPos[1]     someOrigin[2] += adjustPos[2]     entity_set_origin(wall, someOrigin)     // Set other values     entity_set_int(wall, EV_INT_solid, SOLID_BBOX)     entity_set_int(wall, EV_INT_movetype, MOVETYPE_FLY)     // zomg! }
and now I'm wondering.. what's wrong with it? :gyar:

Zenith77 11-05-2005 13:27

Code:
vRetVector[0] = 0.0


I dont get why you set the x angle to 0 ? Maybe thats problem....

XxAvalanchexX 11-05-2005 14:32

Correct, EV_VEC_angles will only change the model's angle. To actually rotate the wall to represent the change you will have to modify the mins/maxs and absmis/absmax. Good luck cacluating that one. ;-)

cTn 11-05-2005 14:59

common people ... this plugin can be moore bad and mega fun for admins on server ... someone go to A place on dust2 and whata hell? big wall blahahahhahah :D

Basic-Master 11-05-2005 15:10

okay I wrote a quite simple plugin, it could be useful and someone could convert it into a "real" plugin, here's the source:
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <engine> #define PLUGIN "Wall" #define VERSION "1.0" #define AUTHOR "Basic-Master" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("amx_wall", "cmdWall")     register_clcmd("amx_wallrotate", "cmdGaben") } public cmdWall(id) {     new wall = create_entity("func_wall")     entity_set_string(wall, EV_SZ_classname, "wall")     entity_set_model(wall, "models/wall.mdl") // I found it somewhere in the forums     // Set size and absmin+absmax values     new Float:mins[3]     new Float:maxs[3]     mins[0] = -90.0     mins[1] = -10.0     mins[2] = -20.0     maxs[0] = 90.0     maxs[1] = 10.0     maxs[2] = 75.0     entity_set_vector(wall, EV_VEC_mins, mins)     entity_set_vector(wall, EV_VEC_maxs, maxs)     entity_set_vector(wall, EV_VEC_absmin, mins)     entity_set_vector(wall, EV_VEC_absmax, maxs)     // Set angle     mins[0] = 0.0     mins[1] = 90.0     mins[2] = 0.0     entity_set_vector(wall, EV_VEC_angles, mins)     // Get user origin     new Float:someOrigin[3]     entity_get_vector(id, EV_VEC_origin, someOrigin)     // You can offset the origin here.     new offset = 200     new Float:adjustPos[3]     velocity_by_aim(id, offset, adjustPos)     // This prevents the wall from spawning in the current position of the user and make it spawn farther away from the user.     someOrigin[0] += adjustPos[0]       someOrigin[1] += adjustPos[1]     someOrigin[2] += adjustPos[2]     entity_set_origin(wall, someOrigin)     // Set other values     entity_set_int(wall, EV_INT_solid, SOLID_BBOX)     entity_set_int(wall, EV_INT_movetype, MOVETYPE_FLY)     // zomg! } public cmdGaben(id) {     new target, body     get_user_aiming(id, target, body)     if (target != 0) {         new class[32]         entity_get_string(target, EV_SZ_classname, class, 31)         if (equali(class, "wall")) {             new Float:tmp             new Float:mins[3]             new Float:maxs[3]             entity_get_vector(target, EV_VEC_mins, mins)             tmp = mins[1]             mins[1] = mins[0]             mins[0] = tmp                       entity_get_vector(target, EV_VEC_maxs, maxs)             tmp = maxs[1]             maxs[1] = maxs[0]             maxs[0] = tmp                             entity_set_vector(target, EV_VEC_mins, mins)             entity_set_vector(target, EV_VEC_maxs, maxs)             entity_set_vector(target, EV_VEC_absmin, mins)             entity_set_vector(target, EV_VEC_absmax, maxs)                         entity_get_vector(target, EV_VEC_angles, mins)                      mins[1] = floatadd(mins[1], 90.0)             if (floatcmp(mins[1], 360.0) >= 0)                 mins[1] = 0.0             entity_set_vector(target, EV_VEC_angles, mins)                         entity_set_int(target, EV_INT_solid, SOLID_BBOX)         }     } }

Ingram 11-05-2005 15:33

Code:
pev(ent,pev_origin,entorigin) set_pev(ent,pev_v_angle,angles) set_pev(ent,pev_angles,angles) entity_set_origin(ent, entorigin)
its with fakemeta(just change to engine if u want), but i remember it working. Not sure if u actually have to set the origin tho.

Zenith77 11-05-2005 16:33

Quote:

Originally Posted by JJkiller
Code:
pev(ent,pev_origin,entorigin) set_pev(ent,pev_v_angle,angles) set_pev(ent,pev_angles,angles) entity_set_origin(ent, entorigin)
its with fakemeta(just change to engine if u want), but i remember it working. Not sure if u actually have to set the origin tho.

1. Fakemeta > engine

2. Please tell me why would you not have to set the origin....


All times are GMT -4. The time now is 23:37.

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