Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: How to change image/iwi in existing maps?

  1. #1
    Private
    Join Date
    Apr 2020
    Posts
    66
    Thanks
    28
    Thanked 14 Times in 13 Posts

    How to change image/iwi in existing maps?

    Hi there.
    I know you can quickly edit existing images (iwi) that are used by a map to display custom images or textures. I want to know if there is an easy way to add new iwi files (so you don't have to edit the original) to be used in an existing map. Or to you have to make an xmodel and spawn using this function? Any help welcome.

    PHP Code:
    spawnModelmodeloriginangles )
    {
        if( !
    isdefined(model) || !isdefined(origin) )
            return 
    undefined;

        if( !
    isdefined(angles) )
            
    angles = (0,0,0);

        
    spawn spawn ("script_model",(0,0,0));
        
    spawn.origin origin;
        
    spawn setmodel (model);
        
    spawn.angles angles;

        return 
    spawn;


  2. #2
    Private
    Join Date
    Apr 2020
    Posts
    66
    Thanks
    28
    Thanked 14 Times in 13 Posts
    shot0004.jpg
    This shown in the attached picture is done by editing the v_soze.iwi file. Just to be clear i would like to be able to put a poster like this in a custom location and ideally without having to modify the original iwi files. Any ideas on how it's possible?

  3. #3
    Private pollo's Avatar
    Join Date
    Jul 2012
    Location
    Spain
    Posts
    116
    Thanks
    93
    Thanked 69 Times in 35 Posts
    For that you can use the IWI_X_DDS tool by DiegoLogic (http://www.diegologic.net/diegologic...%20X%20DDS.htm).

    Basically you extract the original .iwi (in images folder) from the stock .iwds, double click it (open .iwi files with this program), and it will generate a .dds. Edit the image at your own likings, eg. this image is used for the signs in Toujane, I quickly edited it adding a "Custom Sign" text. That will be shown in certain areas where the actual map uses this texture (in Toujane, it will show in Brit spawn, at the tunnels on the left, and also in the little house below the infamous roof)

    signs2.iwi
    signs.png

    Once you have the .dds ready (I personally use Photoshop CS6 + DDS plugin, but you can go for Paint.NET, Gimp, or the image editor of your preference), you can convert it back to .iwi using 2 ways:

    1. CoD2 Asset Manager, in which you will need to make a new material, select the .dds as the color map, saving the .gdt and clicking on PC Convert -> Current asset. It will generate an .iwi in main/images and a material inside main/materials. You're just interested in the .iwi.

    2. Use this tool, dds2iwi.exe, which iirc is made by @Tally. Drag and drop the .dds onto it, and you'll have it converted.
    dds2iwi.zip

    After you got the .iwi, you just need to pack the output image into an .iwd (name it eg. z_img.iwd, so that it overrides the previous ones; and also dont put a long name on the .iwds because of the "iwdsum name mismatch" thing), making sure it is inside a folder called "images", and that the name of the .iwi overrides the one in the stock files; in other words, keep the same image name. And at last, of course place it in the fs_game folder of your mod.

    Edit2 on page 2 for using models, as fx look buggy

    Edit1. that's if you wanna replace the existing ones. If you wanna make more in custom locations, you will need to make an fx or a model (as IzNoGoD posted once in KT's Discord) and spawn it via script.

    For a quick howto, you just need to make a new material with Asset Manager with the image you'd like, that will be used in CoD2 FX Editor to make the actual fx.

    b84uLVU.png

    Then in cod2 fx editor make the fx such that it's constant in shape/color (tweak the size as needed), and that uses the gfx previously made:

    TYPO: it needs to be an Oriented Particle (so that it sticks to its position and doesnt face to the players camera)
    customfx1.png
    customfx2.png
    customfx3.png
    customfx4.png

    And in script you will need to take the position of the sign, playing with bullettrace function and grabbing the trace["position"] and the trace["normal"] vector to orient it perpendicular to the surface. Here's a nice tutorial to understand the bullettrace func.

    https://killtube.org/showthread.php?...ttrace-and-you

    For the script to get those, I'll make one in a bit if it's for help.
    Attached Thumbnails Attached Thumbnails custom_sign.png  
    Last edited by pollo; 13th March 2021 at 11:20.

  4. The Following 2 Users Say Thank You to pollo For This Useful Post:

    agribilos (11th March 2021),brague (2nd May 2021)

  5. #4
    Private
    Join Date
    Apr 2020
    Posts
    66
    Thanks
    28
    Thanked 14 Times in 13 Posts
    Thank you very much!! I'll try to do the fx part.

  6. #5
    Private pollo's Avatar
    Join Date
    Jul 2012
    Location
    Spain
    Posts
    116
    Thanks
    93
    Thanked 69 Times in 35 Posts
    This is the script, basically you hold F and it will print the position and normal vectors' angles of the surface you are aiming at. Rename mp_toujane to the map you want it to be executed. You'll need to write those coordinates, and at the end, in your final map script, you'll need to uncomment the precache() / loadSigns() functions and add there the info you gathered.

    There is still a bug tho, engine related I'd say but someone correct me , that sometimes the fx is displayed wrong in the up vector ( see https://killtube.org/showthread.php?...os-as-textures to see what I mean), so the thing would be to make another effect (not material) of the same sign, but rotated 90 degrees and displayed in those positions that are bugged.

    (credits to izno for the !pickup script part)
    z_pos.iwd
    Last edited by pollo; 11th March 2021 at 14:28.

  7. The Following User Says Thank You to pollo For This Useful Post:

    agribilos (11th March 2021)

  8. #6
    Private
    Join Date
    Apr 2020
    Posts
    66
    Thanks
    28
    Thanked 14 Times in 13 Posts
    You are a real life saver!! Thank you so much for the effort!!!

  9. #7
    Private
    Join Date
    Apr 2020
    Posts
    66
    Thanks
    28
    Thanked 14 Times in 13 Posts
    Works fine but the image displayed is rotated with the player. Any idea how to make it displayed statically? When i made the effect i chose type particle. Should it be other type maybe?
    shot0005.jpgshot0006.jpg

    Edit: Nevermind i missed the part in your original post that stated that it has to be "oriented particle". So i have to try again.
    Last edited by agribilos; 11th March 2021 at 16:23.

  10. #8
    Private
    Join Date
    Apr 2020
    Posts
    66
    Thanks
    28
    Thanked 14 Times in 13 Posts
    Hmmm I'm not sure what i did wrong but i remade the fx as "oriented particle" . Now the picture is static but is not flush on the surface of the wall. It looks like the second picture from my previous post. Any ideas?

  11. #9
    Private pollo's Avatar
    Join Date
    Jul 2012
    Location
    Spain
    Posts
    116
    Thanks
    93
    Thanked 69 Times in 35 Posts
    Yeah sry... I edited the typo but I didnt post in another msg ^^ as I said cod2 acts a bit weirdly on placing the fx in the up vector, I couldnt find a script-way to fix it. So as a workaround, you'd need to make another fx (not material/image, just another .efx file) and rotate it 90 (or - 90) degrees in the Rotation tab. Play around until you see its working and display that fx only in the weird locations.

  12. #10
    Private
    Join Date
    Apr 2020
    Posts
    66
    Thanks
    28
    Thanked 14 Times in 13 Posts
    Quote Originally Posted by pollo View Post
    Yeah sry... I edited the typo but I didnt post in another msg ^^ as I said cod2 acts a bit weirdly on placing the fx in the up vector, I couldn't find a script-way to fix it. So as a workaround, you'd need to make another fx (not material/image, just another .efx file) and rotate it 90 (or - 90) degrees in the Rotation tab. Play around until you see its working and display that fx only in the weird locations.
    You already did 99% of my work so no need to apologize. I'm the one who needs to apologize for asking too many questions . I saw your videos in https://killtube.org/showthread.php?...os-as-textures. But my problem is not exactly that. Your fx was rotated 90 degrees clockwise or counterclockwise while being flush to the wall. My fx is like rotated 45 degrees in the z (?) axis. Half is in the air and half passes through the wall. Do you think that if i rotate my fx 90 degrees will fix the issue? Anyway i'm a little tired right now and i can't think straight. I'll try to figure it out tomorrow.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •