[FIXED] Making soldier kits have minimap icons

Ask questions, discuss ideas, get answers

[FIXED] Making soldier kits have minimap icons

Postby Classical Modder » Wed Dec 02, 2015 9:12 pm

I'm trying to make a special kit which would be visible on the minimap with the
Code: Select all
ObjectTemplate.SetMinimapIcon
command.

However, the description of that command on the MDT website states that you can only use it for PCOs. Has anyone tried to add a minimap icon to a soldier kit?
Last edited by Classical Modder on Sun Dec 27, 2015 3:04 am, edited 1 time in total.
{SoH} Clan Leader // http://sohclan.forumotion.com/
See my Strasbourg map project here.
GSC: diamondback67
Steam: diamondback67
Classical Modder
 
Posts: 420
Joined: Mon Oct 01, 2012 3:13 pm
Location: Canada

Re: Making soldier kits have minimap icons

Postby Battle GI » Thu Dec 03, 2015 2:50 pm

Simply try and see the results. If it does work, then it is fine,
Image
User avatar
Battle GI
 
Posts: 22
Joined: Thu Nov 19, 2015 3:58 pm

Re: Making soldier kits have minimap icons

Postby Seth » Tue Dec 08, 2015 12:41 pm

It doesn't work, I've tried.
It will probably work by adding an ObjectSpawner which immediately spawns a PlayerControlObject with the desired minimap icon. It would be nice if a more elegant solution was found.
Bitcoin address: 1NEoGgsFS9vxLT3eW4w6RFdvzPXLpQX66t
Seth
 
Posts: 14
Joined: Sun Jun 19, 2011 10:49 am

Re: Making soldier kits have minimap icons

Postby Classical Modder » Tue Dec 08, 2015 7:40 pm

Nope it doesn't, I've tried it too. One way to make this work is to addTemplate an ObjectSpawner to a kit part (not the kit itself) such as a soldier's back pack.

The spawned object would be a simple PCO with a custom minimap icon added to it with the command in my first post. The object would be as small as possible, with armor and collision physics and would be placed with a small offset next to the soldier's back pack. With the holdObject 1 command, the PCO would stick to the soldier wherever it goes, and when the soldier dies, well the PCO simply falls to the ground.

In order to not have multiple minimap icons lying around the map the PCO would have to ''die'' as soon as it touches the ground. Having multiple icons will happen if someone picks up the special kit (the PCO respawns as soon as the kit is picked up), and the icon from the previous owner of the kit would still be at the location where the person died. Giving the PCO a small timetolive value as well as a small distance value in the ObjectsSpawner will make it die almost instantly when the soldier dies.
{SoH} Clan Leader // http://sohclan.forumotion.com/
See my Strasbourg map project here.
GSC: diamondback67
Steam: diamondback67
Classical Modder
 
Posts: 420
Joined: Mon Oct 01, 2012 3:13 pm
Location: Canada

Re: Making soldier kits have minimap icons

Postby Swaffy » Wed Dec 09, 2015 7:48 pm

Classical Modder wrote:The spawned object would be a simple PCO with a custom minimap icon added to it with the command in my first post. The object would be as small as possible, with armor and collision physics and would be placed with a small offset next to the soldier's back pack. With the holdObject 1 command, the PCO would stick to the soldier wherever it goes, and when the soldier dies, well the PCO simply falls to the ground.


Just make the PCO static. It doesn't need to move. This way holdObject isn't needed. Also set up the object spawner so the PCO takes max damage when it's out of the object spawner's radius (when it stops existing).
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
Image
User avatar
Swaffy
 
Posts: 1708
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: Making soldier kits have minimap icons

Postby Classical Modder » Wed Dec 09, 2015 11:40 pm

Swaffy wrote:
Classical Modder wrote:The spawned object would be a simple PCO with a custom minimap icon added to it with the command in my first post. The object would be as small as possible, with armor and collision physics and would be placed with a small offset next to the soldier's back pack. With the holdObject 1 command, the PCO would stick to the soldier wherever it goes, and when the soldier dies, well the PCO simply falls to the ground.


Just make the PCO static. It doesn't need to move. This way holdObject isn't needed. Also set up the object spawner so the PCO takes max damage when it's out of the object spawner's radius (when it stops existing).


Hi, not quite sure you mean by making it static. Do you mean disabling mobile physics? So then when the player dies it stays in the air above the soldier and doesn't fall to the ground? But then, even without mobile physics, I think the object would still fall to the ground even without the HoldObject command. Could be an idea, I'll try it out.

And yes for the second thing you mentionned that's exactly what I'll do with the timetolive (set to 1 or an extremely small value) and the distance commands in the ObjectSpawner code.
{SoH} Clan Leader // http://sohclan.forumotion.com/
See my Strasbourg map project here.
GSC: diamondback67
Steam: diamondback67
Classical Modder
 
Posts: 420
Joined: Mon Oct 01, 2012 3:13 pm
Location: Canada

Re: Making soldier kits have minimap icons

Postby Swaffy » Fri Dec 11, 2015 8:51 pm

Classical Modder wrote:Hi, not quite sure you mean by making it static. Do you mean disabling mobile physics? So then when the player dies it stays in the air above the soldier and doesn't fall to the ground?


It doesn't need to fall to the ground. The minimap doesn't take into account height, just an X/Y grid. Also, no need for collisions... maybe not even a visual mesh. Worth playing around with.
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
Image
User avatar
Swaffy
 
Posts: 1708
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: Making soldier kits have minimap icons

Postby Classical Modder » Sun Dec 27, 2015 2:10 am

All right well this is very weird, but I got this to work a few weeks ago and now it doesn't work at all, even though the code I used today is identical to the code I used in the past.

So I am able to add a ''simple'' PCO (such as a Willy), but adding a spawner to either a kit part or the soldier itself doesn't work. This is the code I use, in my map's Objective OST.con:

*First I define an Object Spawner with a test PCO, in this case the Willy*
ObjectTemplate.create ObjectSpawner willyspawn
ObjectTemplate.setObjectTemplate 2 willy
ObjectTemplate.setObjectTemplate 1 willy
ObjectTemplate.MinSpawnDelay 5
ObjectTemplate.MaxSpawnDelay 10
ObjectTemplate.SpawnDelayAtStart 0
ObjectTemplate.TimeToLive 30
ObjectTemplate.Distance 40
ObjectTemplate.DamageWhenLost 10
ObjectTemplate.holdObject 1


*Second, I addTemplate that ObjectSpawner, which I named ''willyspawn'' to a kit part, in this case ''german_hippack''
ObjectTemplate.Active german_hippack
ObjectTemplate.AddTemplate willyspawn
ObjectTemplate.setPosition 0/3/0


This gives me an empty spawner, meaning when my player spawns there is no Willy addTemplate'd to it. However, about 3-4 weeks ago I used code which was 99% similar to this and was able to addTemplate a Willy with a minimap icon to my soldier. If anyone has any idea what might be the problem, please let me know.

Also, AddTemplating the Willy alone (without it being part of an ObjectSpawner) works, however when the player dies the game CTDs, and there is also no minimap icon since it is not part of an ObjectSpawner. I have also managed to addTemplate a CTF flag to a player when it spawns, but likewise when the player dies, the game CTDs.

EDIT: FIXED
{SoH} Clan Leader // http://sohclan.forumotion.com/
See my Strasbourg map project here.
GSC: diamondback67
Steam: diamondback67
Classical Modder
 
Posts: 420
Joined: Mon Oct 01, 2012 3:13 pm
Location: Canada

Re: [FIXED] Making soldier kits have minimap icons

Postby Apache Thunder » Thu Jan 14, 2016 7:41 pm

Make sure you aren't addTemplating a PCO directly to a soldier object. It may appear to work, but WILL cause a crash at some point. The moment someone tries to switch seat positions when not in a vehicle will cause it to try and switch the soldier into the PCO. But the PCO is a child object of the soldier. You can see why this will cause problems. :P

In multiplayer, the end result is the server side of the game crashes.
ImageImageImage

I have cameras in your head!
User avatar
Apache Thunder
 
Posts: 1192
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA

Re: [FIXED] Making soldier kits have minimap icons

Postby Classical Modder » Thu Jan 14, 2016 10:02 pm

Yes, originally when I added the PCO (Willy) to the soldier directly WITHOUT an Object Spawn my game always crashed as soon as I died. Adding an object spawn instead of the PCO alone to one of the soldier's kit part (I used US_Hippack) instead fixes the problem. I have it coded in a way that is around 90% similar to the method you used in this topic (an invisible PCO addTemplated to a soldier through a soldier spawn in order to trigger "soldier landmines"), which you can see here: viewtopic.php?f=6&t=2087&p=14776&hilit=AP+mines#p14776

The minimap icon follows the soldier wherever he goes, and it's even blinking since I have set the timetolive and distance command to very low values. Adding it to a kit part is also better than to the soldier itself, since I want the blinking icon to be attached to one kit only, and not the whole allied/axis team.
{SoH} Clan Leader // http://sohclan.forumotion.com/
See my Strasbourg map project here.
GSC: diamondback67
Steam: diamondback67
Classical Modder
 
Posts: 420
Joined: Mon Oct 01, 2012 3:13 pm
Location: Canada


Return to 1942 Modding Discussion

Who is online

Users browsing this forum: Baidu [Spider] and 26 guests