Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Beacon
Beacon [message #272013] Mon, 09 July 2007 15:23 Go to next message
BlueThen is currently offline  BlueThen
Messages: 2402
Registered: February 2006
Karma: 0
General (2 Stars)
How could I get a beacon to deploy facing the direction the player is facing, if possible? Just need to do this for a mod.
Re: Beacon [message #272020 is a reply to message #272013] Mon, 09 July 2007 15:43 Go to previous messageGo to next message
a100 is currently offline  a100
Messages: 45
Registered: March 2007
Karma: 0
Recruit
You need to get the facing and use basic trig.
This is pseudo code for how to achieve it.


First:
#include <math.h>
#define PI 3.14159265 

Then:
On_Beacon_Creation {
   float facing = Commands->Get_Facing(planter)
   Vector3 pos = Commands-> Get_Position(planter)
   pos.X += -1*(cos(facing*(PI / 180)))
   pos.Y += -1*(sin(facing*(PI / 180)))
   // -1 is the distance away from the player can be set to more/less
   Commands->Set_Position(beacon,pos)
}


Only one problem tho which is that player could face a buidling and beacon may spawn in the building in which case its un-disarmable

Re: Beacon [message #272022 is a reply to message #272020] Mon, 09 July 2007 15:45 Go to previous messageGo to next message
BlueThen is currently offline  BlueThen
Messages: 2402
Registered: February 2006
Karma: 0
General (2 Stars)
a100 wrote on Mon, 09 July 2007 17:43

You need to get the facing and use basic trig.
This is pseudo code for how to achieve it.


First:
#include <math.h>
#define PI 3.14159265 

Then:
On_Beacon_Creation {
   float facing = Commands->Get_Facing(planter)
   Vector3 pos = Commands-> Get_Position(planter)
   pos.X += -1*(cos(facing*(PI / 180)))
   pos.Y += -1*(sin(facing*(PI / 180)))
   // -1 is the distance away from the player can be set to more/less
   Commands->Set_Position(beacon,pos)
}


Only one problem tho which is that player could face a buidling and beacon may spawn in the building in which case its un-disarmable




err I honestly don't know much C++, I can't even compile the scripts. Can you or someone else help me with this?
Re: Beacon [message #272044 is a reply to message #272013] Mon, 09 July 2007 17:22 Go to previous messageGo to next message
AoBfrost is currently offline  AoBfrost
Messages: 1248
Registered: March 2007
Karma: 0
General (1 Star)
Well i started off wanting to mod, got into the c++ craze without any knowledge then slowly learnt a few basic things...try it, if you cant get it, then ummmm....ask rashambo for lua help, if you cant get that, then get someone to script you a pluggin for ssgm to include this.

http://i4.photobucket.com/albums/y133/FMAROCKS/godotsig.gif
Scrin wrote on Fri, 05 October 2007 12:19

''whoa im the photoshop''

KANE LIVES!!!
Re: Beacon [message #272048 is a reply to message #272044] Mon, 09 July 2007 17:38 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3809
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
What you could do is have the beacon send a custom to the player when its created, the player could reflect the custom to the beacon. The beacon could be told to get the rotation of the object that sent the custom, and then use it for its own. This would work with visual basic.

Re: Beacon [message #272058 is a reply to message #272013] Mon, 09 July 2007 18:33 Go to previous messageGo to next message
a100 is currently offline  a100
Messages: 45
Registered: March 2007
Karma: 0
Recruit
I dought you can do it any other way then coding it in, but then again im wrong alot too Sarcasm
Re: Beacon [message #272061 is a reply to message #272013] Mon, 09 July 2007 18:47 Go to previous messageGo to next message
_SSnipe_ is currently offline  _SSnipe_
Messages: 4121
Registered: May 2007
Location: Riverside Southern Califo...
Karma: 0
General (4 Stars)
can i ask its it that big? i mean a beacon? come on...
Re: Beacon [message #272068 is a reply to message #272013] Mon, 09 July 2007 20:08 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
in Lua (only works in the next release, which isn't public yet)
function OnObjectCreate(Object)
    if Get_Preset_Name == "<beacon preset>" then
       Set_Facing(Object, Get_Facing(Get_Beacon_Planter))
    end
end
Re: Beacon [message #272076 is a reply to message #272068] Mon, 09 July 2007 21:19 Go to previous messageGo to next message
BlueThen is currently offline  BlueThen
Messages: 2402
Registered: February 2006
Karma: 0
General (2 Stars)
err... I've been working on learning c++, and I am still far away from modding ren with it.

I'm still confused..
Re: Beacon [message #272078 is a reply to message #272013] Mon, 09 July 2007 21:43 Go to previous message
AoBfrost is currently offline  AoBfrost
Messages: 1248
Registered: March 2007
Karma: 0
General (1 Star)
Level edit's presets help alot for characters, vehicles, objects, and animations, i used to ask whats the preset for this and that, now i search level edit and never asked again.

tips

editing ssaow

main function is in aow.cpp

editing ssgm

main function is gmscripts.cpp

editing crates

ssaow:crates.cpp
ssgm: gmcrates.cpp



http://i4.photobucket.com/albums/y133/FMAROCKS/godotsig.gif
Scrin wrote on Fri, 05 October 2007 12:19

''whoa im the photoshop''

KANE LIVES!!!

[Updated on: Mon, 09 July 2007 21:44]

Report message to a moderator

Previous Topic: calico submachine gun
Next Topic: Reflective Materials
Goto Forum:
  


Current Time: Sun Nov 10 04:28:38 MST 2024

Total time taken to generate the page: 0.01016 seconds