Page 1 of 1

Points to unlock (FAQ)

Posted: Sat Apr 26, 2008 11:54 am
by woner11
Is there some way through scripting to determine how many points it takes to unlock a unit instead of the odf function "PointstoUnlock= X"?

Re: Points to unlock

Posted: Sat Apr 26, 2008 1:00 pm
by Master Fionwë
Yes, there is a map out there that was done in a more mission style, where if you have a certain number of cps captured the Jedi became available to use. If you lacked the necessary number of cps then the Jedi were 500 points each. I can't remember the name of it though, maybe someone else knows?

Re: Points to unlock

Posted: Sat Apr 26, 2008 1:09 pm
by MasterSaitek009
Example with the Acklay:

Code: Select all

SetClassProperty("geo_inf_acklay", "PointsToUnlock", 12)
Just put it in command post setup section(can't remember the name. ScriptPostLoad? :? ).

Re: Points to unlock

Posted: Sat Apr 26, 2008 1:13 pm
by woner11
Thanks a bunch!!! Can you modify health and damage the unit can do as well?

Re: Points to unlock

Posted: Sat Apr 26, 2008 1:20 pm
by MasterSaitek009
Yep:

Code: Select all

SetClassProperty("geo_inf_acklay", "MaxHealth", 1000)
Note:
That method is for the class as a whole. If you just want to change the current health of a unit, here's what you should use:

Code: Select all

SetProperty(UNIT_VARIABLE, "MaxHealth", 1000)
That will change the MaxHealth of the unit in the variable to 1000.

Re: Points to unlock

Posted: Sat Apr 26, 2008 2:20 pm
by elfie
Yes, there is a map out there that was done in a more mission style, where if you have a certain number of cps captured the Jedi became available to use. If you lacked the necessary number of cps then the Jedi were 500 points each. I can't remember the name of it though, maybe someone else knows?
Oh yeah I know that map!! I think it was that campaign map on http://www.starwarsbattlefront.filefront.com

Re: Points to unlock

Posted: Sat Apr 26, 2008 4:26 pm
by woner11
Would I also then change

Code: Select all

SetClassProperty("geo_inf_acklay", "PointsToUnlock", 12)
to this:

Code: Select all

SetProperty("geo_inf_acklay", "PointsToUnlock", 12)

Re: Points to unlock

Posted: Sat Apr 26, 2008 4:35 pm
by MasterSaitek009
No, PointToUnlock is a class property. Health and MaxHealth are instance properties.
Each unit has there own instance property. The class properties are shared across the whole... well, class. :wink:
If you look in the scripting guide it has a list of all the instance and class properties.

Re: Points to unlock

Posted: Sat Apr 26, 2008 5:10 pm
by woner11
Okay, I'll give it a try and thank you very much! :wink:

Re: Points to unlock

Posted: Thu May 15, 2008 8:08 am
by Omega_007
Apologies for bumping this thread, but I have a query about the "SetProperty" line; can it be used with weapons, as well as units?

Re: Points to unlock

Posted: Thu May 15, 2008 10:45 am
by Maveritchell
Yes, but it's still SetClassProperty and not SetProperty. There aren't instances of weapons, just weapon classes.

Re: Points to unlock

Posted: Thu May 15, 2008 4:24 pm
by [RDH]Zerted
I have never tired changing the properties of weapons (rate of fire, recharge time, etc...), but I do know that changing which weapons a unit hold will cause crashes for other players in MP. Also, changing units' ammo counts causes the crashes too.

Re: Points to unlock

Posted: Fri May 16, 2008 2:12 am
by Omega_007
By weapon classes we'd be talking, say, like the rifles of all 4 main sides being of the same wepon class, right?

Also, can you change a vehicle's health(or that of a vehicle class) using these two code lines?

Re: Points to unlock

Posted: Tue May 20, 2008 12:42 am
by [RDH]Zerted
Omega_007 wrote:By weapon classes we'd be talking, say, like the rifles of all 4 main sides being of the same wepon class, right?

Also, can you change a vehicle's health(or that of a vehicle class) using these two code lines?
Yes, and about the vehicle's health, I think so. Ingame its an object and SetProperty works on objects... I've never tried it though. You would need to know the vehicle's spawned name, or get a reference to it somehow (like through OnExitVehicle or whatever)

Re: Points to unlock

Posted: Sun Aug 30, 2009 2:21 pm
by Tourny
Sorry for bumping this topic, but I'm confused about this:
MasterSaitek009 wrote:SetProperty(UNIT_VARIABLE, "MaxHealth", 1000)

That will change the MaxHealth of the unit in the variable to 1000.
Can somebody explain in further detail how to get it to recognize a unit currently referenced in a function? For example:

Code: Select all

OnCharacterSpawn(
    function(player)
        if GetEntityClass(player) == "cis_inf_rifleman" then
            SetProperty(whatdoIputhere?, Team, 3)
        end
    end
    )

Re: Points to unlock (FAQ)

Posted: Sun Aug 30, 2009 2:50 pm
by Maveritchell
whatdoIputhere? = GetCharacterUnit(player)