5. Weekly Faq

Questions about Gametool and Timmy NPC

Pickup Marker Malarky

Like SimplePickup, the SimplePickupMarker extends from TournamentPickup. You can basically copy SimplePickup into another file (mine being called SimplePickupMarker) The only changes to make are:

Clear touch function (can leave it there empty, otherwise you get a warning message)
Add bHidden = True; to default properties
Next, replace your SimplePickup items in your map with SimplePickupMarkers.
Finally, a simple function (that must be thrown into a file that already has exec function, so put this in ExampleController

exec function SpawnPickup()
    local SimplePickup Pickup;
    local SimplePickupMarker area;
    ForEach AllActors(class'SimplePickupMarker', area)
        Pickup = Spawn(class 'SimplePickup');


This should hopefully work by calling the function in the map using console command SpawnPickup. You can also link it to a button.

-Philip Morby and -Martin Allen

It doesn't have to inherit from the Pickup class. What you've done works - but you should really only inherit the behaviour you actually want. Mine looks like this:

class SimplePickupSpawnPoint extends Actor



Additional Note:

When the newly spawned pickup is actually picked up the default message is displayed. If you want a different message for each pickup you'll need to add in this line:

pickup.pickupmessage = area.pickupmessage;

Inside the ForEach loop after you've set the location. Once you've got that line in there when you're in UnrealEd, you should be able to bring up the properties of your SimplePickupMarker, expand the Pickup section and change the pickupmessage to whatever you want. Once you've done that, when the pickup is spawned, it'll have the pickup message of whatever it's related pickupmarker's message is. Hope this helps, and if you don't understand what I'm talking about come find me and I'll quickly explain!

EDIT: Okay… so I've somehow managed to mess up my own solution? I have this as it was before I lost my work (I know I keep going on about that but it's relevant) but now whenever I pickup one of my pickups it always displays the default message, regardless of whether I've changed it in unrealed on either the marker or if I place an actual pickup in the level… Can anyone help? I've a feeling it's related to this in my pickup class:

static function string GetLocalString(
    optional int Switch,
    optional PlayerReplicationInfo RelatedPRI_1,
    optional PlayerReplicationInfo RelatedPRI_2
    return default.PickupMessage;

And it doesn't like it if I try to return PickupMessage because apparently I can only access default values inside?

- Sean-Rafael

Using functions from other classes question

Right now, myself and Martin are trying to get a trigger working (playing can only move forward, and once they do, will hit trigger and call SpawnPickup. However, we can't work out how to do this, as telling our trigger to call ExampleController.SpawnPickup(); results in an error about being a bad expression. Trying to make a local variable of type ExampleController compiles fine but doesn't seem to work in game (creating a log warning about being None)

We just want to access this function from another class. How hard can it be???? :-)

-Philip Morby and -Martin Allen

I suggesting trying ExampleController(Owner).SpawnPickup(); and see if that works for you.

-Matt Keyte

Just tried that and get the following warning in my log

Warning: gameStartTrigger Famous5.gameStartTrigger0 (Function SmugglersClasses.gameStartTrigger.Pickup.Touch:002F) Accessed None 'Owner'

-Martin Allen

Getting similar error as Martin above (except my files and my map of course)
Tried 2 different things which are looping around:

exec function FFGIAFController(Other).SpawnPickup();

That produces the build error 'Function is not allowed here' and removing it to:

exec FFGIAFController(Other).SpawnPickup();

Produces the build error 'Missing function'. Shall keep this updated if I make any progress, just wondering if anyone has got any further on this?

-Philip Morby

Issues with Unrealed

Hey guys, i'm having allot of trouble with Unrealed. I'm making my pickup classes ( using a text editor) and placing them, and then saving the map and closing it, i then test the map in the mod and it runs fine. However, once i open Unrealed again i get an error, and it crashes instantly. It seems to be something to do with my pickups, although i see nothing wrong with them. I can't progress at all until i fix this, so if you have any suggestions that would be great =D

Make sure you're using the link to UnrealEd that I've provided - and that you've updated it's mymod property to use your new Mod.


-Thomas Marsh

Edit the map to add the pick ups using the unrealEd exe in your mod folder rather than accessing unrealEd via your programs

- Martin Allen

Cheers Martin, how would i do this?

-Thomas MARSH

In the folder where the rebuild bat file and exe to launch mod are there should be an unrealEd.exe which will launch editor, load map in then access the pick up via the actor browser

- Martin Allen

Ahhh yes, i see what you mean now. What an idiot, worked great, cheers.

While touching function ?

Obviously pick up's have the touch function which can be used to see if the pick up is being touched by the player. For a tool in my game I want the touch function to act as a kind of "while touching" function which will carry the task out while the player is touching the pickup.

The problem is the touch function in unreal works that once touching an item for the touch function to be called again the player has to untouch and then retouch the pickup which doesn't suit my tool. Is there anyway to trick unreal into thinking I've untouched the pickup so it goes straight back into the touch function.

I tried changing the validtouch part of the touch function from an if loop to a while loop and it created a rather impressive overflow crash !

- Martin Allen

**What is it you're trying to do - I think you might be going about it in the wrong way. In order to write efficient Unreal code - we want to be triggered on particular events;


I've got a seperate screwdriver pick up which when collected when the player goes to the part of the map which has the item which needs unscrewing while they stand next to it the screws will slowly unscrew (similar to how bomb defusing is done in some games). I could do it via a timer that starts when player goes near screws and then item is unscrewed when timer finishes but that doesn't stop player walking away and not staying by item as I intend, maybe would be best to freeze the player in place and force them to stay by item while it unscrews if possible ?

Martin Allen

Reseting Timer

Im just wondering if there is a way to start the timer at the same time that the items are spawned?

- Robert Davies

The easiest way of doing so would probably to have two variables : one for the starting time (which will be initialized to Level.TimeSeconds when the game starts), and another one for holding the current time. Instead of updating the current time with Level.TimeSeconds like you must have done before, just do : currentTime = startTime - Level.TimeSeconds

Hope this helps!!

- Craig Hupin

Problem getting the dog mesh and skins to be detected

the meshs are in the folders, the code is right because ive checked it against other peoples.
any1 got any ideas?

- Andrew Jones

It seems quite a lot of people are having problems loading the mesh and textures into the game.
I am not entirely sure of how I managed to solve this problem, as I was trying random stuff in order to get it to work, anyway, this is what I believe I did :

It seems the error occurs because the animation and texture packages for Timmy do not show in the editor list, as the other packages (the boy and the girl) do.
To solve this, you need to go into the editor (if yours will not load anymore, just use the one in the UT2K4 System folder), open the TimmySkins package manually (under the texture tab, click open -> select the package), select one of the textures, and then open the Animal package (under the animations tab, click open -> select the package).

Then, still in the Animations tab, select meshDog from the Mesh list, and expand the Skins menu on the right. You should see a line with [0], select it and click on Use. Hopefully, if you selected a texture previously, you should see a textured dog.

Finally, go to File -> Save and override the previous Animals.usx package. You should now be able to close the editor, recompile your project, and hopefully, it should work !!

- Craig Hupin

Thanks for trying Craig but it doesn't seem to work… some people have told me that theirs does the same at home but works at uni so ill test it at uni 2moz, not very practical though :(

- Andrew Jones

I found a way around that exact error on my laptop. I simply saved the animation file under a different name, in my case "Dog". Then I called it from this new file, and its all good :D. Hope this works for anyone else with this problem too :D. Just save the animation as a different name via unrealed.

- Richard Pickering

Zooming in

I know some people have had some trouble getting the zoom to work for binoculars / magnifying glass etc. Even if the error is a really stupid one like putting Bincular instead of Binoculars in the ini file lol..

You want to use some code from the Player Controller class

  • StartZoom()
  • EndZoom()
  • bBehindView

This should help you on the way :)

- Stephen Brown

Making the magnifying glass see-through

I am having a lot of trouble trying to make my image have a see-through circle and watching youtube videos on alpha channels has confused me as I have an ancient copy of PS. Could anyone help?

-Steph Charij

There are some tips in this weeks tutorial. Basically,

  • In Photoshop highlight the area you want to make transparent.
  • Save this selection into a new channel
  • Save as 32bit targa
  • Import into UnrealEd - make sure alpha is ticked.



So for my easy torch, the player will pick up an item which will then turn on trigger lights around the cave (to make it look like they are using the torch). Convieniently, there is such a thing as TriggerLight just for times like these. Have placed one in my level and trying to get it to switch on (using a marker or calling my function in console), but TriggerTurnOn is a state, not a function. Don't really know how to call it. Any ideas? Trying the following:

local TriggerLight area;

    ForEach AllActors(class'Triggerlight', area)

Produces the unsuprising error 'Unreconized member 'triggerturnson' in class 'triggerlight'

-Philip Morby

Hey, I am not entirely sure of what you are trying to do, and have not had a go myself at implementing triggers. However, after having checked for "TriggerTurnsOn" in UncodeX, I have noticed it is a state, not a function or member, and yet you are providing it with parameters. Again, because I do not know exactly what you are trying to do, I would suggest you have a look at the code : as you will see there is a function "Trigger" which you can use, provided you are in the right state. You should be able to change states using :


Hope this helps, at least I should have pointed out the error.

- Craig Hupin

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License