PDA

View Full Version : Replace plant models



qwerty
18th June 2015, 03:31
Hello,

I would like to edit the stock SD gametype with a little feature. In every round the plant models will be different. So, I replaced the basic models to a random one and removed the Clip brushes from the bomzones. Now players can walk through the models. I tried to spawn a trigger_radius and then call SetContents and tried the SetBounds and SetContents combo but the result is the same. The solid "object" will be a cylinder and it seems so stupid around the model, can I spawn a solid square or any better idea to do this?
Thanks in advance!

kung foo man
18th June 2015, 04:13
I had much hope for something like this when php figured out the setBounds() stuff, as it worked so fine in Call of Duty 1.

Example: http://killtube.org/showthread.php?1837-magic-bridgebuilders

Though I couldn't get this to work with client prediction in CoD2 (serverside it somewhat worked), maybe somebody else had more luck.

qwerty
18th June 2015, 04:50
SetBounds worked for me but these two ways


ents[i] SetBounds(100, 1000);
ents[i] SetContents(1);



level.plants[0].trigger = Spawn("trigger_radius", ents[i].origin, 0, 100, 1000);
level.plants[0].trigger SetContents(1);

are making the exact same thing, just for the first one not necessary to spawn a trigger

Tally
18th June 2015, 08:26
I had much hope for something like this when php figured out the setBounds() stuff, as it worked so fine in Call of Duty 1.

Example: http://killtube.org/showthread.php?1837-magic-bridgebuilders

Though I couldn't get this to work with client prediction in CoD2 (serverside it somewhat worked), maybe somebody else had more luck.

setBounds() is not a built-in function for COD2. And it was removed in the COD1 1.3 patch because there is a known exploit for it.

Tally
18th June 2015, 08:29
Hello,

I would like to edit the stock SD gametype with a little feature. In every round the plant models will be different. So, I replaced the basic models to a random one and removed the Clip brushes from the bomzones. Now players can walk through the models. I tried to spawn a trigger_radius and then call SetContents and tried the SetBounds and SetContents combo but the result is the same. The solid "object" will be a cylinder and it seems so stupid around the model, can I spawn a solid square or any better idea to do this?
Thanks in advance!

setContents() works in COD2, but as I said above, setBounds() is not a built-in function in COD2. There is already a thread about this subject here:

http://killtube.org/showthread.php?1606-Modify-SD-Bombs&highlight=bombzone

You will find code in that thread which works. Make sure you take the code right at the end of the thread - page 3 - because that is the code that works the best.

kung foo man
18th June 2015, 10:44
setBounds() is not a built-in function for COD2. And it was removed in the COD1 1.3 patch because there is a known exploit for it.

Hence we had to add it:

https://github.com/riicchhaarrd/CoDExtended/blob/92fc7f2fb5ebca1350f25cb88cda9773a0349bc8/code/scr_method_entity.c#L115

https://github.com/kungfooman/libcod/blob/f89b31fdbc5575a0579fe1c3dc908ae4ef702581/gsc_player.cpp#L725

Well, maybe the libcod implementation of setbounds is just wrong, so it still could work (if implemented correctly). I don't know why IW should remove special quake3 entity functions/variables (mostly the bindings to native ID tech 3 functions).

Tally
18th June 2015, 12:23
Hence we had to add it:

https://github.com/riicchhaarrd/CoDExtended/blob/92fc7f2fb5ebca1350f25cb88cda9773a0349bc8/code/scr_method_entity.c#L115

https://github.com/kungfooman/libcod/blob/f89b31fdbc5575a0579fe1c3dc908ae4ef702581/gsc_player.cpp#L725

Well, maybe the libcod implementation of setbounds is just wrong, so it still could work (if implemented correctly). I don't know why IW should remove special quake3 entity functions/variables (mostly the bindings to native ID tech 3 functions).

They removed it in the COD1 1.3 patch because there is an exploit where you can "glue" a player to the floor with it even if you are not an admin of the server. Hence, it was removed in the 1.3 patch.

qwerty
19th June 2015, 08:09
Basically I did the same like you, but when the model is a rectangle and not a square the result will be very bad. In this case on the attached picture the black circle is the solid stuff. Any chance to fix the SetBounds method with libcod in the future?
867

kung foo man
19th June 2015, 13:05
Don't hold your breath, if you know what I mean. :D

How about dig yourself into libcod? There are like 6 ppl around who messed with IDA/libcod and everybody is prolly working on his own problems.

qwerty
20th June 2015, 22:04
Don't hold your breath, if you know what I mean. :D

How about dig yourself into libcod? There are like 6 ppl around who messed with IDA/libcod and everybody is prolly working on his own problems.


Alright, could you explain me why are you editing the specified entity's base + 276, 272, 264, 260 addresses? What represents these adresses, I guess the base + 280 is the height :) but the others?



*(float*)(gentities + gentities_size*id + 280) = height;
*(float*)(gentities + gentities_size*id + 276) = width;
*(float*)(gentities + gentities_size*id + 272) = width;
*(float*)(gentities + gentities_size*id + 264) = -width;
*(float*)(gentities + gentities_size*id + 260) = -width;

Mitch
20th June 2015, 22:50
Alright, could you explain me why are you editing the specified entity's base + 276, 272, 264, 260 addresses? What represents these adresses, I guess the base + 280 is the height :) but the others?

It basically created a collision 'box' around the entity like spawn point.
Based on the pseudocode in the 'spawn' function and the CoDExtended code.
You got two points that define the outer positions of the entity.
A = 260, 264, 268 e.g (-10, -10, 0) = x, y, z (i assume)
B = 272, 276, 280 e.g (10, 10, 10)


*(_DWORD *)(a1 + 260) = playerMins;
*(_DWORD *)(a1 + 264) = dword_34BDD0;
*(_DWORD *)(a1 + 268) = dword_34BDD4;
*(_DWORD *)(a1 + 272) = playerMaxs;
*(_DWORD *)(a1 + 276) = dword_34BDC4;
*(_DWORD *)(a1 + 280) = dword_34BDC8;


cod2 1.3

if ( *(_DWORD *)(a2 + 28) == 1 )
{
sub_810824E(a1 + 260, -1082130432, -1082130432, -1082130432);
sub_810824E(a1 + 272, 1065353216, 1065353216, 1065353216);
}
else
{
sub_810824E(a1 + 260, -1082130432, -1082130432, 0);
sub_810824E(a1 + 272, 1065353216, 1065353216, 1073741824);
}


It might be useful to read the values that are used in the spawn function (of your cod2 version).
Edit: or a other function that uses these offsets.