Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Few questions
Few questions [message #408816] Thu, 29 October 2009 22:10 Go to next message
Hubba is currently offline  Hubba
Messages: 40
Registered: October 2009
Karma: 0
Recruit
Please check last post for new question Smile thx


Hey! I'm back again with new questions and I need your help Smile

[SOLVED]1) How can i change how much score an object give? Lets say the object i kill gives 200 score and I want it to 100. I know i could attach "jfw_give_points_on_death" to like -100. But then if you damage the object so it only have 1 hp left you would still get 199 score.
Or another example if you shot a stank with a ramjet you will get like 30 scores each shot. How could i decrease that?


[SOLVED]2) How can i get check how much hp/armor and what weapons a player have? If i want the char to turn into another preset but keep the hp/armor + weapons? Example: If I have a !roshambo command.


[SOLVED]3) How can i get a models name? Is this possible? Is there a Get_Model_Name() method?

Thanks
Hubba

[Updated on: Fri, 06 November 2009 13:46]

Report message to a moderator

Re: Few questions [message #408821 is a reply to message #408816] Fri, 30 October 2009 02:27 Go to previous messageGo to next message
Tupolev TU-95 Bear is currently offline  Tupolev TU-95 Bear
Messages: 1176
Registered: April 2009
Location: Rìoghachd Aonaichte
Karma: 1
General (1 Star)
Hubba wrote on Fri, 30 October 2009 05:10

Hey! I'm back again with new questions and I need your help Smile

1) How can i change how much score an object give? Lets say the object i kill gives 200 score and I want it to 100. I know i could attach "jfw_give_points_on_death" to like -100. But then if you damage the object so it only have 1 hp left you would still get 199 score.
Or another example if you shot a stank with a ramjet you will get like 30 scores each shot. How could i decrease that?

2) How can i get check how much hp/armor and what weapons a player have? If i want the char to turn into another preset but keep the hp/armor + weapons? Example: If I have a !roshambo command.

3) How can i get a models name? Is this possible? Is there a Get_Model_Name() method?

Thanks
Hubba



um

1. i dont know
2. i dont know
3 i belive u can find the models in the always.dat and always2.dat with the w3d.


Decent people


Quotes or w/e

Re: Few questions [message #408824 is a reply to message #408816] Fri, 30 October 2009 03:29 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Hubba wrote on Fri, 30 October 2009 00:10


Hey! I'm back again with new questions and I need your help Smile

1) How can i change how much score an object give? Lets say the object i kill gives 200 score and I want it to 100. I know i could attach "jfw_give_points_on_death" to like -100. But then if you damage the object so it only have 1 hp left you would still get 199 score.
Or another example if you shot a stank with a ramjet you will get like 30 scores each shot. How could i decrease that?



There's a difference between setting the damage points, and setting the kill points. But both are possible...
Take a look at the script you just mentioned. You know that kinda does what you want, so look at that scripts code, and surely you will find the function you are looking for inside that script. A little bit of lateral thinking will get you quite far in this API.

Hubba wrote on Fri, 30 October 2009 00:10


2) How can i get check how much hp/armor and what weapons a player have? If i want the char to turn into another preset but keep the hp/armor + weapons? Example: If I have a !roshambo command.



Commands->Get_Health (GameObject *obj);
Commands->Set_Health (GameObject *obj);

There is also some functions for getting weapons too, however I forget what they are. Look in engine_weapons or something like that I think.
It's something like 'Get_Current_Weapon', if you search int he API for that, then you'll find all the other weapon engine calls.

You can then grant power up's to the new character you change them to... 'Grant_Powerup'


Hubba wrote on Fri, 30 October 2009 00:10


3) How can i get a models name? Is this possible? Is there a Get_Model_Name() method?

Thanks
Hubba



Commands->Get_Model(GameObject *obj); // I think...




This site is out of date, but is probably still a bit useful for someone starting out.
http://www.renegadewiki.com/index.php?title=API



Re: Few questions [message #408845 is a reply to message #408824] Fri, 30 October 2009 09:22 Go to previous messageGo to next message
Hubba is currently offline  Hubba
Messages: 40
Registered: October 2009
Karma: 0
Recruit
reborn wrote on Fri, 30 October 2009 04:29

Hubba wrote on Fri, 30 October 2009 00:10


Hey! I'm back again with new questions and I need your help Smile

1) How can i change how much score an object give? Lets say the object i kill gives 200 score and I want it to 100. I know i could attach "jfw_give_points_on_death" to like -100. But then if you damage the object so it only have 1 hp left you would still get 199 score.
Or another example if you shot a stank with a ramjet you will get like 30 scores each shot. How could i decrease that?



There's a difference between setting the damage points, and setting the kill points. But both are possible...
Take a look at the script you just mentioned. You know that kinda does what you want, so look at that scripts code, and surely you will find the function you are looking for inside that script. A little bit of lateral thinking will get you quite far in this API.

Hubba wrote on Fri, 30 October 2009 00:10


2) How can i get check how much hp/armor and what weapons a player have? If i want the char to turn into another preset but keep the hp/armor + weapons? Example: If I have a !roshambo command.



Commands->Get_Health (GameObject *obj);
Commands->Set_Health (GameObject *obj);

There is also some functions for getting weapons too, however I forget what they are. Look in engine_weapons or something like that I think.
It's something like 'Get_Current_Weapon', if you search int he API for that, then you'll find all the other weapon engine calls.

You can then grant power up's to the new character you change them to... 'Grant_Powerup'


Hubba wrote on Fri, 30 October 2009 00:10


3) How can i get a models name? Is this possible? Is there a Get_Model_Name() method?

Thanks
Hubba



Commands->Get_Model(GameObject *obj); // I think...




This site is out of date, but is probably still a bit useful for someone starting out.
http://www.renegadewiki.com/index.php?title=API



Ok found the solution for my objects pointfix I skipped the whole script because it had really nothing to do with what i wanted. So i opened up my level edit and checked the setting for my "object". And found this cool options "Damagepoints" and "Deathpoints" so i started to mess around with the values and bingo there it is. Smile

And about question 3. Commands->Get_Model(GameObject *obj); is the right method but it ain't listed in my 'ScriptCommands' in "scripts.h". I tried to add it there but then my server wouldn't load at all. It kept opening and closing the server console screen.

And thanks for the link there is lots of interesting stuff there Smile

[Updated on: Fri, 30 October 2009 09:27]

Report message to a moderator

Re: Few questions [message #408854 is a reply to message #408845] Fri, 30 October 2009 12:48 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Hubba wrote on Fri, 30 October 2009 11:22


Ok found the solution for my objects pointfix I skipped the whole script because it had really nothing to do with what i wanted. So i opened up my level edit and checked the setting for my "object". And found this cool options "Damagepoints" and "Deathpoints" so i started to mess around with the values and bingo there it is. Smile

And about question 3. Commands->Get_Model(GameObject *obj); is the right method but it ain't listed in my 'ScriptCommands' in "scripts.h". I tried to add it there but then my server wouldn't load at all. It kept opening and closing the server console screen.

And thanks for the link there is lots of interesting stuff there Smile



Objects mods are fine, it's just they're so Global, even on a per map basis.
Sorry, get model is just 'Get_Model(GameObject *obj);', not Commands->.



Re: Few questions [message #408856 is a reply to message #408854] Fri, 30 October 2009 14:30 Go to previous messageGo to next message
Hubba is currently offline  Hubba
Messages: 40
Registered: October 2009
Karma: 0
Recruit
reborn wrote on Fri, 30 October 2009 13:48

Hubba wrote on Fri, 30 October 2009 11:22


Ok found the solution for my objects pointfix I skipped the whole script because it had really nothing to do with what i wanted. So i opened up my level edit and checked the setting for my "object". And found this cool options "Damagepoints" and "Deathpoints" so i started to mess around with the values and bingo there it is. Smile

And about question 3. Commands->Get_Model(GameObject *obj); is the right method but it ain't listed in my 'ScriptCommands' in "scripts.h". I tried to add it there but then my server wouldn't load at all. It kept opening and closing the server console screen.

And thanks for the link there is lots of interesting stuff there Smile



Objects mods are fine, it's just they're so Global, even on a per map basis.
Sorry, get model is just 'Get_Model(GameObject *obj);', not Commands->.



Yup that did the trick Smile Thanks
---------------------------------------------------------
[SOLVED]Question 4

I have another thing that i have been wondering on. I have a timer script that should just print 1 message after 1 second and then another after 10 second. This is just an example:

void Example::Created(GameObject *obj) {
Commands->Start_Timer(obj,this,1.0f,1);
Commands->Start_Timer(obj,this,10.0f,2);
}



void Example::Timer_Expired(GameObject *obj, int number) {

if(number == 1){
	Console_Input("msg Message number1");
	}

if(number == 2){

	Console_Input("msg Message number2");
	}
}


Now if i change character right after "message number1" then message number2 will never appear. This happends only when i change char not when buying a veh. Why?

-----------------------------------------------------------------
Question 5

Then i have this veh script from wittebolx source (wittebolx has posted it here on renegadefourms)

;************************* Transport Helicopter Hummvee Drop  ************************

; ****************************** Trajectory Transport

-1	Create_Object,		1, "XG_TransprtBone",			0, 0, 0, 0
-1	Play_Animation,		1, "XG_TransprtBone.XG_HD_TTraj", 1

; ****************************** Transport

-1	Create_Real_Object,	2, "CnC_GDI_Transport", 1, "BN_Trajectory"
-1	Attach_Script,		2, "KAK_Prevent_Destruction_Until_Entered"
-1	Set_Primary,		2
-1	Attach_to_Bone,		2, 1, "BN_Trajectory"
-1	Play_Animation,		2, "v_GDI_trnspt.XG_HD_Transport",1
-700	destroy_object,		2

; ****************************** Trajectory Nod_Light_Tank

-1	Create_Object,		3, "XG_HD_HTraj",			0, 0, 0, 0
-1	Play_Animation,		3, "XG_HD_HTraj.XG_HD_HTraj", 1

; ****************************** Nod_Light_Tank

-1	Create_Real_Object,	4, "CnC_Nod_Buggy", 3, "BN_Trajectory" 
-1	Attach_Script,		4, "M02_Player_Vehicle", "0"
-1	Attach_Script,		4, "KAK_Prevent_Destruction_Until_Entered"
-1	Attach_to_Bone,		4, 3, "BN_Trajectory"
-437	Attach_to_Bone,		4, -1, "BN_Trajectory"
-437	Move_Slot,		7, 4

; ****************************** Harness

-1	Create_Object,		6, "XG_HD_Harness",			0, 0, 0, 0
-1	Play_Animation,		6, "XG_HD_Harness.XG_HD_Harness", 0

; ****************************** Primary Destroyed

1000000 Destroy_Object, 1
1000000 Destroy_Object, 2
1000000 Destroy_Object, 3
1000000 Destroy_Object, 4
1000000 Destroy_Object, 5
1000000 Destroy_Object, 6


I know what the script does but i don't really get the numbers and how its build up. For example
1000000 Destroy_Object, 6
I know that it destroy the object 6 but what does the number 1000000 do? So if someone could explain in short what the numbers and stuff do i would be happy Smile

[Updated on: Fri, 06 November 2009 13:47]

Report message to a moderator

Re: Few questions [message #408859 is a reply to message #408856] Fri, 30 October 2009 14:58 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Hubba wrote on Fri, 30 October 2009 16:30


Yup that did the trick Smile Thanks
---------------------------------------------------------
Question 4

I have another thing that i have been wondering on. I have a timer script that should just print 1 message after 1 second and then another after 10 second. This is just an example:

void Example::Created(GameObject *obj) {
Commands->Start_Timer(obj,this,1.0f,1);
Commands->Start_Timer(obj,this,10.0f,2);
}



void Example::Timer_Expired(GameObject *obj, int number) {

if(number == 1){
	Console_Input("msg Message number1");
	}

if(number == 2){

	Console_Input("msg Message number2");
	}
}


Now if i change character right after "message number1" then message number2 will never appear. This happends only when i change char not when buying a veh. Why?



When you change character, you are an entirely new GameObject *, so the script that was attached to you previously is destroyed, because the object that the script was attached to no longer exists.
When you purchase a vehicle, the script is attached to the vehicle, if you killed the vehicle then you would no longer get the message. The same principle can be applied to changing your character, it's kinda like you killed your character by getting a new one.
You can never permanently attach a script to a players character, unless they are gauranteed to never be killed.
You can however, keep re-attaching the same script to a player whenever they are created.


Hubba wrote on Fri, 30 October 2009 16:30


-----------------------------------------------------------------
Question 5

Then i have this veh script from wittebolx source (wittebolx has posted it here on renegadefourms)

;************************* Transport Helicopter Hummvee Drop  ************************

; ****************************** Trajectory Transport

-1	Create_Object,		1, "XG_TransprtBone",			0, 0, 0, 0
-1	Play_Animation,		1, "XG_TransprtBone.XG_HD_TTraj", 1

; ****************************** Transport

-1	Create_Real_Object,	2, "CnC_GDI_Transport", 1, "BN_Trajectory"
-1	Attach_Script,		2, "KAK_Prevent_Destruction_Until_Entered"
-1	Set_Primary,		2
-1	Attach_to_Bone,		2, 1, "BN_Trajectory"
-1	Play_Animation,		2, "v_GDI_trnspt.XG_HD_Transport",1
-700	destroy_object,		2

; ****************************** Trajectory Nod_Light_Tank

-1	Create_Object,		3, "XG_HD_HTraj",			0, 0, 0, 0
-1	Play_Animation,		3, "XG_HD_HTraj.XG_HD_HTraj", 1

; ****************************** Nod_Light_Tank

-1	Create_Real_Object,	4, "CnC_Nod_Buggy", 3, "BN_Trajectory" 
-1	Attach_Script,		4, "M02_Player_Vehicle", "0"
-1	Attach_Script,		4, "KAK_Prevent_Destruction_Until_Entered"
-1	Attach_to_Bone,		4, 3, "BN_Trajectory"
-437	Attach_to_Bone,		4, -1, "BN_Trajectory"
-437	Move_Slot,		7, 4

; ****************************** Harness

-1	Create_Object,		6, "XG_HD_Harness",			0, 0, 0, 0
-1	Play_Animation,		6, "XG_HD_Harness.XG_HD_Harness", 0

; ****************************** Primary Destroyed

1000000 Destroy_Object, 1
1000000 Destroy_Object, 2
1000000 Destroy_Object, 3
1000000 Destroy_Object, 4
1000000 Destroy_Object, 5
1000000 Destroy_Object, 6


I know what the script does but i don't really get the numbers and how its build up. For example
1000000 Destroy_Object, 6
I know that it destroy the object 6 but what does the number 1000000 do? So if someone could explain in short what the numbers and stuff do i would be happy Smile



I think it's a timer, I never really delved too far into cinematic files, I just gleaned what I needed to know to make them work.
You can call these text files with "test_cinematic".



Re: Few questions [message #408894 is a reply to message #408859] Sat, 31 October 2009 04:21 Go to previous messageGo to next message
Hubba is currently offline  Hubba
Messages: 40
Registered: October 2009
Karma: 0
Recruit
Quote:



When you change character, you are an entirely new GameObject *, so the script that was attached to you previously is destroyed, because the object that the script was attached to no longer exists.
When you purchase a vehicle, the script is attached to the vehicle, if you killed the vehicle then you would no longer get the message. The same principle can be applied to changing your character, it's kinda like you killed your character by getting a new one.
You can never permanently attach a script to a players character, unless they are gauranteed to never be killed.
You can however, keep re-attaching the same script to a player whenever they are created.




So what should i attach the script to? Should i create a invisible object and attach the script to it and then when everything is done it would destroy the invisible object?

--------------------------------------
[SOLVED]Another question
How can i check if a player has a weapon?
bool Has_Weapon(GameObject *obj,const char *weapon)

I tried something like this:
if(Has_Weapon(obj,"POW_Railgun_Player")){
//Do something...
}

But it doesn't seem to work Huh



[Updated on: Fri, 06 November 2009 13:48]

Report message to a moderator

Re: Few questions [message #408896 is a reply to message #408894] Sat, 31 October 2009 04:41 Go to previous messageGo to next message
cAmpa is currently offline  cAmpa
Messages: 597
Registered: March 2006
Karma: 0
Colonel
Hubba wrote on Sat, 31 October 2009 12:21

Quote:



When you change character, you are an entirely new GameObject *, so the script that was attached to you previously is destroyed, because the object that the script was attached to no longer exists.
When you purchase a vehicle, the script is attached to the vehicle, if you killed the vehicle then you would no longer get the message. The same principle can be applied to changing your character, it's kinda like you killed your character by getting a new one.
You can never permanently attach a script to a players character, unless they are gauranteed to never be killed.
You can however, keep re-attaching the same script to a player whenever they are created.




So what should i attach the script to? Should i create a invisible object and attach the script to it and then when everything is done it would destroy the invisible object?

--------------------------------------
Another question
How can i check if a player has a weapon?
bool Has_Weapon(GameObject *obj,const char *weapon)

I tried something like this:
if(Has_Weapon(obj,"POW_Railgun_Player")){
//Do something...
}

But it doesn't seem to work Huh






You checked for a powerup, not for a weapon.


Bückstabü!
Re: Few questions [message #408903 is a reply to message #408896] Sat, 31 October 2009 05:56 Go to previous messageGo to next message
Hubba is currently offline  Hubba
Messages: 40
Registered: October 2009
Karma: 0
Recruit
cAmpa wrote on Sat, 31 October 2009 05:41

Hubba wrote on Sat, 31 October 2009 12:21

Quote:



When you change character, you are an entirely new GameObject *, so the script that was attached to you previously is destroyed, because the object that the script was attached to no longer exists.
When you purchase a vehicle, the script is attached to the vehicle, if you killed the vehicle then you would no longer get the message. The same principle can be applied to changing your character, it's kinda like you killed your character by getting a new one.
You can never permanently attach a script to a players character, unless they are gauranteed to never be killed.
You can however, keep re-attaching the same script to a player whenever they are created.




So what should i attach the script to? Should i create a invisible object and attach the script to it and then when everything is done it would destroy the invisible object?

--------------------------------------
Another question
How can i check if a player has a weapon?
bool Has_Weapon(GameObject *obj,const char *weapon)

I tried something like this:
if(Has_Weapon(obj,"POW_Railgun_Player")){
//Do something...
}

But it doesn't seem to work Huh






You checked for a powerup, not for a weapon.




Oops didn't notice that, Thanks cAmpa Smile
If someones wondering it should be "Weapon_Railgun_Player" instead of "POW_Railgun_Player"
----------------------------------
Another question:
Is there a way to check if a character has a "fly suit"

My fly command looks like this:
class flyChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
	GameObject *obj = Get_GameObj(ID);

        Toggle_Fly_Mode(obj);

     }
};
ChatCommandRegistrant<flyChatCommand> flyChatCommandReg("!fly",CHATTYPE_ALL,0,GAMEMODE_AOW);

[Updated on: Sat, 31 October 2009 05:59]

Report message to a moderator

Re: Few questions [message #408905 is a reply to message #408903] Sat, 31 October 2009 06:43 Go to previous messageGo to next message
cAmpa is currently offline  cAmpa
Messages: 597
Registered: March 2006
Karma: 0
Colonel
Hubba wrote on Sat, 31 October 2009 13:56

cAmpa wrote on Sat, 31 October 2009 05:41

Hubba wrote on Sat, 31 October 2009 12:21

Quote:



When you change character, you are an entirely new GameObject *, so the script that was attached to you previously is destroyed, because the object that the script was attached to no longer exists.
When you purchase a vehicle, the script is attached to the vehicle, if you killed the vehicle then you would no longer get the message. The same principle can be applied to changing your character, it's kinda like you killed your character by getting a new one.
You can never permanently attach a script to a players character, unless they are gauranteed to never be killed.
You can however, keep re-attaching the same script to a player whenever they are created.




So what should i attach the script to? Should i create a invisible object and attach the script to it and then when everything is done it would destroy the invisible object?

--------------------------------------
Another question
How can i check if a player has a weapon?
bool Has_Weapon(GameObject *obj,const char *weapon)

I tried something like this:
if(Has_Weapon(obj,"POW_Railgun_Player")){
//Do something...
}

But it doesn't seem to work Huh






You checked for a powerup, not for a weapon.




Oops didn't notice that, Thanks cAmpa Smile
If someones wondering it should be "Weapon_Railgun_Player" instead of "POW_Railgun_Player"
----------------------------------
Another question:
Is there a way to check if a character has a "fly suit"

My fly command looks like this:
class flyChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
	GameObject *obj = Get_GameObj(ID);

        Toggle_Fly_Mode(obj);

     }
};
ChatCommandRegistrant<flyChatCommand> flyChatCommandReg("!fly",CHATTYPE_ALL,0,GAMEMODE_AOW);




bool Get_Fly_Mode(GameObject *obj); //is this infantry flying via Set_Fly_Mode

Just search in the engine files headers, like "engine_obj2.h".


Bückstabü!
Re: Few questions [message #408919 is a reply to message #408905] Sat, 31 October 2009 12:10 Go to previous messageGo to next message
Hubba is currently offline  Hubba
Messages: 40
Registered: October 2009
Karma: 0
Recruit
cAmpa wrote on Sat, 31 October 2009 07:43

Hubba wrote on Sat, 31 October 2009 13:56

cAmpa wrote on Sat, 31 October 2009 05:41

Hubba wrote on Sat, 31 October 2009 12:21

Quote:



When you change character, you are an entirely new GameObject *, so the script that was attached to you previously is destroyed, because the object that the script was attached to no longer exists.
When you purchase a vehicle, the script is attached to the vehicle, if you killed the vehicle then you would no longer get the message. The same principle can be applied to changing your character, it's kinda like you killed your character by getting a new one.
You can never permanently attach a script to a players character, unless they are gauranteed to never be killed.
You can however, keep re-attaching the same script to a player whenever they are created.




So what should i attach the script to? Should i create a invisible object and attach the script to it and then when everything is done it would destroy the invisible object?

--------------------------------------
Another question
How can i check if a player has a weapon?
bool Has_Weapon(GameObject *obj,const char *weapon)

I tried something like this:
if(Has_Weapon(obj,"POW_Railgun_Player")){
//Do something...
}

But it doesn't seem to work Huh






You checked for a powerup, not for a weapon.




Oops didn't notice that, Thanks cAmpa Smile
If someones wondering it should be "Weapon_Railgun_Player" instead of "POW_Railgun_Player"
----------------------------------
Another question:
Is there a way to check if a character has a "fly suit"

My fly command looks like this:
class flyChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
	GameObject *obj = Get_GameObj(ID);

        Toggle_Fly_Mode(obj);

     }
};
ChatCommandRegistrant<flyChatCommand> flyChatCommandReg("!fly",CHATTYPE_ALL,0,GAMEMODE_AOW);




bool Get_Fly_Mode(GameObject *obj); //is this infantry flying via Set_Fly_Mode

Just search in the engine files headers, like "engine_obj2.h".


Thanks again Smile
Next time I will check there before i ask something about the methods.

[Updated on: Mon, 02 November 2009 10:17]

Report message to a moderator

Re: Few questions [message #409527 is a reply to message #408816] Thu, 05 November 2009 21:45 Go to previous messageGo to next message
Hubba is currently offline  Hubba
Messages: 40
Registered: October 2009
Karma: 0
Recruit
Hey. I have been wondering about this for a while. I made in level edit that refinery give +6 credits per second instead of 2.

But i want to make so if power plant gets destroyed it would only give +2. How can i change this? Can i attach a script to a building?

I thought something like this. If i can attach this script to the refinery if power plant gets destroyed?
Attach_Script_Once(obj,"GTH_Credit_Trickle", "-4,2.00");


I just don't know how to attach scripts to buildings and where the "pp gets destroyed" thing is located.

If you have a better way in doing this please tell Smile

Thanks
Hubba
Re: Few questions [message #409530 is a reply to message #408816] Thu, 05 November 2009 22:54 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
On the level loaded event, attach a script to the ref to grant the +4 money. Then attach another script at the same time to the PP (if it exists) that removes that script when it's destroyed, and adds just +1 instead.

void Level_Loaded() {
GameObject *GDIRef = Find_Refinery(1);
GameObject *NodRef = Find_Refinery(0);

GameObject *GDIPP = Find_Power_Plant(1);
GameObject *NodPP = Find_Power_Plant(0);

if(GDIREF){
Attach_Script_Once(GDIRef,"GTH_Credit_Trickle", "4,2.00");
}
if(NodRef){
Attach_Script_Once(NodRef,"GTH_Credit_Trickle", "4,2.00");
}

if(GDIPP){ //Not sure what what happen if you tried to attach it if it didn't exist
Attach_Script_Once(GDIPP,"hubba_pp_death", "");
}
if(NodPP){
Attach_Script_Once(NodPP,"hubba_pp_death", "");
}
//etc etc

}


hubba_pp_death should simply have a ::Killed event, and on that event it should find out it's own teams ref, remove the gth_credit script (if the ref still has any health), then re-attach a gth_credit but add +1 instead.


Pretty crude really, but it's 05:55 here and I'm sleepy.



Re: Few questions [message #409568 is a reply to message #409530] Fri, 06 November 2009 09:11 Go to previous messageGo to next message
Hubba is currently offline  Hubba
Messages: 40
Registered: October 2009
Karma: 0
Recruit
reborn wrote on Thu, 05 November 2009 23:54

On the level loaded event, attach a script to the ref to grant the +4 money. Then attach another script at the same time to the PP (if it exists) that removes that script when it's destroyed, and adds just +1 instead.

void Level_Loaded() {
GameObject *GDIRef = Find_Refinery(1);
GameObject *NodRef = Find_Refinery(0);

GameObject *GDIPP = Find_Power_Plant(1);
GameObject *NodPP = Find_Power_Plant(0);

if(GDIREF){
Attach_Script_Once(GDIRef,"GTH_Credit_Trickle", "4,2.00");
}
if(NodRef){
Attach_Script_Once(NodRef,"GTH_Credit_Trickle", "4,2.00");
}

if(GDIPP){ //Not sure what what happen if you tried to attach it if it didn't exist
Attach_Script_Once(GDIPP,"hubba_pp_death", "");
}
if(NodPP){
Attach_Script_Once(NodPP,"hubba_pp_death", "");
}
//etc etc

}


hubba_pp_death should simply have a ::Killed event, and on that event it should find out it's own teams ref, remove the gth_credit script (if the ref still has any health), then re-attach a gth_credit but add +1 instead.


Pretty crude really, but it's 05:55 here and I'm sleepy.


Hmm "GTH_Credit_Trickle" doesn't seem to work like that Huh
I think you can only attach it to players. Which would mean that i would have to attach the script when they join and reattach it to them when they die. And then it would probably be not in sync with the other credit_tickle which would mean that you would get +6 one second and then -4 the other second.

[Updated on: Fri, 06 November 2009 09:14]

Report message to a moderator

Re: Few questions [message #409609 is a reply to message #409568] Fri, 06 November 2009 13:27 Go to previous messageGo to next message
YazooGang is currently offline  YazooGang
Messages: 742
Registered: August 2008
Location: US
Karma: 0
Colonel
I didnt read through all the replies but this is how you adjust how many points you earn by damaging an object.

So, what you do is goto level editor, then you select a preset in the objects tree and hit Mod. A windows comes up and you hit the Settings tab. And there are alot of options. Looking at this picture will explain what options you would need to change in order to get different amount of points when you kill or damage an object.

index.php?t=getfile&id=12095&private=0

Re: Few questions [message #409615 is a reply to message #409609] Fri, 06 November 2009 13:46 Go to previous messageGo to next message
Hubba is currently offline  Hubba
Messages: 40
Registered: October 2009
Karma: 0
Recruit
YazooGang wrote on Fri, 06 November 2009 14:27

I didnt read through all the replies but this is how you adjust how many points you earn by damaging an object.

So, what you do is goto level editor, then you select a preset in the objects tree and hit Mod. A windows comes up and you hit the Settings tab. And there are alot of options. Looking at this picture will explain what options you would need to change in order to get different amount of points when you kill or damage an object.

index.php?t=getfile&id=12095&private=0




Thanks but that problem had already been solved. I will add "solved" to the questions that has already been solved.
But pictures make it very clear so this will sure help others. Who might be wondering where in level edit the "damegepoints" is located Smile
Re: Few questions [message #409673 is a reply to message #408816] Sat, 07 November 2009 01:00 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
Hubba, instead of using that credit script, make you own one. I think the give_credits in the commands class ends with a boolean meaning all players or not... So just set that boolean to true and attach it to the ref itself.


Re: Few questions [message #409680 is a reply to message #409673] Sat, 07 November 2009 03:05 Go to previous messageGo to next message
Hubba is currently offline  Hubba
Messages: 40
Registered: October 2009
Karma: 0
Recruit
reborn wrote on Sat, 07 November 2009 02:00

Hubba, instead of using that credit script, make you own one. I think the give_credits in the commands class ends with a boolean meaning all players or not... So just set that boolean to true and attach it to the ref itself.


So i have to make a script with a timer which would loop and give +4 credits to the players? Which would be attached to the powerplant and then if powerplant gets destroyed it would remove that script. Is this what you meant?
Re: Few questions [message #409742 is a reply to message #408816] Sat, 07 November 2009 13:47 Go to previous message
raven
Messages: 595
Registered: January 2007
Location: Toronto, Ontario
Karma: 0
Colonel
hook the building destroyed event, check if its the pp, if it is, attach the script to an invisible object or something

-Jelly Administrator
-Exodus Administrator
Previous Topic: CnC Reborn : Jumpjet Animation Test
Next Topic: PimPen Harvy
Goto Forum:
  


Current Time: Sun Dec 15 06:50:11 MST 2024

Total time taken to generate the page: 0.01365 seconds