Command and Conquer: Renegade Official Forums - RDF feed
type: channel
description: C&C: Renegade --> Dying since 2003™, resurrected in 2024!
items: [script]AirStrike function
items: Re: AirStrike function

[script]AirStrike function
type: item
description: I made an airstrike funtion. Again I called it via a chat hook but it can be called in a number of ways. The function chooses a working enemy building at random (this part is thanks to WhiteDragon, you have no idea how long and how many attempts it took to actually get that part right). Then either Nod lear jets or a10 bombers start flying over. One of them drops off a small payload to the random building an causes it to lose 50% of it's health. The sounds and the rest of the planes flying over make it really realistic to be honest, I think it's quite smooth. I set the a10 and lear jet to un-teamed via the objects.gm file because they count towards the vehichle limit otherwise. There are other ways of getting around that, but this seemed easiest. I think I remember a slight issue with it with regards to the cinematics looping after being called. I'm sure that's just changing a 1 to a 0 in the text file somewhere after the animation. Here's a video of it, it's 21mb long, but you should get a half decent download speed. It's worth watching even if you arean't going to put it on your server, just to see it in-game. It's a bit long, and I sound half asleep (because I was), but it's fun to see if you havn't before: http://www.mp-gaming.com/reborn/movies/air_strike2.wmv Here's how I made it work: ///////////////////////// ///////////////////////// //// GDI A10 strike ///// ///////////////////////// ///////////////////////// void reb_GDI_a10_strike::Created(GameObject *obj) { Commands->Create_2D_WAV_Sound("m00evan_dsgn0073i1evan_snd.wav"); Console_Input("msg Warning!!!"); Console_Input("msg A-10 strike inbound at Nod's position"); GameObject *BuildingObj = Get_Random_Building(0); BuildingID = Commands->Get_ID(BuildingObj); A10ID = Commands->Get_ID(Commands->Create_Object("Invisible_Object",Commands->Get_Position(BuildingObj))); Commands->Start_Timer(obj,this,3.0f,1); Commands->Start_Timer(obj,this,6.0f,2); Commands->Start_Timer(obj,this,9.0f,3); Commands->Start_Timer(obj,t…
creator: reborn
date: 2007-12-05T12:34:31-00:00

Re: AirStrike function
type: item
description: Hey Rborn I Watched The Video It Is Good How Do I Add It To M y Server
creator: cpjok
date: 2007-12-05T12:42:48-00:00

Re: AirStrike function
type: item
description: I made it specifically for SSGM, so your server would need to be running that. You need to download the source code to SSGM that comes with the binaries anyway. You can find this on the www.black-cell.net downloads page here http://black-cell.net/downloads/index.php?act=category&id=6 (you will want the win32 version). Then you open up the .sln file located in the source code folder with microsoft visual studio. If you do not have visual studio installed and set up, then you can see this post here created by JohnWill for exactly that purpose: http://www.renegadeforums.com/index.php?t=msg&goto=296486&rid=3415&s rch=express#msg_296486 You add most of the code to the gm_main.cpp file, but there is some that goes in the gm_main.h file and the engine_gm.cpp and the engine_gm.h file. Obviously you need to compile it aswell. The cinematics need to be copy/pasted into there own .txt files and named what I have put just above the code tags and placed in your servers data folder. You could call the function with a chat hook for testing, but ideally you will call the function some other way to add to gameplay. chat hook example: class GDIa10ChatCommand : public ChatCommandClass { void Triggered(int ID,const TokenClass &Text,int ChatType) { GameObject *obj = Get_GameObj(ID); Commands->Attach_Script(obj,"reb_GDI_a10_strike",""); } }; ChatCommandRegistrant<GDIa10ChatCommand> GDIa10ChatCommandReg("!a10g",CHATTYPE_TEAM,0,GAMEMODE_AOW); class NodjetChatCommand : public ChatCommandClass { void Triggered(int ID,const TokenClass &Text,int ChatType) { GameObject *obj = Get_GameObj(ID); Commands->Attach_Script(obj,"reb_Nod_Jet_strike",""); } }; ChatCommandRegistrant<NodjetChatCommand> NodjetChatCommandReg("!a10n",CHATTYPE_TEAM,0,GAMEMODE_AOW);
creator: reborn
date: 2007-12-05T12:54:32-00:00

Re: AirStrike function
type: item
description: I Run SSGM And Lua Plugin V2.0 so do i follow the tutorial you sent in last post
creator: cpjok
date: 2007-12-05T13:20:29-00:00

Re: AirStrike function
type: item
description: This code is c++ not LUA, but the LUA plug-in will not harm it in any-way. If you get visual studio and the code to the right places. compile it and put it on your server then yes, you will be able to use the script.
creator: reborn
date: 2007-12-05T13:39:01-00:00

Re: AirStrike function
type: item
description: lol whats with the sharing reborn
creator: Gen_Blacky
date: 2007-12-05T14:11:19-00:00

Re: AirStrike function
type: item
description: Hm, reborn are you done with renegade, or why are you realising all your code?
creator: cAmpa
date: 2007-12-05T14:52:43-00:00

Re: AirStrike function
type: item
description: I'm not done with renegade. I am hoping to set a trend. If someone uses this code and the people in there server are happy with it then that's cool. If someone reads this and thinks of a way to adapt it to suit there needs then that's cool too. If it encourages others to post stuff then I might learn something, or it might give me inspiration, that's awesome. There are allot of reasons to release the code, I could go on for a long time talking about the pro's. I can't really see any cons. Sure I might have had a unique feature for my server. But I don't really think it matters how cool your server is, people only seem to join the a0 servers anyway. Besides, then people would only get to experiance it in one server. Plus, I am not the greatest programmer there is. Infact I am probably one of the most newbie programmers here. I really won't dispute that, there are allot better coders then me here. Allot better. So if I post this then there might be someone who see's it and makes it better. Whether they do it out of kindness, ego, boredom or whatever it doesn't really bother me. But they might make it more efficient, or have a better idea and make something more awesome. I have seen this kind of sharing, helping and collaberation on other game forums. Granted, they had more people that actually knew how to code, but it was really impressive to see people helping eachother out. There's few people here that do that. I don't know why. If I can encourage others to do the same then I will be really really pleased with myself.
creator: reborn
date: 2007-12-05T15:07:13-00:00

Re: AirStrike function
type: item
description: youre posting commands that i already have... ps. i have 3 diffrent airstrukes
creator: mrãçķz
date: 2007-12-05T15:11:17-00:00

Re: AirStrike function
type: item
description: MadRockz wrote on Wed, 05 December 2007 10:11 youre posting commands that i already have... ps. i have 3 diffrent airstrukes Seeing as how anybody can now have an airstrike, and with the source code they can mix it up a bit. Why don't you release yours too?
creator: reborn
date: 2007-12-05T15:12:46-00:00

Re: AirStrike function
type: item
description: cuz i dont wanted that all server have it, later all server´s will be the same. Then nobody get´s his 0wn Ideas... oh and its only for lua cuz i still cant add scripts to scripts.dll
creator: mrãçķz
date: 2007-12-05T15:17:48-00:00

Re: AirStrike function
type: item
description: MadRockz wrote on Wed, 05 December 2007 10:17 cuz i dont wanted that all server have it, later all server´s will be the same. Then nobody get´s his 0wn Ideas... That's the spirit.
creator: reborn
date: 2007-12-05T15:18:36-00:00

Re: AirStrike function
type: item
description: if all servers starting to be same im going to work on my new Renegade Mode ...
creator: mrãçķz
date: 2007-12-05T15:25:21-00:00

Re: AirStrike function
type: item
description: What you should do is when you call a function which is supposed to return a pointer to something, check the pointer to make sure it isn't NULL. GameObject *a101 = Commands->Find_Object(A10ID); if(!a101) { //an error }
creator: jnz
date: 2007-12-05T15:35:33-00:00

Re: AirStrike function
type: item
description: Quote: But I don't really think it matters how cool your server is, people only seem to join the a0 servers anyway. I think you are wrong, i dont have a really good a00 nick, but my server is unique and therefore popular. But its your code and your spent time, i can only say. Thx reborn for the code, i will add it to my aow mod.
creator: cAmpa
date: 2007-12-05T15:57:18-00:00

Re: AirStrike function
type: item
description: Haven't watched the video yet so I don't know if it already does this. But perhaps you can make a way so that it doesn't work when there are enemy sam sites or something. But other than that, great job.
creator: bisen11
date: 2007-12-05T16:05:29-00:00

Re: AirStrike function
type: item
description: This would be good incorperated with Hex's Vet scriptys. IE Once you get promoted to level 3 or whatever, you gain access to the Airstrike Command which can be used once every 5 mins or so. The existing !veh and !weap etc are pretty lame tbh.
creator: crazfulla
date: 2007-12-05T16:08:47-00:00

Re: AirStrike function
type: item
description: Can this be used in MP ractiece, and if so (or if not) how would I get it to work on my renegade FDS, and lol would it work in demo or SS? Thanks...
creator: The Elite Officer
date: 2007-12-05T19:40:22-00:00

Re: AirStrike function
type: item
description: Quote: Jet_3.txt There is a wrong "Nod_Jetr"
creator: cAmpa
date: 2007-12-05T23:52:25-00:00

Re: AirStrike function
type: item
description: The Elite Officer wrote on Wed, 05 December 2007 14:40 Can this be used in MP ractiece, and if so (or if not) how would I get it to work on my renegade FDS, and lol would it work in demo or SS? Thanks... It might working in multiplayer practice if you mod your client scripts.dll to include this. I haven't tried doing that. But I guess it could be possible to have all the features of SSGM in your single player mission and mulptiplay practice. I have no idea if it would work in the demop, I don;t know how much things differ. Tjere might be addresses and stuff that have changed that the rest of SSGM relies on. Show the code to the people who are making that demo server regulator thing, they might have a better clue. cAmpa wrote on Wed, 05 December 2007 18:52 Quote: Jet_3.txt There is a wrong "Nod_Jetr" Thanks man
creator: reborn
date: 2007-12-06T00:10:15-00:00

Re: AirStrike function
type: item
description: None of the scripts.dll code is compatible with the demo version of renegade.
creator: jonwil
date: 2007-12-06T00:29:07-00:00

Re: AirStrike function
type: item
description: mhmm, after the attack, all the a10 and jets are looping and looping and looping. I think u forgot to kill the objects after attack?
creator: cAmpa
date: 2007-12-06T00:47:44-00:00

Re: AirStrike function
type: item
description: cAmpa wrote on Wed, 05 December 2007 18:47 mhmm, after the attack, all the a10 and jets are looping and looping and looping. I think u forgot to kill the objects after attack? I found the same thing.. and as a result of this the team in which the vehicles belong to are at their vehicle limit..lol
creator: raven
date: 2007-12-06T00:58:50-00:00

Re: AirStrike function
type: item
description: read you buggers Quote: I set the a10 and lear jet to un-teamed via the objects.gm file because they count towards the vehichle limit otherwise. There are other ways of getting around that, but this seemed easiest. I think I remember a slight issue with it with regards to the cinematics looping after being called. I'm sure that's just changing a 1 to a 0 in the text file somewhere after the animation.
creator: reborn
date: 2007-12-06T01:23:29-00:00

Re: AirStrike function
type: item
description: LOL, completely missed that Thanks Reborn!
creator: raven
date: 2007-12-06T01:26:00-00:00

Re: AirStrike function
type: item
description: Very nice Reborn! It looks pretty sweet. And you get props from me for sharing it. +10 Brownie points for Reborn.
creator: Sn1per74*
date: 2007-12-06T01:53:53-00:00

Re: AirStrike function
type: item
description: Gen_Blacky wrote on Wed, 05 December 2007 08:11 lol whats with the sharing reborn Do not question! else he'll change his mind!
creator: BlueThen
date: 2007-12-06T02:17:56-00:00

Re: AirStrike function
type: item
description: I think he's been waiting to release his scripts for a while because he's been testing/debugging/et cetera That, plus I think he's been busy with his personal life. ~MathK1LL
creator: Genesis2001
date: 2007-12-06T02:22:45-00:00

Re: AirStrike function
type: item
description: wow thats a lot of coding but fuck that looks so awsome man!
creator: _SSnipe_
date: 2007-12-09T09:45:14-00:00

Re: AirStrike function
type: item
description: 50% seems a little much.
creator: Sir Kane
date: 2007-12-09T09:55:45-00:00

Re: AirStrike function
type: item
description: Sir Kane wrote on Sun, 09 December 2007 04:55 50% seems a little much. Could you help maybe remove some of the crap then?
creator: reborn
date: 2007-12-09T10:22:44-00:00

Re: AirStrike function
type: item
description: What crap?
creator: Sir Kane
date: 2007-12-09T10:50:25-00:00

Re: AirStrike function
type: item
description: Sir Kane wrote on Sun, 09 December 2007 05:50 What crap? You said it looked lake half of it wasn't needed. If it is bloated or poorly coded could you help?
creator: reborn
date: 2007-12-09T11:01:41-00:00

Re: AirStrike function
type: item
description: reborn wrote on Wed, 05 December 2007 06:34 One of them drops off a small payload to the random building an causes it to lose 50% of it's health.
creator: Sir Kane
date: 2007-12-09T11:19:10-00:00

Re: AirStrike function
type: item
description: Ah sorry, I totally mis-understood.
creator: reborn
date: 2007-12-09T12:02:34-00:00

Re: AirStrike function
type: item
description: I'm temped too add this as a command to my veteran system
creator: Hex
date: 2007-12-09T12:24:23-00:00

Re: AirStrike function
type: item
description: Hex wrote on Sun, 09 December 2007 07:24 I'm temped too add this as a command to my veteran system Go for it
creator: reborn
date: 2007-12-09T13:00:02-00:00

Re: AirStrike function
type: item
description: reborn wrote on Sun, 09 December 2007 07:00 Hex wrote on Sun, 09 December 2007 07:24 I'm temped too add this as a command to my veteran system Go for it ^ Similar to how you can use certain "powers" once you reach a certain rank in C&C TW, and these powers can be used in conjunction with a tank rush or superweapon to pwn the enemy's base royally.
creator: crazfulla
date: 2007-12-10T15:48:25-00:00

Re: AirStrike function
type: item
description: why cant i compile the file? im hitting (F7) but nothing happens, i got c++ 2008. can someone help me on that?
creator: wittebolx
date: 2007-12-12T15:25:10-00:00

Re: AirStrike function
type: item
description: nvm, got it to work
creator: wittebolx
date: 2007-12-12T16:11:23-00:00

Re: AirStrike function
type: item
description: only compiling the original source of SSGM gives a problem
creator: wittebolx
date: 2007-12-12T17:26:20-00:00

Re: AirStrike function
type: item
description: You're missing a library that you need to include(not "#include"). I forget the actual name of the .lib file you need to import but it starts with an 'a' :\ ~MathK1LL
creator: Genesis2001
date: 2007-12-12T17:42:59-00:00

Re: AirStrike function
type: item
description: He wanted a chat hook that made it cost a player 5000 credits to call in the airstrike. I made it for him. Here is a compiled version with source code: http://www.mp-gaming.com/reborns/coderelease/white.zip It really is only a cheap chat hook. I don't really recomend it tbh, my idea was to have the function called as some random event, or a power-up. Not based on credits. The chat hook can be used in team chat with !a10n and !a10g, both teams can use either one. He didn't ask for Nod to only use the Nod one and vise-versa, but really all you have to do to enable that is add to the conditional where I check for the credits the players has for there obj's team.
creator: reborn
date: 2007-12-12T17:55:22-00:00

Re: AirStrike function
type: item
description: reborn wrote on Wed, 12 December 2007 10:55 He wanted a chat hook that made it cost a player 5000 credits to call in the airstrike. I made it for him. Here is a compiled version with source code: http://www.mp-gaming.com/reborn/coderelease/white.zip It really is only a cheap chat hook. I don't really recomend it tbh, my idea was to have the function called as some random event, or a power-up. Not based on credits. The chat hook can be used in team chat with !a10n and !a10g, both teams can use either one. He didn't ask for Nod to only use the Nod one and vise-versa, but really all you have to do to enable that is add to the conditional where I check for the credits the players has for there obj's team. Will try this out when I get home. I'll see what I can do with it. A crate may be good to do ~MathK1LL
creator: Genesis2001
date: 2007-12-12T17:59:11-00:00

Re: AirStrike function
type: item
description: MathK1LL wrote on Wed, 12 December 2007 18:59 reborn wrote on Wed, 12 December 2007 10:55 He wanted a chat hook that made it cost a player 5000 credits to call in the airstrike. I made it for him. Here is a compiled version with source code: http://www.mp-gaming.com/reborn/coderelease/white.zip It really is only a cheap chat hook. I don't really recomend it tbh, my idea was to have the function called as some random event, or a power-up. Not based on credits. The chat hook can be used in team chat with !a10n and !a10g, both teams can use either one. He didn't ask for Nod to only use the Nod one and vise-versa, but really all you have to do to enable that is add to the conditional where I check for the credits the players has for there obj's team. Will try this out when I get home. I'll see what I can do with it. A crate may be good to do ~MathK1LL the buildlog..error..
creator: wittebolx
date: 2007-12-13T08:04:41-00:00

Re: AirStrike function
type: item
description: Why would you want a chat hook for that? It hits a building for 50% of its health, that basically means anyone with a lot of credits can decimate a building. And chat hooks are quite unoriginal.
creator: Ethenal
date: 2007-12-14T22:01:57-00:00

Re: AirStrike function
type: item
description: reborn put it inside a chat hook for testing purposes. :\ ~MathK1LL
creator: Genesis2001
date: 2007-12-14T23:56:43-00:00

Re: AirStrike function
type: item
description: MathK1LL wrote on Fri, 14 December 2007 17:56 reborn put it inside a chat hook for testing purposes. :\ ~MathK1LL No, I believe he made it for wittebolx. I could be completely wrong though.
creator: Ethenal
date: 2007-12-15T04:06:45-00:00

Re: AirStrike function
type: item
description: I made a chat hook for testing purposes, but then wittebolx asked me to make him a chat hook that he could use for gameplay purposes. I did actually say I didn't recomend it, frankly I agree. I hate all the nasty chat hooks. I intended for the functions to be "seemless", like a random event or a crate. Like it was supposed to be in the game or something, not some tacky chat hook.
creator: reborn
date: 2007-12-15T06:14:06-00:00

Re: AirStrike function
type: item
description: I need a workaround for the looping. I played with many options, but none of them helped.
creator: EA-DamageEverything
date: 2008-05-10T17:13:27-00:00

Re: AirStrike function
type: item
description: I think the looping is a boolean value at the end of the animation function. Set them all to a 0 and I think it should work...
creator: reborn
date: 2008-05-11T10:11:25-00:00

Re: AirStrike function
type: item
description: I tried that (play animation 0 instead of 1) and the picture shows what happened on Walls_Flying and every other map I tested it=
creator: EA-DamageEverything
date: 2008-05-12T01:26:42-00:00

Re: AirStrike function
type: item
description: They just stay there, but no loop? That makes sense I guess, it's just stuck on the last frame of the animation... They are all real objects, so you can destroy them. I can't remember from memory what the right syntax is, but it is most likely something simple like destroy_object; Or you could attach a script to it that destroys the object after x amount of time... void reb_timed_destroy::Created(GameObject *obj){ Commands->Start_Timer(obj,this,31.0f,1); } void reb_timed_destroy::Timer_Expired(GameObject *obj, int number){ if(number ==1){ Commands->Destroy_Object(obj); } } ScriptRegistrant<reb_timed_destroy> reb_timed_destroy_Registrant("reb_timed_destroy",""); class reb_timed_destroy : public ScriptImpClass { void Created(GameObject *obj); void Timer_Expired(GameObject *obj,int number); }; Just change the float value 31.0f to however many seconds you want it to wait until it destroys the object it is attached to.
creator: reborn
date: 2008-05-12T09:45:06-00:00

Re: AirStrike function
type: item
description: why cant i get it i think i put the codes in the right places.....unless someone cant tell me? but this is what i get 1>.\gmscripts.cpp(68) : error C3861: 'Get_Random_Building': identifier not found 1>.\gmscripts.cpp(128) : error C3861: 'Get_Random_Building': identifier not found 1>.\gmscripts.cpp(1506) : error C2448: 'GDIreChatCommandReg' : function-style initializer appears to be a function definition but like i said i not sure what file to put them in but ya im also confussed on this and all the other codes everyone release here...wat files to put the code in
creator: _SSnipe_
date: 2008-05-12T18:52:27-00:00

Re: AirStrike function
type: item
description: SSnipe wrote on Mon, 12 May 2008 20:52 why cant i get it i think i put the codes in the right places 1>.\gmscripts.cpp(68) : error C3861: 'Get_Random_Building': identifier not found ...wat files to put the code in The Random_Building is an addition to SSGM and has to be put in this way: engine_gm.cpp GameObject * Get_Random_Building(int Team) { std::vector<GameObject*> Buildings; GenericSLNode *x = BuildingGameObjList->HeadNode; while (x != 0) { GameObject *obj = (GameObject *)x->NodeData; if (obj && (Get_Object_Type(obj) == Team || Team == 2) && !Is_Building_Dead(obj)) { Buildings.push_back(obj); } x = x->NodeNext; } if (!Buildings.empty()) { int Rand = Commands->Get_Random_Int(0,Buildings.size()); return Buildings[Rand]; } return 0; } This comes right after "GameObject *Find_My_Veh" --------- To get it working, you have to put the following into engine_gm.h GameObject *Get_Random_Building(int Team); // Selects a random building which has to be alive This goes under "GameObject *Find_My_Veh(GameObject *obj); //Find my vehicle" ---------------- Generally, scripts should go into the gmmain.cpp, their classes into gmmain.h, ScriptRegistrants into gmmain.cpp OR gmcrate.cpp (does work even if it isn't a crate event). Chat hooks are in the gmmain.cpp, their Scriptregistrants can be put either in gmmain.cpp OR gmcrate.cpp. ========== Reborn thanks for the script, I'll check it later.
creator: EA-DamageEverything
date: 2008-05-13T11:04:51-00:00